lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master cc85ea5a 11/13: Build libraries with specifie


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cc85ea5a 11/13: Build libraries with specified toolchain
Date: Mon, 21 Nov 2022 17:29:19 -0500 (EST)

branch: master
commit cc85ea5a1a670f4fe996b5467d0277771bf66798
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Build libraries with specified toolchain
    
    Formerly, clang lmi builds actually used gcc-built libraries; now, they
    use clang-built libraries.
    
    An attempt to use the same 'configure' command line for both toolchains,
    specifying variables such as $CC and $CXX variously in 'case' blocks,
    was unsuccessful; it is speculated that specifying those either as 'gcc'
    and 'g++', or as empty, interferes with some autotools black magic. A
    later refactoring might try to use the same 'configure' command line
    again, setting 'configure' options to include such conditional overrides
    for clang only but omitting them for gcc.
    
    Added explicit $CFLAGS and $CXXFLAGS for xmlwrapp builds, which formerly
    lacked them--notably, to specify FP flags such as '-frounding-math',
    which should be globally consistent.
---
 install_wx.sh            | 42 +++++++++++++++++++++------
 install_wxpdfdoc.sh      | 37 +++++++++++++++++++-----
 install_xml_libraries.sh | 75 +++++++++++++++++++++++++++++++++++++++---------
 3 files changed, 124 insertions(+), 30 deletions(-)

diff --git a/install_wx.sh b/install_wx.sh
index a9964504..90ea5623 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -63,8 +63,8 @@ vendor=${LMI_TRIPLET}-$gcc_version-$(git rev-parse --short 
HEAD:third_party/wx)
 # Configuration reference:
 #   https://lists.nongnu.org/archive/html/lmi/2007-11/msg00001.html
 
-wx_cc_flags='-fno-ms-extensions -fno-omit-frame-pointer -frounding-math 
-fsignaling-nans'
-wx_cxx_flags='-fno-ms-extensions -fno-omit-frame-pointer -frounding-math 
-fsignaling-nans'
+ wx_cc_flags='-fno-ms-extensions -fno-omit-frame-pointer'
+wx_cxx_flags='-fno-ms-extensions -fno-omit-frame-pointer'
 
 config_options="
   --prefix=$prefix
@@ -114,13 +114,37 @@ mkdir --parents "$build_dir"
 
 cd "$build_dir"
 printf 'Building %s with %s for %s.\n' "wx" "$LMI_COMPILER" "$LMI_TRIPLET"
-# 'config_options' must not be double-quoted
-# shellcheck disable=SC2086
-"$wx_dir"/configure $config_options \
-  CPPFLAGS="-I$prefix/include" \
-    CFLAGS="$wx_cc_flags" \
-  CXXFLAGS="$wx_cxx_flags" \
-   LDFLAGS="-L$exec_prefix/lib" \
+
+case "$LMI_COMPILER" in
+    (gcc)
+        valid_math="-frounding-math -fsignaling-nans"
+        # 'config_options' must not be double-quoted
+        # shellcheck disable=SC2086
+        "$wx_dir"/configure $config_options \
+          CPPFLAGS="-I$prefix/include" \
+            CFLAGS="$wx_cc_flags  $valid_math" \
+          CXXFLAGS="$wx_cxx_flags $valid_math" \
+           LDFLAGS="-L$exec_prefix/lib" \
+
+        ;;
+    (clang)
+        valid_math="-Woverriding-t-option -ffp-model=strict 
-ffp-exception-behavior=ignore -Wno-overriding-t-option"
+        # 'config_options' must not be double-quoted
+        # shellcheck disable=SC2086
+        "$wx_dir"/configure $config_options \
+                CC=clang \
+               CXX=clang++ \
+          CPPFLAGS="-I$prefix/include" \
+            CFLAGS="$wx_cc_flags  $valid_math" \
+          CXXFLAGS="$wx_cxx_flags $valid_math" \
+           LDFLAGS="-L$exec_prefix/lib -fuse-ld=lld" \
+
+        ;;
+    (*)
+        printf '%s\n' "Unknown toolchain '$LMI_COMPILER'."
+        return 2;
+        ;;
+esac
 
 $MAKE
 $MAKE install
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index 613d0361..c0780b4c 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -54,8 +54,8 @@ case "$build_type" in
         ;;
 esac
 
-wxpdfdoc_cc_flags='-fno-ms-extensions -fno-omit-frame-pointer -frounding-math 
-fsignaling-nans'
-wxpdfdoc_cxx_flags='-fno-ms-extensions -fno-omit-frame-pointer -frounding-math 
-fsignaling-nans'
+ wxpdfdoc_cc_flags='-fno-ms-extensions -fno-omit-frame-pointer'
+wxpdfdoc_cxx_flags='-fno-ms-extensions -fno-omit-frame-pointer'
 
 config_options="
   --prefix=$prefix
@@ -101,11 +101,34 @@ mkdir --parents "$build_dir"
 
 cd "$build_dir"
 printf 'Building %s with %s for %s.\n' "wxpdfdoc" "$LMI_COMPILER" 
"$LMI_TRIPLET"
-# 'config_options' must not be double-quoted
-# shellcheck disable=SC2086
-"$wxpdfdoc_dir"/configure $config_options \
-    CFLAGS="$wxpdfdoc_cc_flags" \
-  CXXFLAGS="$wxpdfdoc_cxx_flags" \
+
+case "$LMI_COMPILER" in
+    (gcc)
+        valid_math="-frounding-math -fsignaling-nans"
+        # 'config_options' must not be double-quoted
+        # shellcheck disable=SC2086
+        "$wxpdfdoc_dir"/configure $config_options \
+            CFLAGS="$wxpdfdoc_cc_flags  $valid_math" \
+          CXXFLAGS="$wxpdfdoc_cxx_flags $valid_math" \
+
+        ;;
+    (clang)
+        valid_math="-Woverriding-t-option -ffp-model=strict 
-ffp-exception-behavior=ignore -Wno-overriding-t-option"
+        # 'config_options' must not be double-quoted
+        # shellcheck disable=SC2086
+        "$wxpdfdoc_dir"/configure $config_options \
+                CC=clang \
+               CXX=clang++ \
+            CFLAGS="$wxpdfdoc_cc_flags  $valid_math" \
+          CXXFLAGS="$wxpdfdoc_cxx_flags $valid_math" \
+           LDFLAGS="-fuse-ld=lld" \
+
+        ;;
+    (*)
+        printf '%s\n' "Unknown toolchain '$LMI_COMPILER'."
+        return 2;
+        ;;
+esac
 
 $MAKE
 $MAKE install
diff --git a/install_xml_libraries.sh b/install_xml_libraries.sh
index 2127c938..e21b7f9c 100755
--- a/install_xml_libraries.sh
+++ b/install_xml_libraries.sh
@@ -72,9 +72,6 @@ export PKG_CONFIG_SYSROOT_DIR=
 
 # We can't have new lines in the CFLAGS, so get rid of them explicitly.
 xmlsoft_common_cflags=$(echo '
-  -fno-ms-extensions
-  -frounding-math
-  -fsignaling-nans
   -Wno-cpp
   -Wno-discarded-qualifiers
   -Wno-format
@@ -220,13 +217,36 @@ for lib in libxml2 libxslt; do
     fi
     mkdir --parents "$build_dir/$lib"
     cd "$build_dir/$lib"
-    # 'configure' options must not be double-quoted
-    # shellcheck disable=SC2046
-    "$libdir/configure" \
-        LDFLAGS="$xmlsoft_common_ldflags" \
-        CPPFLAGS='-w' \
-        CFLAGS="-g -O2 $xmlsoft_common_cflags" \
-        $(eval "echo \$${lib}_options") || err=$?
+
+    case "$LMI_COMPILER" in
+        (gcc)
+            valid_math="-frounding-math -fsignaling-nans"
+            # 'configure' options must not be double-quoted
+            # shellcheck disable=SC2046
+            "$libdir/configure" \
+                CPPFLAGS='-w' \
+                CFLAGS="-g -O2 $xmlsoft_common_cflags -fno-ms-extensions 
$valid_math" \
+                LDFLAGS="$xmlsoft_common_ldflags" \
+                $(eval "echo \$${lib}_options") || err=$?
+            ;;
+        (clang)
+            valid_math="-Woverriding-t-option -ffp-model=strict 
-ffp-exception-behavior=ignore -Wno-overriding-t-option"
+            # 'configure' options must not be double-quoted
+            # shellcheck disable=SC2046
+            "$libdir/configure" \
+                CC=clang \
+                CXX=clang++ \
+                CPPFLAGS='-w' \
+                CFLAGS="-g -O2 $xmlsoft_common_cflags -fno-ms-extensions 
$valid_math" \
+                LDFLAGS="$xmlsoft_common_ldflags -fuse-ld=lld" \
+                $(eval "echo \$${lib}_options") || err=$?
+                ;;
+            (*)
+                printf '%s\n' "Unknown toolchain '$LMI_COMPILER'."
+                return 2;
+            ;;
+    esac
+
     if [ -n "$err" ]; then
         echo '* Configuring failed, contents of config.log follows: *'
         echo '-------------------------------------------------------'
@@ -251,10 +271,37 @@ for lib in xmlwrapp; do
     autoreconf --install
     mkdir --parents "$build_dir/$lib"
     cd "$build_dir/$lib"
-    # shellcheck disable=SC2086
-    "$libdir/configure" \
-        PKG_CONFIG_LIBDIR="$exec_prefix"/lib/pkgconfig \
-        $xmlwrapp_options || err=$?
+
+    case "$LMI_COMPILER" in
+        (gcc)
+            valid_math="-frounding-math -fsignaling-nans"
+            # 'configure' options must not be double-quoted
+            # shellcheck disable=SC2086
+            "$libdir/configure" \
+                PKG_CONFIG_LIBDIR="$exec_prefix"/lib/pkgconfig \
+                  CFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
+                CXXFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
+                $xmlwrapp_options || err=$?
+            ;;
+        (clang)
+            valid_math="-Woverriding-t-option -ffp-model=strict 
-ffp-exception-behavior=ignore -Wno-overriding-t-option"
+            # 'configure' options must not be double-quoted
+            # shellcheck disable=SC2086
+            "$libdir/configure" \
+                PKG_CONFIG_LIBDIR="$exec_prefix"/lib/pkgconfig \
+                      CC=clang \
+                     CXX=clang++ \
+                  CFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
+                CXXFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
+                LDFLAGS="-fuse-ld=lld" \
+                $xmlwrapp_options || err=$?
+            ;;
+        (*)
+            printf '%s\n' "Unknown toolchain '$LMI_COMPILER'."
+            return 2;
+            ;;
+    esac
+
     if [ -n "$err" ]; then
         echo '* Configuring failed, contents of config.log follows: *'
         echo '-------------------------------------------------------'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]