lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] odd/multiarch b94771d 4/6: Distinguish build from ho


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/multiarch b94771d 4/6: Distinguish build from host architecture
Date: Sun, 7 Apr 2019 10:48:33 -0400 (EDT)

branch: odd/multiarch
commit b94771dee6c0630e7def28595fa46a0adda47d0a
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Distinguish build from host architecture
    
    Established an $LMI_BUILD variable and used it for all logic that
    really depends on the build platform, replacing former use of
     - 'uname', to which gnu triplets are preferred for uniformity; and
     - $LMI_HOST, which historically had been defined for GNU/Linux
       cross builds only, and undefined for cygwin, and had therefore
       (albeit inappropriately) used as a proxy for build type.
    This new $LMI_BUILD variable might eventually be replaced by a script
    or a direct call to '/usr/share/libtool/build-aux/config.guess' (which
    is guaranteed to exist because 'libtool' is an lmi dependency, and is
    assumed to be reasonably current; but whose result it might be better
    to cache, because it may be slow as it potentially compiles test code).
---
 GNUmakefile                  |  2 +-
 check_git_setup.sh           | 31 +++++++++++++++++--------------
 configuration.make           | 23 ++++++++---------------
 gui_test.sh                  |  4 ++--
 gwc/.zshrc                   |  2 ++
 install_libxml2_libxslt.make | 32 +++++++++++++++++++-------------
 install_msw.sh               | 27 ++++++++++++---------------
 install_wx.sh                |  6 ++++--
 install_wxpdfdoc.sh          |  4 ++--
 nychthemeral_test.sh         | 22 +++++++++++-----------
 test_coding_rules_test.sh    |  4 ++--
 tools/pete-2.1.1/Makefile    |  4 +---
 12 files changed, 81 insertions(+), 80 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 4a0d1fe..1832e7f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -36,7 +36,7 @@ this_makefile := $(abspath $(lastword $(MAKEFILE_LIST)))
 # "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.
+# value of $LMI_BUILD. 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..47c330c 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -34,20 +34,23 @@ 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*)
-    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 \
-      )done; \
-    printf 'all permissions forced\n'
-    git config core.filemode false
-    ;;
-  (*)
-    printf 'cygwin not detected--assuming OS is POSIX\n'
-    ;;
+# Call 'config.guess' here, or cache it in $LMI_BUILD?
+case "$LMI_BUILD" 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 \
+          )done; \
+        printf 'all permissions forced\n'
+        git config core.filemode false
+        ;;
+    (*)
+        printf 'cygwin not detected--assuming OS is POSIX\n'
+        ;;
 esac
 
 printf 'core.filemode is "%s"\n' "$(git config --get-all core.filemode)"
diff --git a/configuration.make b/configuration.make
index 73806ad..fd7e5eb 100644
--- a/configuration.make
+++ b/configuration.make
@@ -23,23 +23,16 @@
 
 # Include platform-specific makefile.
 
-uname := $(shell uname 2>/dev/null)
-
-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)))
   platform-makefile := msw_msys.make
-else ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+else ifeq (cygwin,$(findstring cygwin,$(LMI_BUILD)))
   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 ea086eb..4481f99 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -36,8 +36,8 @@ set -e
 # provides no convenient alternative):
 setopt PIPE_FAIL
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+case "$LMI_BUILD" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/gwc/.zshrc b/gwc/.zshrc
index a87017f..c2e8ba1 100644
--- a/gwc/.zshrc
+++ b/gwc/.zshrc
@@ -1,6 +1,8 @@
 # Personal configuration for cross-building in a chroot.
 
 export WINEPATH='Z:\\opt\\lmi\\local\\bin;Z:\\opt\\lmi\\local\\lib'
+# Perhaps use $(/usr/share/libtool/build-aux/config.guess) instead.
+export LMI_BUILD=x86_64-pc-linux-gnu
 export LMI_HOST=i686-w64-mingw32
 export PATH="/opt/lmi/local/bin:/opt/lmi/local/lib:$PATH"
 # At a regular user prompt, outside the chroot, do this:
diff --git a/install_libxml2_libxslt.make b/install_libxml2_libxslt.make
index 7533fe9..998a0b6 100644
--- a/install_libxml2_libxslt.make
+++ b/install_libxml2_libxslt.make
@@ -49,11 +49,6 @@ $(xz_version).tar.gz: host_path := projects/lzmautils/files
 mingw_dir     := /MinGW_
 
 # Move $host_type here to make it configurable.
-# Move $build_type here to keep it with $host_type.
-# This build_type is overridden below for cygwin; is there no good
-# way to get it dynamically, OAOO, except 'config.guess', which may
-# not be globally available?
-build_type    := x86_64-unknown-linux-gnu
 host_type     := $(if $(LMI_HOST),$(LMI_HOST),i686-w64-mingw32)
 
 prefix        := /opt/lmi/$(host_type)/local
@@ -66,11 +61,18 @@ xml_dir       := /opt/lmi/$(host_type)/xml-scratch
 # Variables that normally should be left alone 
#################################
 
 mingw_bin_dir :=
+#   cache the value in $LMI_BUILD, or always invoke 'config.guess'?
+# This build_type is overridden below for cygwin; is there no good
+# way to get it dynamically, OAOO, except 'config.guess', which may
+# not be globally available?
+# expunge build_type    := $(if $(LMI_BUILD),$(LMI_BUILD),x86_64-pc-linux-gnu)
 
-uname := $(shell uname 2>/dev/null)
-ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+# also review all occurrences of 'PERFORM'
+ifeq (cygwin,$(findstring cygwin,$(LMI_BUILD)))
   mingw_bin_dir := $(mingw_dir)/bin/
-  build_type    := i686-pc-cygwin
+# In the future..."x86_64-pc-cygwin" would be correct;
+# but it's future-proof to use 'config.guess'.
+# expunge  build_type    := i686-pc-cygwin
 endif
 
 xz_cflags := \
@@ -82,7 +84,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)" \
@@ -120,10 +122,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 \
@@ -134,6 +132,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 \
@@ -149,6 +151,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 b4da6f3..7d148c8 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -38,20 +38,19 @@ echo "Started: $stamp0"
 #   (but don't force it to 4 if it's already set).
 # '--output-sync=recurse' is also used, passim, to facilitate log
 #   comparison.
-#
 if [ -z "$coefficiency" ]
 then
     export coefficiency='--jobs=4'
 fi
 
 export platform
-case $(uname) in
-    CYGWIN*)
-        platform=CYGWIN
+case "$LMI_BUILD" in
+    (*-*-cygwin*)
+        platform=Cygwin
         ;;
 esac
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     mount
 
@@ -144,7 +143,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.
@@ -176,15 +175,13 @@ md5sum "$0"
 find /cache_for_lmi/downloads -type f | xargs md5sum
 SUPPRESSED
 
+# No longer necessary:
 rm --force --recursive scratch
 
-# Eventually, this should be used for cygwin as well, to support
-# building with different '--host' settings (but for now $LMI_HOST
-# is also used to determine whether 'wine' is used, which is wrong
-# because that should properly depend on the '--build' system).
+# Not needed with for-loop below:
 export LMI_HOST=${LMI_HOST:-"i686-w64-mingw32"}
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     # For Cygwin, install and use this msw-native compiler.
     rm --force --recursive /MinGW_
@@ -225,12 +222,12 @@ export 
minimal_path=/opt/lmi/local/bin:/opt/lmi/local/lib:/usr/bin:/bin:/usr/sbi
 
 # USE SYMLINKS INSTEAD
 # condition should be cross compilation, not !cygwin
-# double quotes inside double quotes--wrong?
 # 'winepath' doesn't DTRT with '/first/path:/second/path'--need to
 #   run it against each component, and separate results with ';', not ':'
-#if [ "CYGWIN" != "$platform" ]
+#if [ "Cygwin" != "$platform" ]
 #then
 #   extrabindir=/opt/lmi/third_party/bin
+# double quotes inside double quotes--wrong?
 #   w0="$(winepath -w "$localbindir" | sed -e's/\\/\\\\/g')"
 #   w1="$(winepath -w "$locallibdir" | sed -e's/\\/\\\\/g')"
 #   w2="$(winepath -w "$extrabindir" | sed -e's/\\/\\\\/g')"
@@ -244,7 +241,7 @@ make $coefficiency --output-sync=recurse PATH=$minimal_path 
install
 
 done
 
-if [ "CYGWIN" = "$platform" ]
+if [ "Cygwin" = "$platform" ]
 then
     # No lmi binary should depend on any Cygwin library.
 
@@ -292,7 +289,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 11f13ca..08143dd 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -79,10 +79,12 @@ git checkout "$wx_commit_sha"
 # Get any new submodules that may have been added, even if nested.
 git submodule update "$coefficiency" --recursive --init
 
+# This should be equivalent to $LMI_BUILD, but it's better to use the
+# library's own 'config.guess'.
 build_type=$("$proxy_wx_dir"/config.guess)
 
-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 cc150d9..c659460 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -78,8 +78,8 @@ git checkout "$wxpdfdoc_commit_sha"
 
 build_type=$("$proxy_wxpdfdoc_dir"/admin/build-aux/config.guess)
 
-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 b68031c..656532c 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -51,21 +51,21 @@ locallibdir="$exec_prefix"/local/lib
 export         PATH="$localbindir":"$locallibdir":"$PATH"
 export minimal_path="$localbindir":"$locallibdir":/usr/bin:/bin:/usr/sbin:/sbin
 
-# condition should be cross compilation, not !cygwin
+case "$LMI_BUILD" in
+    (*-*-linux*)
+        extrabindir=/opt/lmi/third_party/bin
 # double quotes inside double quotes--wrong?
-if [ "CYGWIN" != "$platform" ]
-then
-    extrabindir=/opt/lmi/third_party/bin
-    w0="$(winepath -w "$localbindir" | sed -e's/\\/\\\\/g')"
-    w1="$(winepath -w "$locallibdir" | sed -e's/\\/\\\\/g')"
-    w2="$(winepath -w "$extrabindir" | sed -e's/\\/\\\\/g')"
-    export WINEPATH="$w0;$w1:$w2"
-fi
+        w0="$(winepath -w "$localbindir" | sed -e's/\\/\\\\/g')"
+        w1="$(winepath -w "$locallibdir" | sed -e's/\\/\\\\/g')"
+        w2="$(winepath -w "$extrabindir" | sed -e's/\\/\\\\/g')"
+        export WINEPATH="$w0;$w1:$w2"
+        ;;
+esac
 # --- DISTRESSINGLY COPIED BLOCK
 SUPPRESSED
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+case "$LMI_BUILD" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/test_coding_rules_test.sh b/test_coding_rules_test.sh
index 5a20cd6..8b7fe58 100755
--- a/test_coding_rules_test.sh
+++ b/test_coding_rules_test.sh
@@ -361,8 +361,8 @@ touch another.unexpected.file
 
 # Compare observed to expected. Note that directory '.' is ignored.
 
-case "$LMI_HOST" in
-    ("i686-w64-mingw32" | "x86_64-w64-mingw32")
+case "$LMI_BUILD" in
+    (*-*-linux*)
         PERFORM=wine
         ;;
     (*)
diff --git a/tools/pete-2.1.1/Makefile b/tools/pete-2.1.1/Makefile
index 75d8dc4..55395e4 100644
--- a/tools/pete-2.1.1/Makefile
+++ b/tools/pete-2.1.1/Makefile
@@ -21,10 +21,8 @@
 
 
################################################################################
 
-uname := $(shell uname -s 2>/dev/null)
-
 EXEEXT :=
-ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
+ifeq (cygwin,$(findstring cygwin,$(LMI_BUILD)))
   EXEEXT := .exe
 endif
 



reply via email to

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