Commit graph

287 commits

Author SHA1 Message Date
rillig
35d85c0109 mk/wrapper/transform-gcc: pass -Wno-* without warning
Seen in lang/mono6.
2020-05-02 19:32:59 +00:00
rillig
ec5b9249a5 mk/wrapper: allow "unwrap" to be a no-op SUBST block
Discovered in pkgtools/pkg, where libpkg/pkg.pc was left unmodified.
2020-04-27 05:23:11 +00:00
rillig
c61b55368a mk/wrapper/transform-gcc: pass -Werror=* without warning 2020-03-22 11:05:50 +00:00
rillig
b88d952e81 mk: allow "bmake clean depends" as shortcut
When "bmake clean depends" was called for a package where the various
cookie files already existed, these would enable different rules than a
clean package directory.

Since "bmake clean" deletes all the cookie files before "bmake depends"
starts, in these combined command lines the cookie files must be treated
as absent.
2019-05-07 19:36:43 +00:00
maya
373c79fede Add a rule for -Wp,-MD, which isn't provided by MIPSPro.
MDupdate is the equivalent.

From duck in PR pkg/48424.
2018-11-20 09:21:23 +00:00
maya
6c25dec844 Remove clauses 3,4 from TNF-only copyright blocks.
This is based on the decision The NetBSD Foundation made in 2008 to
do so, which was already applied to src.

This change has been applied to code which is likely not in other
repositories.

ok board@, reviewed by riastradh@
2018-08-22 20:48:36 +00:00
khorben
ff2d2f3e7a Disable the flags for PKGSRC_MKPIE when explicitly required
This notably allows emulators/qemu to properly detect support for PIE, and
disable it where appropriate. This does not work with cwrappers yet.
2018-06-19 05:02:10 +00:00
khorben
5535fa5372 Really use the parent sink for ld(1) 2017-11-16 02:43:51 +00:00
khorben
e6f2bb8178 Introduce a command sink for ld(1) with MKPIE
When not using cwrappers, so far PKGSRC_MKPIE was only automatically
applied when linking using gcc(1) (when enabled). This is now also the
case for packages using ld(1) to link executables.
2017-11-16 02:16:56 +00:00
khorben
0f9d009bd0 Recognize more situations where not linking executables
This is only relevant for PKGSRC_MKPIE. It partly reflects a fix that
was committed to the cwrappers for MKPIE, where the "-pie" flag was
automatically added in spite of the linker not actually creating an
executable.
2017-11-16 00:40:07 +00:00
khorben
edf994459b Obtain the MKPIE flags from the environment
This solves an issue with the command sink component of the MKPIE
wrapper for GCC, where the contents of the _MKPIE_CFLAGS.gcc and
_MKPIE_LDFLAGS.gcc variables was guessed. It is now communicated to
cmd-sink-mkpie-gcc through the environment instead.
2017-11-16 00:36:10 +00:00
khorben
38179c5558 Let the MKPIE command sink for GCC re-use the generic command sink
The cmd-sink-mkpie-gcc component for PKGSRC_MKPIE support on GCC was
lagging behind the generic one. This makes sure it cannot happen again,
by invoking the generic sink right away.
2017-11-16 00:31:47 +00:00
khorben
8a2d0743ad More consistent log output 2017-04-16 16:48:48 +00:00
ryoon
f4cce41621 Allow '-l m' like '-lm' and update the comment for -l and -D
O.k. by jperkin@ and dholland@
2016-09-16 13:12:29 +00:00
markd
9cd5091c7b Add support for -isystem to legacy wrappers.
rewrite "-isystem dir" as "-isystem,dir"
  transform "-isystem,dir" in same ways as "-Idir"
  rewrite "-isystem,dir" back to "-isystem dir" in cmd-sink
2016-03-14 20:11:56 +00:00
khorben
1778fc2c25 Also determine when compiling from source files
This allows fixing an issue with PKGSRC_MKPIE, where "gcc source.c" would
not work. Some packages rely on this test to determine if a working
compiler is available.
2016-03-13 15:32:06 +00:00
khorben
d8dbc296fa Also register "-pie" as a known argument for gcc(1)
As suggested by wiz@
2016-03-12 21:22:04 +00:00
khorben
dc4ad6b750 Add support for a number of security features
- Revisit (and rename) support for FORTIFY as PKGSRC_USE_FORTIFY (instead
  of PKGSRC_USE_FORT) for easier support outside NetBSD/gcc;
- PKGSRC_USE_SSP is no longer enabled by default when PKGSRC_USE_FORTIFY
  is enabled;
- PKGSRC_MKPIE builds executables as PIE (to leverage userland ASLR)
- PKGSRC_USE_RELRO builds with a read-only GOT to prevent some exploits
  from functioning.

Tested on NetBSD/amd64 by myself, in every combination, with and without
pkgtools/cwrappers. MKPIE is not supported at the moment with cwrappers.
Also, MKPIE is known to still break a number of packages when enabled (and
actually supported).

Tested on SunOS by jperkin@, thank you!

As discussed on tech-pkg@, the default behavior is not changed, except
where noted above.

ok bsiegert@
2016-03-11 23:03:31 +00:00
tnn
7f5db266bf pass correct ABI via OBJECT_MODE environment variable on AIX
It turns out a handful of AIX binutil-like utilities are particular
about type of object files they should examine.  Instead of piping
through flags for each utility everywhere, it is easier to just export
'OBJECT_MODE=[32|64]' instead.

From Eric N. Vander Weele.
2016-03-04 21:25:47 +00:00
tnn
fbb9c37ab2 pass correct ABI flags to ar(1) on AIX
AIX is particular about the type of object files `ar` should examine.
This should be set explicitly to coincide with the user's defined $ABI.

Contributed by Eric N. Vander Weele.
2016-03-04 01:38:39 +00:00
rillig
913583c370 Fixed subst.mk not to corrupt files
Up to now, using subst.mk may have led to file corruption during active
package development. This happened when a sed(1) command had a syntax
error, in which case the whole sed(1) command was terminated, leaving an
empty original file behind.

This commit changes that behavior by applying the sed(1) commands to
the original file and saving the result in a temporary file. Only
after that succeeded is the original file overwritten.

During this rewrite, SUBST_POSTCMD has been removed, since it was
only used in one place (mk/wrapper), and since it relied on the exact
sequence of the internal commands. No package in either main pkgsrc
or pkgsrc-wip uses this variable right now.
2016-01-31 17:27:41 +00:00
richard
9537608068 PR pkg/47404
wrapper should convert '--rpath' to '-rpath', fixing pysvn as well as
many other packages inadvertently using double-dash form of rpath.
2015-11-20 05:49:24 +00:00
jperkin
1a2757e82f Introduce _USE_CWRAPPERS logic to ensure consistency, USE_CWRAPPERS could
differ between a package and user setting, resulting in incorrect WRAPPER_*
values being set from wrapper-defs.mk.
2015-04-29 14:23:23 +00:00
jperkin
c79e6c9aef Move cwrappers WRAPPER_DIR and WRAPPER_BINDIR to wrapper-defs.mk, it is
included by bsd.prefs.mk so we need to ensure consistency.
2015-04-28 21:15:01 +00:00
jperkin
d040a0e7c5 Split cwrappers from legacy wrappers. We no longer generate the legacy
wrappers when USE_CWRAPPERS is enabled, saving a reasonable amount of
I/O during builds, mostly due to avoiding the transform/untransform sed
file generations.

WRAPPER_DIR and WRAPPER_BINDIR are used by various packages to override
or point to specific wrappers, and these now point to the cwrappers
directory when enabled, removing the need for CWRAPPERS_BIN_DIR
duplication and fixing packages which previously were using legacy
wrappers by accident.

A number of targets are now duplicated between bsd.wrapper.mk and
cwrappers.mk, the intention being that the legacy wrappers will be
deprecated once cwrappers is verified on all supported platforms.  If
that turns out to take longer than expected, we will probably want to
introduce a wrapper.mk to abstract them away before loading the
appropriate back-end.
2015-04-27 19:59:07 +00:00
jperkin
6c2c920fd0 Remove ECHO_WRAPPER_MSG and just use ECHO_BUILDLINK_MSG, which was set
to the same value anyway.  Also removes a comment from 2005 which was
possibly wrong at the time it was committed, given the same construct
has been used in bsd.buildlink3.mk unchanged since 2004.
2015-04-27 19:38:03 +00:00
tnn
b01007a2ee revert rev. 1.7. Although it should be correct in theory it interacts
with the build of some packages in subtle ways, and needs more testing.
2015-04-26 07:59:58 +00:00
wiz
e427a26a70 Fix typo in comment. 2015-04-25 22:26:41 +00:00
tnn
771073a47d If we have -Wl,--whole-archive -lfoo -lbar -Wl,--no-whole-archive
surrounding a list of static libraries, we must preserve that order so the
effect of --whole-archive is as intended by the package.
cwrappers does this correctly but classic wrappers didn't.
2015-04-25 22:15:38 +00:00
wiz
627d407a75 Remove pkg_views support, second part: infrastructure. 2014-12-30 15:13:19 +00:00
joerg
37084183c6 Separate dependency from nada-rule. 2014-11-25 18:27:49 +00:00
joerg
516b42831c Add cwrappers glue as developed during Google's Summer of Code 2007. 2014-11-24 00:32:31 +00:00
jperkin
ee4800c69c Replace calls to cat(1) with echo(1) which is highly likely to be a shell
builtin.  This significantly reduces the number of exec's required during
the 'wrapper' phase and brings the execution time down accordingly.
2014-09-02 14:23:00 +00:00
uebayasi
36b92c2e0c Variable override is confusing. 2014-03-06 10:19:43 +00:00
uebayasi
117cbdcd8a Wrap not only ld but also ar and ranlib. 2014-03-06 10:15:54 +00:00
jperkin
6792284e7a Remove special handling of -v in the wrappers.
This was originally introduced to work around some behaviour in the
libtool build, however these days it is actively harmful for a number of
packages, where removing additional arguments when -v is present on the
command line can break ABI detection (notably in CMake packages).

Instead, filter out any references to BUILDLINK_DIR from the libtool
scripts, as that should do the same job.

Retain the ability to run the 'scan' wrapper script, as it can be useful
in certain cases, and is required to support the scan-libtool script
anyway.
2014-02-26 10:40:46 +00:00
tron
c05e16109a Don't try to convert the SunStudio option "-mt". There is no GCC option
which is accepted by both the GCC bundled with Solaris 10 and the more
modern GCC versions availabe in "pkgsrc". Handling of POSIX thread
related options should be left to pkgsrc anyway.

Fix based on a suggestion by Richard Palo.
2013-12-31 13:56:35 +00:00
riastradh
ed8be66086 Use --sysroot in cpp/gcc/gxx cross-compiler wrappers.
Now that NetBSD supports --sysroot we don't need to mess with the
partial measures of -nostdinc, -isystem, &c.

ok agc
2013-05-09 23:35:29 +00:00
uebayasi
86615a3bb5 Fix a harmless typo. 2013-04-21 03:51:27 +00:00
jperkin
883524d430 Create a wrapper for gfortran. 2013-03-01 13:27:38 +00:00
jperkin
b7642344f0 Pass through -specs, as used by devel/binutils/override-as.mk 2012-07-23 11:58:41 +00:00
marino
1a21fb3999 compiler.mk/gcc.mk: Add support for USE_LANGUAGES+= ada
All recent packages featuring Ada code have a hard dependency on the
lang/gnat-aux compiler package.  The valid values for USE_LANGUAGES
are c, c99, c++, fortran, fortran77, java, objc, so specifying a
specific compiler was necessary up into now.

One problem with lang/gnat-aux is that it is installed at ${LOCALBASE}
where the lang/gccXX compilers are installed at ${LOCALBASE}/gccXX.
The latter compilers have no possibility of sharing conflicting files
unlike lang/gnat-aux.  Rather than fundamentally update the GCC 4.6-based
lang/gnat-aux to avoid these conflicts, a new Ada-capable compiler
based on GCC 4.7 was created with the intent of being supported by
mk/compiler.mk and mk/compiler/gcc.mk.

The Ada packages will be effectively migrated from lang/gnat-aux to the
new lang/gcc-aux compiler, but lang/gcc-aux will remain as a standalone
package as it is the only GCC 4.6-based compiler that builds on
DragonFly and serves it as a world and kernel compile option.

In addition to the current language wrappers, lang/gcc-aux adds
wrappers for "ada" (unique to gcc-aux, hardlinked to gcc driver),
and the gnat, gnatmake, gnatbind, gnatlink, gnatchop, gnatprep,
and gnatls programs.  Supporting all of these allows the wrapper
system to be used with Ada packages; currently wrappers are mostly
disabled on them.

The lang/gcc47 implicitly adds support for the "objc-c++" language by
adding it to the USE_LANGUAGES list, but it wasn't really supported.
An attempt was made to better support objc-c++, but this new enumeration
probably still needs work or needs to be removed completely.

Logic for Ada support:
1) All lang/gccXX compilers have version numbers ranging from 2.8.1 to 9.
2) lang/gcc-aux uses the release date as its version number in the form of
   YYYYMMDD with a minimum value of 20120614, so there is no version
   overlap.
3) When at least one element of USE_LANGUAGES is "ada", the value of
   20120614 is added to the set of GCC_REQD which selects lang/gcc-aux.
4) The _NEED_NEWER_GCC check is disabled.  It fails and isn't relevant;
   unless a package sets GCC_REQD over 20120614, the only way to select
   lang/gcc-aux is to specify the Ada language and only one compiler
   known to gcc.mk can support it.
2012-07-08 19:57:10 +00:00
obache
9d0abaeb6c Ignore SunPRO -errwarn flags to prevent it from being recognized as a entry
point option for `ld'.
2012-06-08 11:39:44 +00:00
wiz
fd2c8c7186 Fix typo in comment. 2012-04-13 06:36:08 +00:00
sbd
bcac6ae79b Treat the '--as-needed' and '--no-as-needed' arguments to ld as if
thay are librarys so that they still surround the given library.
WARNING: this may not work if the wrapper reorders librarys.
2012-04-13 03:11:13 +00:00
he
6e628b356e Rewrite any -R<dir> into -Wl,-R<dir>. -R is the old form of -Wl,-R,
but our gcc re-orders them so that all -R args come at the front
of the "ld" invocation.  This messes up the relative search order,
and is at least partly responsible for "the pixman problem"
experienced on (at least) NetBSD 5.1.  This is as close as a general
fix as I can think of, and should fix PR#46130, although it possibly
doesn't fix every instance of this more general problem.
2012-03-07 12:55:53 +00:00
shattered
cf49cc2189 Transform -ggdb<level> to -g, too. 2012-02-07 09:42:05 +00:00
bsiegert
3039ebe47a Make transform-gcc recognize some the strange and disturbing things which
are in the default CFLAGS on MirBSD.
2012-02-06 13:03:55 +00:00
fhajny
4a88e01fad Revert runaway commit 2012-02-06 12:49:38 +00:00
fhajny
bd77327b68 Added devel/ruby-kgio, www/ruby-raindrops and www/ruby-unicorn 2012-02-06 12:41:28 +00:00