I'm having trouble compiling crypto-related libraries on MacOSX and OpenBSD, 
since it requires:

CFLAGS="-I/usr/local/include" LDFLAGS="-I/usr/local/lib"

to be passed in the environment.  Our "conf-gmp" package currently just does a 
"cc -c gmp.c" which is very unlikely to work portably.

I was trying to modify the package description to use CFLAGS passed in 
externally to the `opam` command-line, and this diff works:

diff --git a/packages/conf-gmp/conf-gmp.1/opam 
b/packages/conf-gmp/conf-gmp.1/opam
index d0f0065..8b45586 100644
--- a/packages/conf-gmp/conf-gmp.1/opam
+++ b/packages/conf-gmp/conf-gmp.1/opam
@@ -2,7 +2,7 @@ opam-version: "1"
 maintainer: "nbraud"
 homepage: "http://gmplib.org/";
 license: "GPL"
-build: [["cc" "-c" "test.c"]]
+build: [["sh" "-c" "cc -c $CFLAGS test.c"]]
 depexts: [
   [["debian"] ["libgmp-dev"]]
   [["ubuntu"] ["libgmp-dev"]]

However, is there a better way to pass through environment variables to OPAM 
packages?  An %{env:CFLAGS}% macro would be cleaner than forcing evaluation 
through a subshell as my diff above does.

-anil
_______________________________________________
opam-devel mailing list
[email protected]
http://lists.ocaml.org/listinfo/opam-devel

Reply via email to