about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-26T15·04+0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-26T15·04+0200
commit98a2adb1359ec35ac8da7a52754d2290531f8cef (patch)
treeac8d7d29f92f805126faf453ef3eb86c41f896af
parent6734c18c99f8fa33a50a3045a8dd915bbf084255 (diff)
Simplify building nix-perl in nix-shell
-rw-r--r--perl/Makefile2
-rw-r--r--perl/configure.ac2
-rw-r--r--perl/lib/Nix/Store.xs2
-rw-r--r--perl/local.mk6
-rw-r--r--shell.nix9
5 files changed, 15 insertions, 6 deletions
diff --git a/perl/Makefile b/perl/Makefile
index cf655ae3d656..684a37e8121f 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -1,6 +1,6 @@
 makefiles = local.mk
 
-GLOBAL_CXXFLAGS += -std=c++14 -g -Wall -include nix/config.h
+GLOBAL_CXXFLAGS += -std=c++14 -g -Wall
 
 -include Makefile.config
 
diff --git a/perl/configure.ac b/perl/configure.ac
index 7a6b28be23e8..80bcdb8ff5be 100644
--- a/perl/configure.ac
+++ b/perl/configure.ac
@@ -98,7 +98,7 @@ for name in $ac_subst_vars; do
 done
 
 rm -f Makefile.config
-ln -s ../mk mk
+ln -sfn ../mk mk
 
 AC_CONFIG_FILES([])
 AC_OUTPUT
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index 1920942a4c03..aa14bfa6270a 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
diff --git a/perl/local.mk b/perl/local.mk
index 35113bd960d2..b13d4c0d6396 100644
--- a/perl/local.mk
+++ b/perl/local.mk
@@ -20,11 +20,11 @@ Store_DIR := lib/Nix
 Store_SOURCES := $(Store_DIR)/Store.cc
 
 Store_CXXFLAGS = \
-  -I$(shell $(perl) -e 'use Config; print $$Config{archlibexp};')/CORE \
+  $(NIX_CFLAGS) \
+  -I$(shell perl -e 'use Config; print $$Config{archlibexp};')/CORE \
   -D_FILE_OFFSET_BITS=64 \
   -Wno-unknown-warning-option -Wno-unused-variable -Wno-literal-suffix \
-  -Wno-reserved-user-defined-literal -Wno-duplicate-decl-specifier -Wno-pointer-bool-conversion \
-  $(NIX_CFLAGS)
+  -Wno-reserved-user-defined-literal -Wno-duplicate-decl-specifier -Wno-pointer-bool-conversion
 
 Store_LDFLAGS := $(SODIUM_LIBS) $(NIX_LIBS)
 
diff --git a/shell.nix b/shell.nix
index 3c57826d1a1e..37a936fd2efb 100644
--- a/shell.nix
+++ b/shell.nix
@@ -17,6 +17,10 @@ with import <nixpkgs> {};
       })
       autoreconfHook
       readline
+
+      # For nix-perl
+      perl
+      perlPackages.DBDSQLite
     ];
 
   configureFlags =
@@ -30,6 +34,9 @@ with import <nixpkgs> {};
 
   shellHook =
     ''
-      configureFlags+=" --prefix=$(pwd)/inst"
+      export prefix=$(pwd)/inst
+      configureFlags+=" --prefix=prefix"
+      PKG_CONFIG_PATH=$prefix/lib/pkgconfig:$PKG_CONFIG_PATH
+      PATH=$prefix/bin:$PATH
     '';
 }