summaryrefslogtreecommitdiffstats
path: root/pkgs/os-specific/bsd
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-05-31 12:13:35 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2018-05-31 12:36:44 -0400
commitfd874b74560d5811660b492c38f0a690468d6bef (patch)
tree914cd3246ea2031bcb0869e23d3b5fb6d43a8c68 /pkgs/os-specific/bsd
parent050557ef8ac21f0458f23a902f0f0229069e937b (diff)
netbsd: allow replacing nbcompat with libbsd
Diffstat (limited to 'pkgs/os-specific/bsd')
-rw-r--r--pkgs/os-specific/bsd/netbsd/compat.patch18
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix9
-rw-r--r--pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc11
3 files changed, 37 insertions, 1 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/compat.patch b/pkgs/os-specific/bsd/netbsd/compat.patch
new file mode 100644
index 000000000000..f67ca2e50791
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/compat.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/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index 84d6926c50c7..eb305d5b3db7 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -162,7 +162,7 @@ let
extraPaths = [ make.src ] ++ make.extraPaths;
};
- compat = netBSDDerivation {
+ compat = netBSDDerivation rec {
path = "tools/compat";
sha256 = "17phkfafybxwhzng44k5bhmag6i55br53ky1nwcmw583kg2fa86z";
version = "7.1.2";
@@ -182,6 +182,8 @@ let
installFlags = [];
RENAME = "-D";
+ patches = [ ./compat.patch ];
+
postInstall = ''
mv $out/include/compat/* $out/include
rmdir $out/include/compat
@@ -204,6 +206,11 @@ let
install -D $NETBSDSRCDIR/include/utmpx.h $out/include/utmpx.h
install -D $NETBSDSRCDIR/include/tzfile.h $out/include/tzfile.h
+ mkdir -p $out/lib/pkgconfig
+ substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \
+ --subst-var-by out $out \
+ --subst-var-by version ${version}
+
# Remove lingering /usr references
if [ -d $out/usr ]; then
cd $out/usr
diff --git a/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc b/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc
new file mode 100644
index 000000000000..3aadabe50882
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/libbsd-overlay.pc
@@ -0,0 +1,11 @@
+prefix=@out@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: nbcompat
+Description: NetBSD compatibility framework
+Version: @version@
+URL: https://www.netbsd.org/
+Libs: -L${libdir} -lnbcompat
+Cflags: -I${includedir} -DHAVE_NBTOOL_CONFIG_H -include nbtool_config.h