From af58c2cc0c9ebaf5e3c3efced11935f8ca70e6bb Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 1 Sep 2021 21:38:38 +0000 Subject: netbsd.compat: Don't configure twice --- .../bsd/netbsd/compat-cxx-safe-header.patch | 18 ++++++++++++++++++ .../bsd/netbsd/compat-dont-configure-twice.patch | 22 ++++++++++++++++++++++ pkgs/os-specific/bsd/netbsd/compat.patch | 18 ------------------ pkgs/os-specific/bsd/netbsd/default.nix | 14 +++++++++++++- 4 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch create mode 100644 pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch delete mode 100644 pkgs/os-specific/bsd/netbsd/compat.patch (limited to 'pkgs/os-specific/bsd') diff --git a/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch b/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch new file mode 100644 index 000000000000..f67ca2e50791 --- /dev/null +++ b/pkgs/os-specific/bsd/netbsd/compat-cxx-safe-header.patch @@ -0,0 +1,18 @@ +diff -u -r1.35.2.1 nbtool_config.h.in +--- a/nbtool_config.h.in 22 Apr 2015 07:18:58 -0000 1.35.2.1 ++++ b/nbtool_config.h.in 31 May 2018 01:46:53 -0000 +@@ -680,5 +680,14 @@ + /* Define if you have u_int8_t, but not uint8_t. */ + #undef uint8_t + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + #include "compat_defs.h" ++ ++#ifdef __cplusplus ++} ++#endif ++ + #endif /* !__NETBSD_NBTOOL_CONFIG_H__ */ diff --git a/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch b/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch new file mode 100644 index 000000000000..1a69e73e255f --- /dev/null +++ b/pkgs/os-specific/bsd/netbsd/compat-dont-configure-twice.patch @@ -0,0 +1,22 @@ +commit f2d0ff85e05b49e9d11735ce4810b242c1dbf5af +Author: John Ericson +Date: Wed Sep 1 15:38:56 2021 +0000 + + Make should not hit configure + +diff --git a/Makefile b/Makefile +index b5adb8a5f2e9..1a914ef16739 100644 +--- a/Makefile ++++ b/Makefile +@@ -76,11 +76,6 @@ _CURDIR:= ${.CURDIR} + + SRCS:= ${SRCS:M*.c} + +-config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in +- rm -f ${.TARGET} +- CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \ +- ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache +- + defs.mk: config.cache + @touch ${.TARGET} + diff --git a/pkgs/os-specific/bsd/netbsd/compat.patch b/pkgs/os-specific/bsd/netbsd/compat.patch deleted file mode 100644 index f67ca2e50791..000000000000 --- a/pkgs/os-specific/bsd/netbsd/compat.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -u -r1.35.2.1 nbtool_config.h.in ---- a/nbtool_config.h.in 22 Apr 2015 07:18:58 -0000 1.35.2.1 -+++ b/nbtool_config.h.in 31 May 2018 01:46:53 -0000 -@@ -680,5 +680,14 @@ - /* Define if you have u_int8_t, but not uint8_t. */ - #undef uint8_t - -+#ifdef __cplusplus -+extern "C" { -+#endif -+ - #include "compat_defs.h" -+ -+#ifdef __cplusplus -+} -+#endif -+ - #endif /* !__NETBSD_NBTOOL_CONFIG_H__ */ diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index b903bc461560..0e6526c18340 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -166,6 +166,15 @@ in lib.makeScopeWithSplicing ./compat-setup-hook.sh ]; + preConfigure = '' + make include/.stamp configure nbtool_config.h.in defs.mk.in + ''; + + configurePlatforms = [ "build" "host" ]; + configureFlags = [ + "--cache-file=config.cache" + ]; + # the build system re-runs `./configure` with `HOST_CC` (which is their # name for Build CC) as a compiler to make `defs.mk`, which is installed depsBuildBuild = [ buildPackages.stdenv.cc ] ++ commonDeps; @@ -187,7 +196,10 @@ in lib.makeScopeWithSplicing ]; RENAME = "-D"; - patches = [ ./compat.patch ]; + patches = [ + ./compat-cxx-safe-header.patch + ./compat-dont-configure-twice.patch + ]; postInstall = '' mv $out/include/compat/* $out/include -- cgit 1.4.1