lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] odd/multiarch 3f1fcea 2/5: Add LMI_COMPILER; replace


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/multiarch 3f1fcea 2/5: Add LMI_COMPILER; replace LMI_HOST with LMI_TRIPLET
Date: Wed, 1 May 2019 17:30:50 -0400 (EDT)

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

    Add LMI_COMPILER; replace LMI_HOST with LMI_TRIPLET
---
 GNUmakefile                  |  8 ++++----
 INSTALL                      |  2 +-
 configuration.make           |  2 +-
 gui_test.sh                  |  2 +-
 gwc/.zshrc                   |  3 ++-
 install_libxml2_libxslt.make | 18 ++++++++++++------
 install_msw.sh               |  9 +++++----
 install_wx.sh                | 12 +++++++-----
 install_wxpdfdoc.sh          |  7 ++++---
 msw_generic.make             | 16 ++++++++--------
 nychthemeral_test.sh         |  4 ++--
 run.sh                       |  2 +-
 set_arch.sh                  | 19 +++++++++----------
 tabs/5/startup_script        |  2 +-
 workhorse.make               |  2 +-
 15 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 162504e..20ebb6a 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -86,7 +86,7 @@ MAKEFLAGS := \
 
 prefix          := /opt/lmi
 # parent directory for machine-specific binaries
-exec_prefix     := $(prefix)/$(LMI_HOST)
+exec_prefix     := $(prefix)/$(LMI_COMPILER)_$(LMI_TRIPLET)
 # binaries that users can run
 bindir          := $(prefix)/bin
 # binaries that administrators can run
@@ -367,9 +367,9 @@ raze: source_clean
 eviscerate: source_clean
        -$(RM) --force --recursive $(bindir)
        -$(RM) --force --recursive $(prefix)/third_party
-       -$(RM) --force --recursive $(prefix)/i686-w64-mingw32
-       -$(RM) --force --recursive $(prefix)/x86_64-w64-mingw32
-       -$(RM) --force --recursive $(prefix)/x86_64-pc-linux-gnu
+       -$(RM) --force --recursive $(prefix)/gcc_i686-w64-mingw32
+       -$(RM) --force --recursive $(prefix)/gcc_x86_64-w64-mingw32
+       -$(RM) --force --recursive $(prefix)/gcc_x86_64-pc-linux-gnu
 
 
################################################################################
 
diff --git a/INSTALL b/INSTALL
index 39b8db9..c0df599 100644
--- a/INSTALL
+++ b/INSTALL
@@ -79,7 +79,7 @@ Installation proceeds silently for anywhere from a few 
minutes to a couple
 of hours, depending on your computer. When you see "Finished building lmi",
 copy and paste these lines into the shell:
 
-  export LMI_HOST=i686-w64-mingw32 ; . ./set_arch.sh
+  export LMI_COMPILER=gcc ; export LMI_TRIPLET=i686-w64-mingw32 ; . 
./set_arch.sh
   /opt/lmi/bin/lmi_wx_shared --data_path=/opt/lmi/data
 
 You should see lmi's GUI. Try "File | New | Illustration", then press "OK";
diff --git a/configuration.make b/configuration.make
index bc0e00a..7dcd910 100644
--- a/configuration.make
+++ b/configuration.make
@@ -30,7 +30,7 @@ ifeq (msys,$(findstring msys,$(lmi_build_type)))
 else ifeq (cygwin,$(findstring cygwin,$(lmi_build_type)))
   platform_makefile := msw_cygwin.make
 else
-  ifeq (mingw32,$(findstring mingw32,$(LMI_HOST)))
+  ifeq (mingw32,$(findstring mingw32,$(LMI_TRIPLET)))
     platform_makefile := msw_generic.make
   else
     platform_makefile := posix_fhs.make
diff --git a/gui_test.sh b/gui_test.sh
index 020cf7e..d3e20ea 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -140,7 +140,7 @@ gui_test_clutter='
 '
 
 # Directory for test logs.
-log_dir=/tmp/lmi/"$LMI_HOST"/logs
+log_dir=/tmp/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/logs
 mkdir --parents "$log_dir"
 
 cd /opt/lmi/src/lmi
diff --git a/gwc/.zshrc b/gwc/.zshrc
index 6b22385..dea0c97 100644
--- a/gwc/.zshrc
+++ b/gwc/.zshrc
@@ -1,6 +1,7 @@
 # Personal configuration for cross-building in a chroot.
 
-export LMI_HOST=i686-w64-mingw32
+export LMI_COMPILER=gcc
+export LMI_TRIPLET=i686-w64-mingw32
 
 # To work with lmi, it is important to source 'set_arch.sh'. It's
 # deliberately not sourced here, so that it can assume that some
diff --git a/install_libxml2_libxslt.make b/install_libxml2_libxslt.make
index 0e95efb..fb359b2 100644
--- a/install_libxml2_libxslt.make
+++ b/install_libxml2_libxslt.make
@@ -48,9 +48,15 @@ $(xz_version).tar.gz: host_path := projects/lzmautils/files
 
 mingw_dir     := /MinGW_
 
-host_type     := $(if $(LMI_HOST),$(LMI_HOST),i686-w64-mingw32)
-
-prefix        := /opt/lmi/$(host_type)/local
+LMI_COMPILER  ?= gcc
+LMI_TRIPLET   ?= i686-w64-mingw32
+
+# It would be cleaner to use the "LMI_*" components in $exec_prefix
+# (arch-dependent libraries) rather than in $prefix (arch-independent
+# headers, e.g.). However, libxml2's '--with-lzma' option assumes that
+# $prefix and $exec_prefix are the same directory--see:
+#   https://lists.nongnu.org/archive/html/lmi/2019-04/msg00018.html
+prefix        := /opt/lmi/$(LMI_COMPILER)_$(LMI_TRIPLET)/local
 exec_prefix   := $(prefix)
 
 cache_dir     := /cache_for_lmi/downloads
@@ -77,7 +83,7 @@ $(xz_version)_options := \
   --prefix=$(prefix) \
   --exec-prefix=$(exec_prefix) \
   --build=`$(build_dir)/$(xz_version)/build-aux/config.guess` \
-  --host=$(host_type) \
+  --host=$(LMI_TRIPLET) \
   --disable-dependency-tracking \
   CFLAGS="-g -O2 $(xz_cflags)" \
 
@@ -127,7 +133,7 @@ $(libxml2_version)_options := \
   --prefix=$(prefix) \
   --exec-prefix=$(exec_prefix) \
   --build=`$(build_dir)/$(libxml2_version)/config.guess` \
-  --host=$(host_type) \
+  --host=$(LMI_TRIPLET) \
   $(xmlsoft_common_options) \
   --with-lzma=$(prefix) \
   --with-schemas \
@@ -146,7 +152,7 @@ $(libxslt_version)_options := \
   --prefix=$(prefix) \
   --exec-prefix=$(exec_prefix) \
   --build=`$(build_dir)/$(libxslt_version)/config.guess` \
-  --host=$(host_type) \
+  --host=$(LMI_TRIPLET) \
   $(xmlsoft_common_options) \
   --with-libxml-prefix=$(exec_prefix) \
   --without-crypto \
diff --git a/install_msw.sh b/install_msw.sh
index b74a400..14c990e 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -195,11 +195,12 @@ fi
 make $coefficiency --output-sync=recurse -f install_miscellanea.make clobber
 make $coefficiency --output-sync=recurse -f install_miscellanea.make
 
-# This for-loop can iterate over as many architectures as desired.
+# This for-loop can iterate over as many toolchains as desired.
 # Make sure the current production architecture is built last, so that
 # it's the one installed to /opt/lmi/bin/ when this script ends.
-export LMI_HOST
-for LMI_HOST in x86_64-w64-mingw32 i686-w64-mingw32 ;
+export LMI_COMPILER=gcc
+export LMI_TRIPLET
+for LMI_TRIPLET in x86_64-w64-mingw32 i686-w64-mingw32 ;
 do
     make $coefficiency --output-sync=recurse -f install_libxml2_libxslt.make
 
@@ -218,7 +219,7 @@ do
     if [ "Cygwin" = "$platform" ]
     then
         # No lmi binary should depend on any Cygwin library.
-        for z in /opt/lmi/"$LMI_HOST"/bin/* ;
+        for z in /opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/bin/* ;
           do cmd /c "$CYGCHECK $z" 2>&1 | grep --silent cygwin \
             && printf '\ncygcheck %s\n' "$z" && cmd /c "$CYGCHECK $z" ;
           done
diff --git a/install_wx.sh b/install_wx.sh
index 2c6ddef..c2b40fc 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -41,13 +41,14 @@ coefficiency=${coefficiency:-"--jobs=4"}
 
 MAKE=${MAKE:-"make $coefficiency"}
 
-host_type=${LMI_HOST:-"i686-w64-mingw32"}
+LMI_COMPILER=${LMI_COMPILER:-"gcc"}
+LMI_TRIPLET=${LMI_TRIPLET:-"i686-w64-mingw32"}
 
 # Variables that normally should be left alone 
#################################
 
 mingw_dir=/MinGW_
 
-prefix=/opt/lmi/"$host_type"/local
+prefix=/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/local
 exec_prefix="$prefix"
 
 repo_name="wxWidgets"
@@ -88,8 +89,9 @@ case "$build_type" in
 esac
 
 # Distinguish wx dll by host type, compiler version, and wx SHA1.
-gcc_version=$(${mingw_bin_dir}${host_type}-gcc -dumpversion|tr -d '\r')
-vendor=${host_type}-$gcc_version-$wx_commit_sha
+# generalize 'gcc' to ${LMI_COMPILER}
+gcc_version=$(${mingw_bin_dir}${LMI_TRIPLET}-gcc -dumpversion|tr -d '\r')
+vendor=${LMI_TRIPLET}-$gcc_version-$wx_commit_sha
 
 # Configuration reference:
 #   http://lists.nongnu.org/archive/html/lmi/2007-11/msg00001.html
@@ -101,7 +103,7 @@ config_options="
   --prefix=$prefix
   --exec-prefix=$exec_prefix
   --build=$build_type
-  --host=$host_type
+  --host=$LMI_TRIPLET
   --disable-apple_ieee
   --disable-aui
   --disable-compat30
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index f267ca9..039fa93 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -41,13 +41,14 @@ coefficiency=${coefficiency:-"--jobs=4"}
 
 MAKE=${MAKE:-"make $coefficiency"}
 
-host_type=${LMI_HOST:-"i686-w64-mingw32"}
+LMI_COMPILER=${LMI_COMPILER:-"gcc"}
+LMI_TRIPLET=${LMI_TRIPLET:-"i686-w64-mingw32"}
 
 # Variables that normally should be left alone 
#################################
 
 mingw_dir=/MinGW_
 
-prefix=/opt/lmi/"$host_type"/local
+prefix=/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/local
 exec_prefix="$prefix"
 
 repo_name="wxpdfdoc"
@@ -93,7 +94,7 @@ config_options="
   --with-wx-prefix=$prefix
   --with-wx-exec-prefix=$exec_prefix
   --build=$build_type
-  --host=$host_type
+  --host=$LMI_TRIPLET
   --disable-dependency-tracking
   CFLAGS=$wxpdfdoc_cc_flags
   CXXFLAGS=$wxpdfdoc_cxx_flags
diff --git a/msw_generic.make b/msw_generic.make
index cc6e680..3eb0d26 100644
--- a/msw_generic.make
+++ b/msw_generic.make
@@ -42,14 +42,14 @@ PERFORM := wine
 
 gcc_bin_dir :=
 
-host_prefix := $(LMI_HOST)-
+host_hyphen := $(LMI_TRIPLET)-
 
-AR      := $(gcc_bin_dir)$(host_prefix)ar
-CC      := $(gcc_bin_dir)$(host_prefix)gcc
-CPP     := $(gcc_bin_dir)$(host_prefix)cpp
-CXX     := $(gcc_bin_dir)$(host_prefix)g++
-LD      := $(gcc_bin_dir)$(host_prefix)g++
-RC      := $(gcc_bin_dir)$(host_prefix)windres
+AR      := $(gcc_bin_dir)$(host_hyphen)ar
+CC      := $(gcc_bin_dir)$(host_hyphen)gcc
+CPP     := $(gcc_bin_dir)$(host_hyphen)cpp
+CXX     := $(gcc_bin_dir)$(host_hyphen)g++
+LD      := $(gcc_bin_dir)$(host_hyphen)g++
+RC      := $(gcc_bin_dir)$(host_hyphen)windres
 
 # Identify run-time libraries for redistribution. See:
 #   https://lists.nongnu.org/archive/html/lmi/2017-05/msg00046.html
@@ -57,7 +57,7 @@ RC      := $(gcc_bin_dir)$(host_prefix)windres
 # option returns an empty string with debian cross compilers.
 #
 # It might seem more robust to write something like
-#   compiler_sysroot := $(shell readlink -fn /usr/lib/gcc/$(LMI_HOST)/*-win32)
+#   compiler_sysroot := $(shell readlink -fn 
/usr/lib/gcc/$(LMI_TRIPLET)/*-win32)
 # but that would actually weaken makefile portability, and there
 # is no guarantee that this directory will be named similarly in
 # future debian releases, much less on other OSs.
diff --git a/nychthemeral_test.sh b/nychthemeral_test.sh
index 645f03e..62c7be8 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -127,7 +127,7 @@ nychthemeral_clutter='
 '
 
 # Directory for test logs.
-log_dir=/tmp/lmi/"$LMI_HOST"/logs
+log_dir=/tmp/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/logs
 mkdir --parents "$log_dir"
 
 {
@@ -147,7 +147,7 @@ printf '\n# cgi and cli tests\n\n'
 make "$coefficiency" --output-sync=recurse cgi_tests cli_tests 2>&1 \
   | tee "$log_dir"/cgi_cli | sed -e "$build_clutter" -e "$cli_cgi_clutter"
 
-if [ "i686-w64-mingw32" = "$LMI_HOST" ]
+if [ "i686-w64-mingw32" = "$LMI_TRIPLET" ]
 then
   printf '\n# system test\n\n'
   make "$coefficiency" system_test 2>&1 \
diff --git a/run.sh b/run.sh
index 79490d2..1c2d967 100755
--- a/run.sh
+++ b/run.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Run a command in an environment consistent with $LMI_HOST.
+# Run a command in an environment consistent with $LMI_COMPILER and 
$LMI_TRIPLET.
 
 # Copyright (C) 2019 Gregory W. Chicares.
 #
diff --git a/set_arch.sh b/set_arch.sh
index acf2326..67ff3ee 100755
--- a/set_arch.sh
+++ b/set_arch.sh
@@ -1,6 +1,6 @@
 #!/bin/sh this-script-must-be-sourced-not-run
 
-# Set $PATH, $WINEPATH, and $PERFORM based on $LMI_HOST.
+# Set $PATH, $WINEPATH, and $PERFORM based on $LMI_HOST. [revise this]
 
 # Copyright (C) 2019 Gregory W. Chicares.
 #
@@ -23,13 +23,13 @@
 
 # What about "$mingw_bin_dir"?
 
-# Invoke as ". ./set_paths.sh" without the quotes.
+# Invoke as ". ./set_arch.sh" without the quotes.
 #
 # $LMI_HOST can be overridden at the command line, e.g.:
-#   LMI_HOST="whatever" . ./set_paths.sh
+#   LMI_HOST="whatever" . ./set_arch.sh
 # That command doesn't alter the value of $LMI_HOST in the environment
 # because there's an obvious alternative that does so:
-#   LMI_HOST="whatever"; . ./set_paths.sh
+#   LMI_HOST="whatever"; . ./set_arch.sh
 #
 # Perhaps $prefix should be similarly overridable.
 #
@@ -43,7 +43,7 @@
 # shellcheck disable=SC2039
 
 # Unimplemented alternative: use symlinks, e.g:
-#   ln --symbolic --force --no-dereference /opt/lmi/"$LMI_HOST"/bin 
/opt/lmi/bin
+#   ln --symbolic --force --no-dereference 
/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/bin /opt/lmi/bin
 # and likewise for /opt/lmi/local etc.
 
 foo()
@@ -52,7 +52,7 @@ local   lmi_build_type
         lmi_build_type=$(/usr/share/libtool/build-aux/config.guess)
 
 local      prefix="/opt/lmi"
-local exec_prefix="$prefix"/"$LMI_HOST"
+local exec_prefix="$prefix"/"${LMI_COMPILER}_${LMI_TRIPLET}"
 local localbindir="$exec_prefix"/local/bin
 local locallibdir="$exec_prefix"/local/lib
 local  winebindir="$prefix"/third_party/bin
@@ -101,16 +101,15 @@ case "$lmi_build_type" in
 esac
 }
 
-case "$LMI_HOST" in
-    (i686-pc-cygwin)     foo ;;
-    (x86_64-pc-cygwin)   foo ;;
+# test compiler similarly
+case "$LMI_TRIPLET" in
     (i686-w64-mingw32)   foo ;;
     (x86_64-w64-mingw32) foo ;;
     (*)
         # This script is to be sourced, so it can't use a builtin
         # command like 'print' here. Similarly, 'exit' would have
         # a surprising effect.
-        echo "Unrecognized host type. Expect surprises."
+        echo "Untested host triplet. Expect surprises."
         ;;
 esac
 
diff --git a/tabs/5/startup_script b/tabs/5/startup_script
index 5100b2f..bc7ed26 100755
--- a/tabs/5/startup_script
+++ b/tabs/5/startup_script
@@ -3,7 +3,7 @@
 a='schroot --chroot=cross-lmi'
 
 b='cd /opt/lmi/bin'
-c='LMI_HOST=i686-w64-mingw32 ; . /opt/lmi/src/lmi/set_arch.sh'
+c='LMI_TRIPLET=i686-w64-mingw32 ; LMI_COMPILER=gcc ; . 
/opt/lmi/src/lmi/set_arch.sh'
 d='wine ./lmi_wx_shared --ash_nazg --data_path=/opt/lmi/data'
 e='/opt/lmi/src/lmi/gui_test.sh'
 
diff --git a/workhorse.make b/workhorse.make
index d24162d..11ac5b3 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -405,7 +405,7 @@ else ifneq (,$(filter $(gcc_version), 7.2.0 7.3.0))
 else ifneq (,$(filter $(gcc_version), 8.1.0 8.2.0 8.3.0))
   gcc_version_specific_warnings := \
 
-  ifeq (x86_64-w64-mingw32,$(findstring x86_64-w64-mingw32,$(LMI_HOST)))
+  ifeq (x86_64-w64-mingw32,$(findstring x86_64-w64-mingw32,$(LMI_TRIPLET)))
 # See:
 #   https://lists.nongnu.org/archive/html/lmi/2019-03/msg00026.html
     tutelary_flag := -fomit-frame-pointer



reply via email to

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