Commit graph

390 commits

Author SHA1 Message Date
bsiegert
25d59f2644 Add /usr/local for include and libdir on ChromeOS.
Third-party (i.e. non-pkgsrc) C toolchains (I am using chromebrew)
install to /usr/local, as that is where you can have write access.
With this, a bootstrap on ChromeOS finishes successfully.
2017-11-21 19:16:47 +00:00
khorben
42bd86cfb0 Add initial support for building packages reproducibly
It currently tackles two problems:
- gcc(1) hard-coding full paths in debugging information (with one
  caveat at the moment)
- ar(1) hard-coding user IDs in archive headers

This allows packages built from the same tree and options to produce
identical results bit by bit. This option should be combined with ASLR
and PKGSRC_MKPIE to avoid predictable address offsets for attackers
attempting to exploit security vulnerabilities.

This is still disabled by default, and only supports NetBSD so far.

As discussed on tech-pkg@
2017-11-12 13:34:14 +00:00
khorben
7b8b0022a0 Typo 2017-11-01 15:29:09 +00:00
jperkin
5e65a78af3 mk/platform: Remove unsupported Darwin/SunOS linker arguments. 2017-10-10 13:57:23 +00:00
jperkin
45f7f890ca mk: Disable SSP checks on systems where it is provided in libc.
The currently implementation of SSP checks simply look for a DT_NEEDED
dependency on libssp, and doesn't yet have a way to check for it being
enabled when it is done via libc.
2017-10-03 13:18:00 +00:00
maya
4ad12bcd40 Remove hack working around NetBSD 1.5's specfiles. 2017-08-07 23:54:09 +00:00
maya
88067d2bf4 Disable fortify on netbsd<6.
This appears to be causing issues with pkgsrc GCC attempting to insert
builtins it does not have, because we don't build libssp. unbreaks icu build.

there may be more problems from this issue in the future, but netbsd-7 is
better tested now.
2017-08-07 23:44:53 +00:00
jperkin
b3c00861dc Disable fortify on Linux when optimisation is not enabled, it is not
supported in that configuration and warnings are issued from the system
headers.
2017-08-04 08:59:20 +00:00
maya
7ddbd3b915 Don't bother with a version check for alpha cflags 2017-07-24 08:19:08 +00:00
schmonz
a6335c2ab0 Define PKG_HAVE_KQUEUE where available. 2017-07-09 17:03:12 +00:00
khorben
e519f07826 Register support for PKGSRC_USE_STACK_CHECK
This adds -fstack-check to the CFLAGS (with GCC on NetBSD x86). Only
tested on NetBSD/amd64 so far.

Disabled by default.
2017-07-09 14:30:07 +00:00
khorben
ca2b8ac385 Implement a check for RELRO
This is only performed if PKG_DEVELOPER and RELRO are in use.

After a suggestion during my talk at BSDCan 2017; thanks!
Also, submitted on tech-pkg@ for review mid-June.

As a next step, it seems this can be extended to libraries, just like the
check for SHLIBS does (from which this is inspired).
2017-07-04 18:29:24 +00:00
jperkin
24df526b4c Set LIBABISUFFIX correctly on SunOS/sparc64. Tested by Jörn Clausen as
part of PR#52250.
2017-06-21 08:20:10 +00:00
khorben
0a3bb24acf Register support for RELRO on Linux (limited to x86 first)
Tested on Debian GNU/Linux 8.8 (amd64).

Actual support will depend on the underlying distribution though.
2017-06-09 17:21:53 +00:00
khorben
7f05f4f5e5 Register support for SSP on Linux (limited to x86 first)
Tested on Debian GNU/Linux 8.8 (amd64).

Actual support will depend on the underlying distribution though.
2017-06-09 17:04:18 +00:00
khorben
369b9cea32 Register support for FORTIFY on Linux
Tested on Debian GNU/Linux 8.8 (amd64).

Actual support will depend on the underlying distribution though.
2017-06-09 16:56:26 +00:00
jlam
b110ad9dac Move detection of shared library type into the platform file.
Only four platforms, all BSDs, need to resolve "ELF/a.out" into
either ELF or a.out.  Calculate it directly in the platform file
and return the value in ${_OPSYS_SHLIB_TYPE} and export that value
in bsd.prefs.mk as ${SHLIB_TYPE}.

Instead of requiring the file(1) tool, we can expect the base
system of those BSDs to have /usr/bin/file, so make use of it
directly.
2017-05-31 22:55:01 +00:00
khorben
8b017f6b3a Register support for SSP on FreeBSD and clang (on x86 architectures)
Support for SSP (Stack-Smashing Protection) is optional so this should not
affect default builds.

Tested on FreeBSD/amd64 (10.3-RELEASE-p11)
2017-05-18 01:29:55 +00:00
jperkin
3b718bfe38 Default to pkgsrc terminfo. The curses default was switched to pkgsrc a
while ago, but since then any packages that included both curses and
terminfo ended up with conflicting BUILDLINK_TRANSFORM entries, leaving it
to include ordering to determine whether the builtin or pkgsrc curses was
used.  This keeps them in sync, at least by default, though ideally we'd
ensure that at an infrastructure level.
2017-05-08 17:34:15 +00:00
jperkin
e4d1b9920a Mark SunOS as _INCOMPAT_CURSES, there are lots of issues with the recent work
to use the curses framework and this is the simplest solution for now.
2017-03-08 15:26:51 +00:00
sevan
8907fb92ff MACHINE_ARCH is set to powerpc64le during bootstrap, adjust if statement to
check for new value.
2017-02-01 10:00:17 +00:00
jperkin
dc1d0f1622 Indent conditionals to improve legibility. No functional change. 2017-02-01 07:25:28 +00:00
sevan
bb04ef7a57 Add ppc64le paths from the Debian/Ubuntu multiarch hierarchy.
Tested on Ubuntu for POWER8.
Thanks to John Klos.
2017-02-01 03:00:35 +00:00
wiz
da976fdeef Bump LIBTOOL_REQD, newer version needed for cwrappers.
PR 51826.
2017-01-17 22:57:39 +00:00
jperkin
24bfb99d67 Cache and use computed variables. 2017-01-17 15:32:17 +00:00
bsiegert
7260ae5a46 Enable cwrappers for Dragonfly and FreeBSD. Remove Linux emulation (gone)
for Dragonfly.

From David Shao in PR pkg/51688.
2016-12-04 15:37:41 +00:00
jdolecek
fbce554b02 fix the test for <poll.h>/<sys/poll.h> - use _OPSYS_INCLUDE_DIRS instead
of assuming /usr/include; this fixes compilation of net/socat,
which has broken !HAVE_POLL code
2016-11-13 11:06:40 +00:00
jperkin
ea3df7bb6a Enable cwrappers by default on OpenBSD. 2016-10-28 09:21:08 +00:00
wiz
1ce724e294 Enable cwrappers by default on NetBSD. 2016-10-27 12:29:17 +00:00
jperkin
b673fabd21 Add support for enabling cwrappers automatically. USE_CWRAPPERS now defaults
to "auto", which will enable cwrappers if the _OPSYS_SUPPORTS_CWRAPPERS
platform variable is set to "yes".

Switch over to cwrappers by default for Darwin, Linux, and SunOS (except when
using the sunpro compiler).
2016-10-27 10:31:05 +00:00
marino
0f0623489a DragonFly: Update _OPSYS_SYSTEM_RPATH
It's going on 10 years since gcc 3.4 and gcc 4.1 were part of DragonFly.
DF Release 4.4 is the earliest with any kind of support and the earliest
possible GCC version is 4.7 there.
2016-10-25 20:00:47 +00:00
richard
c27c54fb31 set LIBABISUFFIX to /aarch64-linux-gnu for arm64
simplifies _OPSYS_SYSTEM_RPATH and _OPSYS_LIB_DIRS
permitting lots of stuff using LIBABISUFFIX to work now.

TODO: probably similar for the armv7 platforms as
the pattern '${MACHINE_ARCH}-${LOWER_OPSYS}-gnu${APPEND_ABI}'
seems like it should work for both.
2016-09-17 05:41:37 +00:00
jperkin
726fbdb877 Support UNLIMIT_RESOURCES=cputime on Darwin. 2016-09-06 09:50:20 +00:00
jperkin
ed6c0a593f Support UNLIMIT_RESOURCES=cputime on SunOS. 2016-08-25 12:08:29 +00:00
richard
334542855d Add experimental aarch64 support (amlogic s905 under ubuntu) 2016-08-24 05:31:20 +00:00
sevan
62a7145565 Opt to prefer OpenSSL from pkgsrc rather than a builtin version for all versions rather than just 10.7 or newer.
There is no good reason to opt for the builtin on the legacy release prior as they're unmaintained.
2016-07-08 21:23:57 +00:00
sevan
bc046352ab DragonFly BSD ships with GCC 5.x as the compiler, add its library location to _OPSYS_SYSTEM_RPATH 2016-06-29 13:37:19 +00:00
jperkin
3c2941b993 Since the MACHINE_ARCH cleanup, the bootstrap for i386-on-x86_64 Linux has
been broken due to NATIVE_MACHINE_ARCH no longer being set to x86_64.  Fix
this by introducing HOST_MACHINE_ARCH which refers to the underlying host
architecture rather than bmake's native architecture, thus differentiating
between cross-compiling and multilib.

This is currently only set on Linux as the only OPSYS which currently
requires such a test, but can be expanded to other OPSYS as necessary.
2016-03-17 16:02:23 +00:00
khorben
03a56367ef Re-arrange support for FORTIFY/MKPIE/RELRO/SSP
- No _GCC_* anything in mk/bsd.prefs.mk;
- No compiler flags in platform files.

Tested again on NetBSD/amd64, with and without cwrappers, with the same
outcome.

With feedback from jperkin@
2016-03-11 23:54:08 +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
fhajny
124d88ee1d Strip --enable-new-dtags GNU ld arg on Darwin and SunOS. 2016-03-11 22:04:34 +00:00
jperkin
111893bb36 Remove _OPSYS_WHOLE_ARCHIVE_FLAG and _OPSYS_NO_WHOLE_ARCHIVE_FLAG, these
variables are unused and in at least one case were completely wrong anyway.
2016-03-10 16:58:19 +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
jperkin
b4e6a0bbf3 Remove a commonly used set of GNU ld arguments which are incompatible
with the Darwin linker.  Fixes various packages.
2016-02-29 10:05:47 +00:00
jperkin
43cbbd8b78 Default to the system libuuid. The system headers assume that the libuuid
header provides the uuid_string_t typedef, which is not the case with the
version coming from pkgsrc.
2016-02-24 14:59:56 +00:00
jperkin
22af365a50 Export OSX_VERSION (renamed from OSX_VERS) to the environment regardless of
whether we're using the SDK path or /usr/include, as it is useful for other
contexts than simply determining the SDK directory.
2016-02-22 19:57:41 +00:00
jperkin
698717d710 Extend the El Capitan HFS+ bug workaround to 15.1.0 but no further, I can
confirm that Apple fixed the bug in the recent 15.2.0 (10.11.2) update.
2015-12-14 14:14:33 +00:00
sevan
168d1b7354 Define MACOSX_DEPLOYMENT_TARGET for Tiger to allow current releases
of software such as Ruby to build on Tiger/PowerPC.
Tested with & without on a G4 with Tiger & Leopard.
It was not needed on Leopard as the linker defaults to a target of 10.5 &
setting it back broke the bootstrap process.

Reviewed by wiz@ long ago.
2015-12-13 22:38:00 +00:00
jperkin
42f3575ed2 Ensure building 32-bit on 64-bit is supported when using cwrappers too. 2015-11-18 22:30:12 +00:00
jperkin
6e420f7378 Always set _OPSYS_CAN_CHECK_SHLIBS to "yes" regardless of whether
TOOLS_PATH.readelf is set.  This is a PKG_DEVELOPER feature and it's
likely the developer is smart enough to either have it already available
in $PATH or be able to install it (e.g. via devel/binutils) if required.
2015-11-16 15:59:59 +00:00