]> granicus.if.org Git - re2c/commitdiff
Updated Mingw build scripts to workaround libtool/slibtool issues.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 11 Jul 2019 18:12:04 +0000 (19:12 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 11 Jul 2019 18:12:04 +0000 (19:12 +0100)
Currently we need both libtool and slibtool:

  - libtool fails to link self-contained DLL (it ignores '-static-libstdc++
    -static-libgcc'), but manages to link EXEs with static library

  - slibtool manages to link self-contained DLL, but then fails to link the
    final EXEs with it (it passes '-lre2c' before some other predefined object
    file that contains definitions from libgcc)

__alltest.sh
__build_mingw.sh
__build_mingw_slibtool.sh [new file with mode: 0755]

index 931c097c49dc0510992cae039a2fa6bd3d35db41..a451a6becd8477462b1e62114c9d046fdac3ce87 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
 
 # normal tests
-for d in __build{,_asan,_ubsan,_lsan,_clang,_clang_msan,_m32,_glibcxx_debug} ; do
+# - exclude _clang_msan as it requires libc++ built with MSan
+for d in __build{,_asan,_ubsan,_lsan,_clang,_m32,_glibcxx_debug} ; do
     ./${d}.sh \
         && cd ${d} \
         && make check VERBOSE=1 \
@@ -17,6 +18,7 @@ done
     || { cd .. ; echo "*** skeleton failed ***"; exit 1; }
 
 # mingw
+# - exclude _mingw_slibtool, as it fails to link EXEs due to symbol collisions
 ./__build_mingw.sh \
     && cd __build_mingw \
     && make wtests \
index 51daba5cd2da70803e526108cd78ffa6dd97f710..1ce12e251e44e7814667ad808b92474cf8de6109 100755 (executable)
@@ -5,9 +5,12 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure LDFLAGS="-static-libstdc++ -static-libgcc" \
+# '-static' tells libtool not to build shared libraries (DLLs)
+# (they would be of no use anyway because libtool ignores '-static-libstdc++
+# -static-libgcc' options and produces non-portable DLLs)
+../configure LDFLAGS="-static -static-libstdc++ -static-libgcc" \
     --enable-debug \
     --enable-libs \
     --host i686-w64-mingw32 \
-    && make -j$(nproc) LIBTOOL="dlibtool"
+    && make -j$(nproc)
 cd ..
diff --git a/__build_mingw_slibtool.sh b/__build_mingw_slibtool.sh
new file mode 100755 (executable)
index 0000000..acef223
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+builddir=__build_mingw_slibtool
+rm -rf $builddir
+mkdir $builddir
+
+cd $builddir
+# slibtool fails to build final EXEs because of symbol collisions:
+# libre2c is statically linked with libgcc, and slibtool passes -lre2c
+# before some object file that also contains definitions from libgcc
+#
+# however, slibtool manages to correctly build self-contained libre2c.dll
+# (unlike libtool, which ignores '-static-libstdc++ -static-libgcc' and
+# produces non-portable DLL)
+../configure LDFLAGS="-static-libstdc++ -static-libgcc" \
+    --enable-debug \
+    --enable-libs \
+    --host i686-w64-mingw32 \
+    && make -j$(nproc) LIBTOOL="slibtool"
+cd ..