lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master aea8ef1: Detect build architecture correctly


From: Greg Chicares
Subject: [lmi-commits] [lmi] master aea8ef1: Detect build architecture correctly
Date: Fri, 12 Apr 2019 08:46:36 -0400 (EDT)

branch: master
commit aea8ef13fb263b506866e7956d83f5aa5c688d95
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Detect build architecture correctly
    
    $LMI_HOST had historically been defined for GNU/Linux cross builds
    only, but undefined for cygwin, and had expediently but inappropriately
    been used as a proxy for build type; 'uname' had served a similar role
    elsewhere. Now 'config.guess' is used instead, throughout, by calling
      /usr/share/libtool/build-aux/config.guess
    directly. That script is guaranteed to exist because 'libtool' is an
    lmi dependency, and is assumed to be reasonably current. It potentially
    compiles test code, so experience might show it to be too slow in some
    circumstance; that doesn't seem to be a problem for debian GNU/Linux.
    
    Third-party libraries now use their own 'config.guess' scripts (not
    libtool's, and certainly not $LMI_HOST or 'uname').
    
    * install_msw.sh: Set $platform conditionally to "Cygwin" precisely
    because that string does not match 'uname' or 'config.guess' output.
---
 GNUmakefile                  |  4 ++--
 check_git_setup.sh           |  9 ++++++---
 configuration.make           | 23 +++++++++--------------
 gui_test.sh                  |  5 +++--
 install_libxml2_libxslt.make | 21 ++++++++++++---------
 install_msw.sh               | 18 ++++++++++--------
 install_wx.sh                |  4 ++--
 install_wxpdfdoc.sh          |  4 ++--
 nychthemeral_test.sh         |  5 +++--
 test_coding_rules_test.sh    |  5 +++--
 tools/pete-2.1.1/Makefile    |  4 ++--
 11 files changed, 54 insertions(+), 48 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4924b35..c258067 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -35,8 +35,8 @@ this_makefile := $(abspath $(lastword $(MAKEFILE_LIST)))
 # for instance because it can automatically enforce Paul's advice
 # "it's best to invoke make with the -r option".
 #
-# One of several architecture-specific files is included, based on the
-# result of 'uname'. Separate files encapsulate variations better.
+# One of several architecture-specific files is included, based on a
+# 'config.guess' probe. Separate files encapsulate variations better.
 #
 # The ':' command Paul gives for his do-nothing rule seems no longer
 # to be necessary.
diff --git a/check_git_setup.sh b/check_git_setup.sh
index 88e4c12..b763f7a 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -34,13 +34,16 @@ printf '"%s" is git toplevel directory\n' "$toplevel"
 #'core.filemode' is "false". See:
 #   https://lists.nongnu.org/archive/html/lmi/2017-11/msg00018.html
 
-case $(uname) in
-  (CYGWIN*)
+lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
+case "$lmi_build_type" in
+  (*-*-cygwin*)
     printf 'cygwin detected\n'
     printf 'forcing correct permissions '
       for d in . gwc; do (\
            printf '%s...' "$d" \
-        && find ./$d -maxdepth 1 -type f -not -name '*.sh' -not -name '*.sed' 
| xargs chmod -x \
+        && find ./$d -maxdepth 1 -type f \
+             -not -name '*.sh' -not -name '*.sed' \
+             | xargs chmod -x \
       )done; \
     printf 'all permissions forced\n'
     git config core.filemode false
diff --git a/configuration.make b/configuration.make
index 73806ad..924ef56 100644
--- a/configuration.make
+++ b/configuration.make
@@ -23,23 +23,18 @@
 
 # Include platform-specific makefile.
 
-uname := $(shell uname 2>/dev/null)
+lmi_build_type := $(shell /usr/share/libtool/build-aux/config.guess)
 
-platform-makefile := posix_fhs.make
-
-ifeq (i686-w64-mingw32,$(findstring i686-w64-mingw32,$(LMI_HOST)))
-  platform-makefile := msw_generic.make
-else ifeq (x86_64-w64-mingw32,$(findstring x86_64-w64-mingw32,$(LMI_HOST)))
-  platform-makefile := msw_generic.make
-endif
-
-ifeq (MINGW,$(findstring MINGW,$(uname)))
+ifeq (msys,$(findstring msys,$(lmi_build_type)))
   platform-makefile := msw_msys.make
-else ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+else ifeq (cygwin,$(findstring cygwin,$(lmi_build_type)))
   platform-makefile := msw_cygwin.make
-else ifeq (,$(uname))
-  uname := msw_generic
-  platform-makefile := msw_generic.make
+else
+  ifeq (mingw32,$(findstring mingw32,$(LMI_HOST)))
+    platform-makefile := msw_generic.make
+  else
+    platform-makefile := posix_fhs.make
+  endif
 endif
 
 include $(srcdir)/$(platform-makefile)
diff --git a/gui_test.sh b/gui_test.sh
index b03c9e9..5c90ecf 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -36,8 +36,9 @@ set -e
 # provides no convenient alternative):
 setopt PIPE_FAIL
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
+case "$lmi_build_type" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/install_libxml2_libxslt.make b/install_libxml2_libxslt.make
index 4e2e79e..7d40d35 100644
--- a/install_libxml2_libxslt.make
+++ b/install_libxml2_libxslt.make
@@ -58,13 +58,12 @@ xml_dir       := /opt/lmi/xml-scratch
 # Variables that normally should be left alone 
#################################
 
 mingw_bin_dir :=
-build_type    := x86_64-unknown-linux-gnu
 host_type     := i686-w64-mingw32
 
-uname := $(shell uname 2>/dev/null)
-ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+lmi_build_type := $(shell /usr/share/libtool/build-aux/config.guess)
+
+ifeq (cygwin,$(findstring cygwin,$(lmi_build_type)))
   mingw_bin_dir := $(mingw_dir)/bin/
-  build_type    := i686-pc-cygwin
   host_type     := i686-w64-mingw32
 endif
 
@@ -77,7 +76,7 @@ xz_cflags := \
 $(xz_version)_options := \
   --prefix=$(prefix) \
   --exec-prefix=$(exec_prefix) \
-  --build=$(build_type) \
+  --build=$(shell $(xml_dir)/$(xz_version)/build-aux/config.guess) \
   --host=$(host_type) \
   --disable-dependency-tracking \
   CFLAGS="-g -O2 $(xz_cflags)" \
@@ -115,10 +114,6 @@ xmlsoft_common_cflags := \
   -Wno-unused-variable \
 
 xmlsoft_common_options := \
-  --prefix=$(prefix) \
-  --exec-prefix=$(exec_prefix) \
-  --build=$(build_type) \
-  --host=$(host_type) \
   --disable-dependency-tracking \
   --disable-static \
   --enable-shared \
@@ -129,6 +124,10 @@ xmlsoft_common_options := \
   CFLAGS="-g -O2 $(xmlsoft_common_cflags)" \
 
 $(libxml2_version)_options := \
+  --prefix=$(prefix) \
+  --exec-prefix=$(exec_prefix) \
+  --build=$(shell $(xml_dir)/$(libxml2_version)/config.guess) \
+  --host=$(host_type) \
   $(xmlsoft_common_options) \
   --with-lzma=$(prefix) \
   --with-schemas \
@@ -144,6 +143,10 @@ $(libxml2_version)_options := \
 # libxslt option were named '--with-libxml-exec-prefix'.
 
 $(libxslt_version)_options := \
+  --prefix=$(prefix) \
+  --exec-prefix=$(exec_prefix) \
+  --build=$(shell $(xml_dir)/$(libxslt_version)/config.guess) \
+  --host=$(host_type) \
   $(xmlsoft_common_options) \
   --with-libxml-prefix=$(exec_prefix) \
   --without-crypto \
diff --git a/install_msw.sh b/install_msw.sh
index c0322b0..e314a2a 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -43,14 +43,16 @@ then
     export coefficiency='--jobs=4'
 fi
 
+lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
+
 export platform
-case $(uname) in
-    CYGWIN*)
-        platform=CYGWIN
+case "$lmi_build_type" in
+    (*-*-cygwin*)
+        platform=Cygwin
         ;;
 esac
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     mount
 
@@ -139,7 +141,7 @@ cd /opt/lmi/src/lmi || print "Cannot cd"
 
 ./check_git_setup.sh
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     # A "Replacing former [...] mount:" message probably means that this
     # mount was set by an earlier lmi installation; that can be ignored.
@@ -172,7 +174,7 @@ find /cache_for_lmi/downloads -type f | xargs md5sum
 
 rm --force --recursive scratch
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     # For Cygwin, install and use this msw-native compiler.
     rm --force --recursive /MinGW_
@@ -201,7 +203,7 @@ make $coefficiency --output-sync=recurse PATH=$minimal_path 
show_flags
 make $coefficiency --output-sync=recurse PATH=$minimal_path clean
 make $coefficiency --output-sync=recurse PATH=$minimal_path install
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     # No lmi binary should depend on any Cygwin library.
 
@@ -249,7 +251,7 @@ EOF
 # therefore, symlink the directories lmi uses as described in
 # 'README.schroot'.
 
-if [ "CYGWIN" != "$platform" ]
+if [ "Cygwin" != "$platform" ]
 then
     sed -i /opt/lmi/data/configurable_settings.xml -e's/C://g'
 fi
diff --git a/install_wx.sh b/install_wx.sh
index 64d64c4..3987b27 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -80,8 +80,8 @@ git submodule update "$coefficiency" --recursive --init
 build_type=$("$proxy_wx_dir"/config.guess)
 host_type=i686-w64-mingw32
 
-case $(uname) in
-    CYGWIN*)
+case "$build_type" in
+    (*-*-cygwin*)
         mingw_bin_dir=$mingw_dir/bin/
         ;;
 esac
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index eda698c..0123cbf 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -77,8 +77,8 @@ git checkout "$wxpdfdoc_commit_sha"
 build_type=$("$proxy_wxpdfdoc_dir"/admin/build-aux/config.guess)
 host_type=i686-w64-mingw32
 
-case $(uname) in
-    CYGWIN*)
+case "$build_type" in
+    (*-*-cygwin*)
         mingw_bin_dir=$mingw_dir/bin/
         ;;
 esac
diff --git a/nychthemeral_test.sh b/nychthemeral_test.sh
index b0d7c00..59be3b1 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -36,8 +36,9 @@ set -e
 # provides no convenient alternative):
 setopt PIPE_FAIL
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
+case "$lmi_build_type" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/test_coding_rules_test.sh b/test_coding_rules_test.sh
index d719f5a..4bd226e 100755
--- a/test_coding_rules_test.sh
+++ b/test_coding_rules_test.sh
@@ -361,8 +361,9 @@ touch another.unexpected.file
 
 # Compare observed to expected. Note that directory '.' is ignored.
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
+case "$lmi_build_type" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/tools/pete-2.1.1/Makefile b/tools/pete-2.1.1/Makefile
index 75d8dc4..e4eb2c0 100644
--- a/tools/pete-2.1.1/Makefile
+++ b/tools/pete-2.1.1/Makefile
@@ -21,10 +21,10 @@
 
 
################################################################################
 
-uname := $(shell uname -s 2>/dev/null)
+lmi_build_type := $(shell /usr/share/libtool/build-aux/config.guess)
 
 EXEEXT :=
-ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+ifeq (cygwin,$(findstring cygwin,$(lmi_build_type)))
   EXEEXT := .exe
 endif
 



reply via email to

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