lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 046aece 2/2: Support multiple architectures a


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 046aece 2/2: Support multiple architectures and (theoretically) compilers
Date: Sun, 28 Apr 2019 22:52:20 -0400 (EDT)

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

    Support multiple architectures and (theoretically) compilers
    
    Replaced old $LMI_HOST with new environment variables $LMI_COMPILER and
    $LMI_TRIPLET, using $LMI_TRIPLET as a '--build' argument and a compiler
    prefix, and "${LMI_COMPILER}_${LMI_TRIPLET}" as a component of paths.
    Similarly replaced $host_type in some scripts and makefiles. Replaced
    $(toolset) with $LMI_COMPILER everywhere.
    
    Made 'make install' copy all the binaries lmi requires to /opt/lmi/bin
    regardless of $LMI_COMPILER and $LMI_TRIPLET, upon which the directories
    for object files, libraries, and logs in /tmp/ now depend.
    
    Added an 'eviscerate' target, severer than 'clobber', which is useful
    for removing all files (including libraries) that are recreated by
    running 'install_msw.sh'.
    
    In 'gwc/.zshrc', set only a minimal $PATH, and removed $WINEPATH. Set
    $PATH in 'GNUmakefile', and $WINEPATH in 'msw_generic.make', to support
    running lmi binaries from the build directory (as some tests do).
---
 GNUmakefile                  | 38 +++++++++++++++++++++++++-------------
 bcc_5_5_1.make               |  4 ++--
 como.make                    |  4 ++--
 configuration.make           |  2 +-
 gui_test.sh                  |  2 +-
 gwc/.zshrc                   |  6 ++----
 install_libxml2_libxslt.make | 18 ++++++++++++------
 install_msw.sh               | 11 +++++++----
 install_wx.sh                | 11 ++++++-----
 install_wxpdfdoc.sh          |  7 ++++---
 msw_generic.make             | 23 +++++++++++++++--------
 nychthemeral_test.sh         |  4 ++--
 workhorse.make               |  6 +++---
 13 files changed, 82 insertions(+), 54 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index eda3540..21188b0 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -84,11 +84,14 @@ MAKEFLAGS := \
 # more closely, changing the value of $(datadir), and perhaps using
 # some other standard directories that are commented out for now.
 
+LMI_COMPILER ?= gcc
+LMI_TRIPLET  ?= i686-w64-mingw32
+
 prefix          := /opt/lmi
 # parent directory for machine-specific binaries
-exec_prefix     := $(prefix)
+exec_prefix     := $(prefix)/$(LMI_COMPILER)_$(LMI_TRIPLET)
 # binaries that users can run
-bindir          := $(exec_prefix)/bin
+bindir          := $(prefix)/bin
 # binaries that administrators can run
 #sbindir         := $(exec_prefix)/sbin
 # binaries run by programs
@@ -121,8 +124,9 @@ srcdir          := $(CURDIR)
 localbindir     := $(exec_prefix)/local/bin
 locallibdir     := $(exec_prefix)/local/lib
 localincludedir := $(exec_prefix)/local/include
-test_dir        := $(exec_prefix)/test
-touchstone_dir  := $(exec_prefix)/touchstone
+winebindir      := $(prefix)/third_party/bin
+test_dir        := $(prefix)/test
+touchstone_dir  := $(prefix)/touchstone
 
 
################################################################################
 
@@ -172,8 +176,7 @@ $(srcdir)/local_options.make:: ;
 # the make command line. Of course, other build types may be defined.
 
 build_type ?= ship
-toolchain ?= gcc
-build_dir := $(exec_prefix)/$(toolchain)/build/$(build_type)
+build_dir := $(exec_prefix)/build/$(build_type)
 
 gpl_files := \
   COPYING \
@@ -185,6 +188,8 @@ gpl_files := \
 # the 'make' command line to override any definition of the same
 # variable in $(local_options).
 
+export PATH := $(localbindir):$(locallibdir):$(PATH)
+
 MAKETARGET = \
   $(MAKE) \
     --directory=$@ \
@@ -205,7 +210,8 @@ MAKETARGET = \
                  localincludedir='$(localincludedir)' \
                         test_dir='$(test_dir)' \
                   touchstone_dir='$(touchstone_dir)' \
-                       toolchain='$(toolchain)' \
+                    LMI_COMPILER='$(LMI_COMPILER)' \
+                     LMI_TRIPLET='$(LMI_TRIPLET)' \
                       build_type='$(build_type)' \
                USE_SO_ATTRIBUTES='$(USE_SO_ATTRIBUTES)' \
                     yyyymmddhhmm='$(yyyymmddhhmm)' \
@@ -342,23 +348,29 @@ distclean mostlyclean maintainer-clean: clean
 # targets more clearly. To use an alternative like
 #   rm -rf $(build_dir)/../..
 # would be to invite disaster.
-ifneq ($(build_dir),$(exec_prefix)/$(toolchain)/build/$(build_type))
+ifneq ($(build_dir),$(exec_prefix)/build/$(build_type))
   $(error Assertion failure: build directory misconfigured)
 endif
 
 .PHONY: clean
 clean: source_clean
-       -$(RM) --force --recursive 
$(exec_prefix)/$(toolchain)/build/$(build_type)
+       -$(RM) --force --recursive $(exec_prefix)/build/$(build_type)
 
 .PHONY: clobber
 clobber: source_clean
-       -$(RM) --force --recursive $(exec_prefix)/$(toolchain)/build
+       -$(RM) --force --recursive $(exec_prefix)/build
 
 .PHONY: raze
-raze: clobber
-       -$(RM) --force --recursive $(prefix)/*ad_hoc*
-       -$(RM) --force --recursive $(prefix)/local
+raze: source_clean
+       -$(RM) --force --recursive $(exec_prefix)
+
+.PHONY: eviscerate
+eviscerate: source_clean
+       -$(RM) --force --recursive $(bindir)
        -$(RM) --force --recursive $(prefix)/third_party
+       -$(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/bcc_5_5_1.make b/bcc_5_5_1.make
index 60d481c..2d0cf0b 100644
--- a/bcc_5_5_1.make
+++ b/bcc_5_5_1.make
@@ -19,7 +19,7 @@
 # email: <address@hidden>
 # snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 
-toolchain    := bcc
+LMI_COMPILER := bcc
 
 srcdir       := $(CURDIR)
 
@@ -239,7 +239,7 @@ bcc_5_5_1.make:: ;
          --file=$(srcdir)/GNUmakefile \
          --jobs=1 \
                                     srcdir='$(srcdir)' \
-                                 toolchain='$(toolchain)' \
+                              LMI_COMPILER='$(LMI_COMPILER)' \
                                gcc_version='$(gcc_version)' \
                                 C_WARNINGS='$(C_WARNINGS)' \
                               CXX_WARNINGS='$(CXX_WARNINGS)' \
diff --git a/como.make b/como.make
index 619d3fc..8cc9463 100644
--- a/como.make
+++ b/como.make
@@ -33,7 +33,7 @@
 # Cf.:
 # http://www-d0.fnal.gov/KAI/doc/UserGuide/faq.html#multiple_template_instance
 
-toolchain    := como
+LMI_COMPILER := como
 
 srcdir       := $(CURDIR)
 
@@ -222,7 +222,7 @@ CXX := \
          --jobs=1 \
                                gcc_version='$(gcc_version)' \
                                     srcdir='$(srcdir)' \
-                                 toolchain='$(toolchain)' \
+                              LMI_COMPILER='$(LMI_COMPILER)' \
                                 C_WARNINGS='$(C_WARNINGS)' \
                               CXX_WARNINGS='$(CXX_WARNINGS)' \
                           C_EXTRA_WARNINGS='$(C_EXTRA_WARNINGS)' \
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 c165ad7..fab1d3c 100755
--- a/gui_test.sh
+++ b/gui_test.sh
@@ -138,7 +138,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 4492638..4a35a4a 100644
--- a/gwc/.zshrc
+++ b/gwc/.zshrc
@@ -1,13 +1,11 @@
 # Personal configuration for cross-building in a chroot.
 
-export 
WINEPATH='Z:\\opt\\lmi\\local\\bin;Z:\\opt\\lmi\\local\\lib;Z:\\opt\\lmi\\third_party\\bin'
-export LMI_HOST=i686-w64-mingw32
+export LMI_COMPILER=gcc
+export LMI_TRIPLET=i686-w64-mingw32
 
 # Minimal system path.
 export MINIMAL_PATH="/usr/bin:/bin:/usr/sbin:/sbin"
 export PATH="$MINIMAL_PATH"
-# For the nonce, still do this:
-export PATH="/opt/lmi/local/bin:/opt/lmi/local/lib:$PATH"
 
 # At a regular user prompt, outside the chroot, do this:
 #   $ echo $DISPLAY
diff --git a/install_libxml2_libxslt.make b/install_libxml2_libxslt.make
index 39e9ca5..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/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 e1b5517..244d05f 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -195,9 +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.
-export LMI_HOST
-for LMI_HOST in i686-w64-mingw32 ;
+# 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_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
 
@@ -206,7 +209,7 @@ do
 
     find /cache_for_lmi/downloads -type f | xargs md5sum
 
-    export PATH=/opt/lmi/local/bin:/opt/lmi/local/lib:$minimal_path
+    export 
PATH=/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/local/bin:/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/local/lib:$minimal_path
 
     make $coefficiency --output-sync=recurse wx_config_check
     make $coefficiency --output-sync=recurse show_flags
diff --git a/install_wx.sh b/install_wx.sh
index a2626a3..13f0da7 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/local
+prefix=/opt/lmi/"${LMI_COMPILER}_${LMI_TRIPLET}"/local
 exec_prefix="$prefix"
 
 repo_name="wxWidgets"
@@ -88,8 +89,8 @@ 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
+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 +102,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 d01ed40..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/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..671e046 100644
--- a/msw_generic.make
+++ b/msw_generic.make
@@ -33,6 +33,13 @@ system_root := /
 
 PERFORM := wine
 
+# $(winebindir) is where 'install_miscellanea.make' places 'md5sum.exe'.
+
+w0 := $(shell winepath -w $(localbindir) | sed -e's/\\/\\\\/g')
+w1 := $(shell winepath -w $(locallibdir) | sed -e's/\\/\\\\/g')
+w2 := $(shell winepath -w $(winebindir)  | sed -e's/\\/\\\\/g')
+export WINEPATH=$(w0);$(w1);$(w2)
+
 
################################################################################
 
 # Compiler, linker, and so on.
@@ -42,14 +49,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 +64,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 acd2be3..8c4fb90 100755
--- a/nychthemeral_test.sh
+++ b/nychthemeral_test.sh
@@ -135,7 +135,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"
 
 {
@@ -155,7 +155,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/workhorse.make b/workhorse.make
index d24162d..ce1fd82 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -131,7 +131,7 @@ effective_default_target: $(default_targets)
 # $(subst): workaround for debian, whose MinGW-w64 identifies its
 # version 7.x.0 as "7.x-win32".
 
-ifeq (gcc,$(toolchain))
+ifeq (gcc,$(LMI_COMPILER))
   gcc_version   := $(subst -win32,.0,$(shell $(CXX)     -dumpversion))
 endif
 
@@ -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
@@ -678,7 +678,7 @@ CXX_WARNINGS = \
 # speed penalty that can be overcome by increasing parallelism. There
 # seems to be no need for them with gcc-4.x, which uses less RAM.
 
-ifeq (gcc,$(toolchain))
+ifeq (gcc,$(LMI_COMPILER))
   ifeq (3.4.5,$(gcc_version))
     ggc_flags := --param ggc-min-expand=25 --param ggc-min-heapsize=32768
   endif



reply via email to

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