Commit graph

246 commits

Author SHA1 Message Date
wiz
7b149405e7 mk: add stack-clash option to PKGSRC_USE_STACK_CHECK 2022-08-01 07:58:21 +00:00
jperkin
9b652873fc mk: Move GCC <= 4.4 override out of for loop.
Possible performance improvement, no funtional change.
2022-07-07 16:23:39 +00:00
jperkin
b5a2d55ae0 mk: Add support for newer C standards.
For now the GCC "c99 == gnu99" override is kept, but gnu99 is now supported as
a specific value for USE_LANGUAGES, so we may want to be specific where
required.

c11 and c17 (and the corresponding gnu11/gnu17 versions) are newly supported.
2022-07-05 17:32:24 +00:00
adam
cb24fa01e0 gcc.mk: support gcc12 2022-06-16 15:46:22 +00:00
gutteridge
28c860a56a gcc.mk: restore GCC 6 handling
This is partly intended as a workaround to fix behaviour on NetBSD 8.x
where GCC 7 was being pulled in universally after the prior commits
here. Now it behaves as expected. There is an unaddressed issue in this
code that needs to be examined further. (This has been discussed in
more than one recent thread on teck-pkg@, including John Klos's report
of this issue.)

In any case, GCC 6 has also seen build improvements by nia@, who noted
it's safe to simply revert part of the original change set, in one of
those discussions on tech-pkg. (We can't use the hack introduced in the
prior revisions for GCC 6, though, or this same broken dependency
pattern occurs and will universally force GCC 6 instead of 7 on NetBSD
8.x.)

Tested on NetBSD 8.2_STABLE and 9.2_STABLE with various packages,
including tcsh, the original reported issue.
2022-05-28 02:31:47 +00:00
nia
725c7fc567 gcc.mk: fix syntax 2022-05-21 09:26:50 +00:00
nia
e59dd36da6 gcc.mk: Force USE_GCC_RUNTIME (etc.) on older NetBSD versions that
request a newer compiler. Stop selecting gcc6, it receives very
limited testing due to NetBSD 9 having gcc7, and probably doesn't
work due to some newer hardening checks stopping it from building.
2022-05-21 09:04:50 +00:00
adam
d5218f014a Make pkglint happy 2022-04-07 12:12:02 +00:00
nia
ca60b0b578 gcc.mk: gcc8 and gcc9 from pkgsrc do not build on 32-bit netbsd arm
workaround PR pkg/56679
2022-04-07 07:08:34 +00:00
riastradh
a1abd9761c mk: Cross-eyed hacks to support cross-libtool.
For a long time, when cross-building, say from native=amd64 to
target=powerpc, it was necessary to:

1. cross-build a _powerpc_ package called cross-libtool-base-powerpc,
   and then

2. install the powerpc package _natively_ with `pkg_add -m x86_64' to
   override the architecture check that normally forbids this kind of
   shenanigans,

in order to cross-build anything that uses libtool as a tool.

This is partly because libtool doesn't follow the normal GNU
convention of `./configure --build=<native platform> --host=<platform
package will run on> --target=<platform package is configured to
operate on>' -- in this example, build=amd64, host=amd64,
target=powerpc.

Instead, libtool expects to be cross-built itself, even if it's going
to run as a tool.  It's not as bonkers as it sounds at first: libtool
is just a shell script, and it caches various information about the
(cross-building!) toolchain it is built with so it can use that
information later when it is run as a tool itself to cross-compile
other software.

To make this work, we need to create the toolchain wrappers for
libtool _as if_ we were cross-building even if we are building a
native package.  So mk/tools uses a new flag TOOLS_USE_CROSS_COMPILE
instead of USE_CROSS_COMPILE, and libtool internally sets
MACHINE_ARCH=${TARGET_ARCH} (in the example above, powerpc) to make
it look like we're cross-building.  The new TOOLS_CROSS_DESTDIR is an
alias for the (defaulted) CROSS_DESTDIR, which must now be set
unconditionally in mk.conf in order for libtool to know where the
cross-destdir will be; _CROSS_DESTDIR remains empty when building any
native packages (including the native cross-libtool package).

Finally, we need to make the resulting package be a native package,
with MACHINE_ARCH set to the one that it will be installed on (in the
example above, amd64), so I added an indirection _BUILD_DEFS.${var}
to replace var on its own in the build definitions that get baked
into the package, shown by `pkg_info -B'.  Setting
_BUILD_DEFS.MACHINE_ARCH=${NATIVE_MACHINE_ARCH} ensures that this
mutant hybrid cross-built libtool still produces a native package.

All of this logic is gated on setting USE_CROSS_COMPILE in mk.conf or
LIBTOOL_CROSS_COMPILE in the package makefile, so it should be safe
for non-cross-builds -- when USE_CROSS_COMPILE=no and you're not
building cross-libtool, everything is as before.
2022-04-04 11:23:06 +00:00
nia
711c75b795 mk: MKPIE is not GCC-specific. Should help ObjC packages. 2022-03-13 06:26:57 +00:00
pho
7606a33d85 Add a package-settable variable PKGSRC_OVERRIDE_MKPIE
This is needed by packages that require hand-holding in building PIE. Also a
post-build check for MKPIE is performed by default when PKG_DEVELOPER=YES.
2022-01-18 01:41:09 +00:00
nia
552986130e mk: Set the default page size when compiling with RELRO with GCC on
NetBSD/mips.

PR pkg/56559
2021-12-22 10:14:27 +00:00
nia
05b92186b2 mk/compiler: Return the cwrappers stuff for RELRO now that it doesn't
cause any noticable breakage.
2021-12-19 11:55:29 +00:00
nia
bf115b5cf8 mk: revert RELRO default and cease use of wrappers until some more
substantial changes to infrastructure and testing can be performed
to ensure it's applied universally without breaking anything
2021-11-07 11:25:33 +00:00
nia
0c613150f5 mk: Correct the wrappers invocation for RELRO. This should help many
remaining packages that fail to build with RELRO that were uncaught
by my original bulk builds due to CHECK_RELRO failing to work (sorry...)
2021-11-06 10:03:32 +00:00
nia
856ace64f4 mk: Make it possible for a package to fall back to partial RELRO.
This helps certain X.Org modules.
2021-11-02 08:14:58 +00:00
nia
273cbdb7aa gcc.mk: Avoid matching gcc2, gcc3. 2021-10-08 16:35:57 +00:00
nia
61d44b4928 mk: omit space between -z and relro
prevents mangling by wrappers in mysterious circumstances
2021-10-04 14:21:21 +00:00
nia
89f6b4a1b4 Prune gcc34, gcc44. 2021-10-01 11:56:12 +00:00
nia
d91d5b09b5 gcc.mk: Add support for MKPIE when compiling Fortran code.
PR pkg/56337
2021-08-03 07:19:20 +00:00
nia
679402db69 gcc.mk: Remove bogus test for NetBSD. 2021-08-01 12:35:06 +00:00
nia
9876104df1 mk: Remove lingering gcc5 reference 2021-04-06 12:07:57 +00:00
nia
5cae70c75a mk: Remove gcc44 bits 2021-04-02 17:04:17 +00:00
nia
54b7655c2e mk: use gcc6-aux for ada 2021-04-02 16:54:48 +00:00
nia
51a9ce2ba7 mk: Remove references to gcc48/gcc49, as done elsewhere here 2021-04-02 11:48:16 +00:00
gdt
4f45f1c3c4 mk/compiler/gcc.mk: Remove stray mid-line \
(Apparently left over from reducing the vast number of gcc versions.)
2021-02-04 21:45:13 +00:00
maya
23ad232dfc g/c gcc48, gcc49, gcc5 logic 2021-01-17 16:05:48 +00:00
maya
9c62045f83 If the base GCC isn't enough, and GCC_REQD=4.5 to 6, use gcc6.
gcc4.8,4.9,5 have bugs preventing them from being useful within pkgsrc
for the primary use case that finds them handy:
glibc + FORTIFY + those GCC versions = build failures.

Additionally, requiring fewer versions of GCC is an improvement for
the vast majority of use-cases considered.

We might want to bump this further than gcc6 later on, but this is a
big improvement for CentOS builds.
2021-01-17 15:32:00 +00:00
wiz
6ea199b786 mk: fix a duplicate GCC9 variable to refer to GCC10 instead
Noted by Jackson Bryn in PR 55842.
2020-12-05 09:24:00 +00:00
wiz
8bb51a1d49 mk: expand _USE_GCC_SHLIB section to gcc9/gcc10 2020-10-28 13:19:25 +00:00
rillig
c44518e90f mk: fix undefined variables for current make running in -dL mode
In lint mode, NetBSD's make is stricter about undefined variables.  In
conditions, the function arguments must be fully defined.
2020-10-06 17:36:50 +00:00
ryoon
e00f3c4739 mk/compiler: Support GCC_REQD=9 or 10
A pert of PR pkg/55637.
2020-09-02 16:16:43 +00:00
rillig
c42fb662dc mk/compiler.mk: check for too late GCC_REQD and USE_LANGUAGES
For USE_LANGUAGES there is already a pkglint warning, but for GCC_REQD it
is missing.  It's better to have this check directly in the
infrastructure since it is more reliable.

This check is disabled by default, to not cause any new breakage.
It should be enabled in bulk builds.
2020-06-02 06:58:13 +00:00
sjmulder
a376838f3a mk/compiler: Set -fcommon for GCC 10
As with clang. Default got flipped with v10.
2020-05-31 00:00:13 +00:00
sjmulder
9014f3f496 mk/compiler: Fix version check for GCC 10
Caused SSP flags to be omitted in GCC 10. Check flipped because all new
GCC versions can be expected to support it.
2020-05-30 22:45:36 +00:00
nia
73411e4b5f mk/compiler: Make gfortran the default fortran compiler.
Discussed on tech-pkg@ before freeze.
2020-03-30 09:39:24 +00:00
nia
f4ab3d48e8 mk: default to gfortran on aarch64, there's no g95 for aarch64 2020-03-14 10:00:37 +00:00
rillig
1604275256 mk/compiler/gcc.mk: reorder variables in _VARGROUPS section
By listing the public variables first, the focus is put on the most
important variables.
2019-09-19 06:46:59 +00:00
rillig
95fe8ca6c6 mk/compiler/gcc.mk: add missing variables to _VARGROUPS section 2019-09-18 06:46:13 +00:00
rillig
fe8d2392e3 mk/compiler/gcc.mk: search for GCCBASE/bin/gcc as well
A default installation of GCC doesn't install bin/cc but only bin/gcc.
Adding bin/cc is only done by the pgksrc packages, not by the upstream
package.

The previous strategy of just checking whether ${GCCBASE}/bin/${CC:[1]}
exists did not work in such a situation. Therefore, if CC still has its
default value from sys.mk, that is changed to the intended gcc, which
then detects the base GCC properly.

See https://mail-index.netbsd.org/pkgsrc-users/2019/09/07/msg029329.html.
See https://mail-index.netbsd.org/tech-pkg/2019/09/18/msg021976.html.
2019-09-18 06:35:12 +00:00
rillig
d7f638ee99 mk/compiler: replace complicated :M_asdf_ modifier with :[1]
The :[1] modifier has been added to bmake in 2006.
2019-09-18 06:15:13 +00:00
rillig
e8b4d71240 mk/compiler/gcc.mk: refactoring for PKGPATH comparison
Since PKGPATH can only ever consist of a single path, there is no point
in applying the :M modifier to it.
2019-09-08 09:24:52 +00:00
rillig
a504a7a55a mk/compiler/gcc.mk: improve _VARGROUPS section 2019-09-07 22:20:32 +00:00
rillig
22bac2bbe2 mk/compiler/gcc.mk: update _VARGROUPS 2019-09-07 07:10:15 +00:00
ryoon
a73d906dd6 Do not pass -std=c++03 to GCC 4.4
No objection on tech-pkg@.
2019-07-15 16:06:19 +00:00
riastradh
14df6bc748 aarch64 has no compiler flag for ABI=64. 2019-07-09 15:46:02 +00:00
riastradh
2f9efeb223 Avoid passing _CC as cross-compiler to recursive makes.
This way we don't inadvertently tell a native dependency that it is
supposed to be compiled with the cross-compiler.

No functional change intended for USE_CROSS_COMPILE=no.
2019-07-09 15:45:46 +00:00
jperkin
71e098497c mk: Add CTF infrastructure support.
Platform support is determined by _OPSYS_SUPPORTS_CTF from mk/platform, the
user enables support by setting PKGSRC_USE_CTF=yes, and packages can
explicitly disable support with CTF_SUPPORTED=no or skip certain files with
CTF_FILES_SKIP.

The path to ctfconvert is configured via TOOLS_PLATFORM.ctfconvert.

If all of the requisite variables are enabled, a compiler-specific debug flag
is passed via the wrappers to ensure we have DWARF information to convert,
_INSTALL_UNSTRIPPED is explicitly defined to avoid binaries being stripped
prior to conversion, and the conversion is performed during the install stage.

It is recommended that users who enable the feature also set STRIP_DEBUG=yes
to reduce the final binary size once the conversion has been performed.

This has been used for the past year in Joyent SmartOS builds.  FreeBSD is
marked as supported but is untested.
2018-11-12 14:22:58 +00:00
abs
c025aae024 Don't rely on gcc version fallthrough for GCC_REQD+=8
(Thanks to eagle eyes from leot@)
2018-10-29 11:53:18 +00:00