Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1commit 637b7ce639d54e617170433aa9596176b167d085 2Author: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> 3Date: Thu Mar 18 01:07:49 2021 +0100 4 5 Allow building without ocamlfind and opam 6 7 This change is the result of my first go at packaging ocaml-freestanding 8 for NixOS. Our build infrastructure for ocaml there is completely 9 independent of opam at the moment, so depending on opam for the build 10 time is not an option, especially in this case where the information it 11 would give us would be garbage. 12 13 Fortunately the build environment plays nicely with pkg-config which is 14 already heavily used by ocaml-freestanding. This patch leaves pkg-config 15 to its own devices if opam is not present (it can be assisted by a 16 manually set PKG_CONFIG_PATH environment variable). 17 18 Additionally, in configure.sh we check if the target ocaml source 19 directory already exists. This allows for building ocaml-freestanding 20 without the ocaml-src package (which would be unnecessarily cumbersome 21 to package for NixOS) and ocamlfind (one less dependency is always a 22 nice bonus). The Makefile needs no fix since the target ocaml/Makefile 23 won't be built if it's already present. 24 25diff --git a/configure.sh b/configure.sh 26index 4d154ed..c254f7b 100755 27--- a/configure.sh 28+++ b/configure.sh 29@@ -1,6 +1,8 @@ 30 #!/bin/sh 31 32-export PKG_CONFIG_PATH=$(opam config var prefix)/lib/pkgconfig 33+if command -v opam &> /dev/null; then 34+ export PKG_CONFIG_PATH=$(opam config var prefix)/lib/pkgconfig 35+fi 36 pkg_exists() { 37 pkg-config --exists "$@" 38 } 39@@ -21,7 +23,7 @@ if [ -z "${PKG_CONFIG_DEPS}" ]; then 40 echo "ERROR: solo5-bindings-hvt, solo5-bindings-spt, solo5-bindings-virtio, solo5-bindings-muen, solo5-bindings-genode or solo5-bindings-xen must be installed." 1>&2 41 exit 1 42 fi 43-ocamlfind query ocaml-src >/dev/null || exit 1 44+[ -e "$(dirname "$0")/ocaml" ] || ocamlfind query ocaml-src >/dev/null || exit 1 45 46 FREESTANDING_CFLAGS="$(pkg-config --cflags ${PKG_CONFIG_DEPS})" 47 BUILD_ARCH="$(uname -m)"