Commit graph

402 commits

Author SHA1 Message Date
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
jperkin
0b3d39a899 mk: Fix malformed conditional.
There's no guarantee that POSSIBLE_GFORTRAN_VERSION is a numeric value,
so cannot be compared as such.  For example on my macOS it is set to
"clang-12 (clang-1205.0.22.9)".

This really needs to be normalised correctly at some point.
2022-04-04 15:38:47 +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
d98deba6c1 gfortran: Correct notion of check. All pkgsrc gccs before version 10 are
broken on 32-bit arm.
2022-04-02 08:01:48 +00:00
nia
c7c1c82592 gfortran.mk: Use gcc version 10 on all arm-type netbsds. 2022-04-02 07:57:11 +00:00
nia
711c75b795 mk: MKPIE is not GCC-specific. Should help ObjC packages. 2022-03-13 06:26:57 +00:00
wiz
9265e3fae1 compiler/clang.mk: do not disable PIE support
joerg says clang has the same interface for this like gcc
2022-01-30 13:07:34 +00:00
pho
af87f2f6ac Emit a warning when PKGSRC_MKPIE==yes but PKGSRC_COMPILER==clang
Prior to this change PKGSRC_MKPIE was silently ignored when clang was chosen for
the compiler, i.e. executables were never built as PIE. This became an error
after introducing a post-build check for it.

Of course we should add a MKPIE support for clang, but for now we just emit a
warning. Otherwise we cannot build packages such as devel/gnustep-base which
requires clang to build.
2022-01-19 16:06:43 +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
jperkin
a8263cd3d6 mk: Use OPSYS_VERSION where appropriate.
Should improve readability and in some cases avoid potential failure due to
string comparisons being used.  No other functional change intended.
2021-11-29 16:14:23 +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
c4a7045c5c clang.mk: add support for PKGSRC_USE_SSP=strong 2021-08-03 07:28:15 +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
mrg
0a843265c7 various fixes for arm64 big endian support.
most of these simply extend matching from "aarch64" to "aarch64eb"
in various forms of code.  most remaining uses in pkgsrc of
"MACHINE_ARCH == aarch64" are because of missing aarch64eb support,
such as most of the binary-bootstrap requiring languages like rust,
go, and java.

no pkg-bump because this shouldn't change packages on systems that
could already build all of these.
2021-04-25 07:51:24 +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
tnn
2f1875f990 mk/compiler/gfortran.mk: bump default from gcc9 to gcc10 on current aarch64
lang/gcc8 has patches for NetBSD/aarch64 and lang/gcc10 has support mostly
upstreamed. Nobody seems interested in fixing gcc9, but the pkgsrc
logic defaults to it when the system compiler is GCC 9 which leads to
broken fortran packages. Let's just skip forward to gcc10.
2020-10-20 19:35:07 +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
schmonz
36b0b26e17 Xcode 12 (or its associated Command Line Tools) ships with default-on
-Werror=implicit-function-declaration, which will be great someday when
we're ready for it. Until then, on macOS, detect this situation and tell
the cc wrapper to prepend -Wno-error=implicit-function-declaration.

Taking mail/qmail as our example, this fixes the build on Catalina
with "Apple clang version 12.0.0 (clang-1200.0.32.2)". Adding
-Werror=implicit-function-declaration to CPPFLAGS or CFLAGS (in
mk.conf or on the command line) re-fails the build, as expected, with
a pile of "error: implicit declaration of function". Also as expected,
a full -Werror fails earlier on one of the many other problems with
qmail's code.

For clang on non-macOS platforms, no change.

clang-and-wrapper-ok: joerg@
during-the-freeze-ok: gdt@
2020-09-21 13:09:21 +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
joerg
7134516a02 Adjust last to really prepend in the case of cwrappers. 2020-04-17 13:36:26 +00:00
joerg
76dab5b3cc clang 10 defaults to -fno-common with significant fallout in pkgsrc.
Override that by prepending -fcommon.
2020-04-17 13:35: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
gdt
555a3776ae mk/compiler/gfortran.mk: Add comment about gcc 4.8 handling
The code maps gcc-4.8.x to "4", and then won't find gcc4.  This is a
bug, but it may be that it's just as well to never match 4.X of any
kind, and use 7 anyway.   Explain this issue with a \todo to fix the
bug or document the consequences as intended.

(This is a comment-only change.)
2020-03-26 12:44:46 +00:00
gdt
19ce42d824 mk/compiler/gfortran.mk: Fix bugs in version selection
Adjust regexp that removes .Y.Z from gcc-X.Y.Z.

Test for gcc being contained in PKGSRC_COMPILER, vs ==, so that a
value of "ccache gcc" is handled properly.

(ok for mk during freeze jperkin@)
2020-03-26 12:42:02 +00:00
nia
f4ab3d48e8 mk: default to gfortran on aarch64, there's no g95 for aarch64 2020-03-14 10:00:37 +00:00
maya
400c25c7eb Match indentation. 2020-03-07 15:19:20 +00:00
maya
ea06e5b0d2 Test that the lang/gccN exists before defaulting to N as the gfortran version.
Issue most immediately obvious when trying GCC 9, but probably applies to
some other versions as well.
2020-03-07 15:18:19 +00:00
bacon
fe59885718 mk/compiler/gfortran: Default to same major version as base GCC
GFORTRAN_VERSION should match CC_VERSION as closely as possible for
ABI compatibility.  This update tries to match GFORTRAN_VERSION
to CC_VERSION if the base compiler is GCC.  If base compiler is not
GCC, default to a mainstream version likely to work with base clang/llvm.
2020-02-26 15:58:20 +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