aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdev/build/windows/makecoq_mingw.sh20
-rwxr-xr-xdev/build/windows/patches_coq/pkg-config.c29
2 files changed, 41 insertions, 8 deletions
diff --git a/dev/build/windows/makecoq_mingw.sh b/dev/build/windows/makecoq_mingw.sh
index da6a8997a9..4c5bd29236 100755
--- a/dev/build/windows/makecoq_mingw.sh
+++ b/dev/build/windows/makecoq_mingw.sh
@@ -1002,6 +1002,16 @@ function make_ln {
fi
}
+##### ARCH-pkg-config replacement #####
+
+# cygwin replaced ARCH-pkg-config with a shell script, which doesn't work e.g. for dune on Windows.
+# This builds a binary replacement for the shell script and puts it into the bin_special folder.
+# There is no global installation since it is module specific what pkg-config is needed under what name.
+
+function make_arch_pkg_config {
+ gcc -DARCH="$TARGET_ARCH" -o bin_special/pkg-config.exe $PATCHES/pkg-config.c
+}
+
##### OCAML #####
function make_ocaml {
@@ -1151,15 +1161,11 @@ function make_menhir {
# Otherwise make install fails
function make_ocaml_cairo2 {
-
if build_prep https://github.com/Chris00/ocaml-cairo/archive 0.6 tar.gz 1 ocaml_cairo2-0.6; then
-
- # configure should be fixed to search for $TARGET_ARCH-pkg-config
- cp "/bin/$TARGET_ARCH-pkg-config" bin_special/pkg-config
+ make_arch_pkg_config
log2 dune build cairo2.install
log2 dune install cairo2
-
log2 dune clean
build_post
@@ -1175,9 +1181,7 @@ function make_lablgtk {
make_ocaml_cairo2
if build_prep https://github.com/garrigue/lablgtk/archive 3.0.beta5 tar.gz 1 lablgtk-3.0.beta5 ; then
-
- # configure should be fixed to search for $TARGET_ARCH-pkg-config
- cp "/bin/$TARGET_ARCH-pkg-config" bin_special/pkg-config
+ make_arch_pkg_config
# lablgtk3 includes more packages that are not relevant for Coq,
# such as gtkspell
diff --git a/dev/build/windows/patches_coq/pkg-config.c b/dev/build/windows/patches_coq/pkg-config.c
new file mode 100755
index 0000000000..e4fdcd4d7d
--- /dev/null
+++ b/dev/build/windows/patches_coq/pkg-config.c
@@ -0,0 +1,29 @@
+// MinGW personality wrapper for pkgconf
+// This is an excutable replacement for the shell scripts /bin/ARCH-pkg-config
+// Compile with e.g.
+// gcc pkg-config.c -DARCH=x86_64-w64-mingw32 -o pkg-config.exe
+// gcc pkg-config.c -DARCH=i686-w64-mingw32 -o pkg-config.exe
+// ATTENTION: Do not compile with MinGW-gcc, compile with cygwin gcc!
+//
+// To test it execute e.g.
+// $ ./pkg-config --path zlib
+// /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/zlib.pc
+
+#include <unistd.h>
+
+#define STRINGIFY1(arg) #arg
+#define STRINGIFY(arg) STRINGIFY1(arg)
+
+int main(int argc, char *argv[])
+{
+ // +1 for extra argument, +1 for trailing NULL
+ char * argvnew[argc+2];
+ int id=0, is=0;
+
+ argvnew[id++] = argv[is++];
+ argvnew[id++] = "--personality="STRINGIFY(ARCH);
+ while( is<argc ) argvnew[id++] = argv[is++];
+ argvnew[id++] = 0;
+
+ return execv("/usr/bin/pkgconf", argvnew);
+}