lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 1c736c1 1/4: Add script allowing to install a


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 1c736c1 1/4: Add script allowing to install any wxWidgets version from Git
Date: Fri, 6 Apr 2018 09:37:56 -0400 (EDT)

branch: master
commit 1c736c1a1e988f02f4290bdcba049a912b0948f1
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Add script allowing to install any wxWidgets version from Git
    
    Replace install_wx.make with install_wx.sh which uses Git to get the
    required wxWidgets version directly from the upstream Git repository.
    
    Currently the script uses the same SHA-1 as was used by the makefile
    previously, but wx_commit_sha environment variable can be predefined to
    test installing a different version.
    
    Other configurable option is wx_git_url, which can be set to an existing
    local clone of wxWidgets repository, if any, to make the initial
    checkout faster.
    
    The new script preserves most of the old makefile logic, but wxWidgets
    is not cloned into /opt/lmi/third_party/src/wxWidgets directory instead
    of /opt/lmi/wx-scratch used previously because the contents of this
    directory is preserved, even if the script is run multiple times, so it
    doesn't make sense to call it "scratch" any more.
    
    Also, add /opt/lmi/local/{include,lib} directories to {CPP,LD}FLAGS when
    configuring wxWidgets to allow finding the libraries installed under
    /opt/lmi/local, e.g. liblzma, which will be used by upcoming version of
    wxWidgets.
---
 install_msw.sh  |   2 +-
 install_wx.make | 214 --------------------------------------------------------
 install_wx.sh   | 140 ++++++++++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+), 215 deletions(-)

diff --git a/install_msw.sh b/install_msw.sh
index c8232fd..c197143 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -183,7 +183,7 @@ make $coefficiency --output-sync=recurse -f 
install_miscellanea.make
 
 make $coefficiency --output-sync=recurse -f install_libxml2_libxslt.make
 
-make $coefficiency --output-sync=recurse -f install_wx.make
+./install_wx.sh
 
 make $coefficiency --output-sync=recurse -f install_wxpdfdoc.make
 
diff --git a/install_wx.make b/install_wx.make
deleted file mode 100644
index 7cc9947..0000000
--- a/install_wx.make
+++ /dev/null
@@ -1,214 +0,0 @@
-# Install msw-native wx with options suitable for lmi.
-#
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 
2016, 2017, 2018 Gregory W. Chicares.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-#
-# http://savannah.nongnu.org/projects/lmi
-# email: <address@hidden>
-# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
-
-this_makefile := $(abspath $(lastword $(MAKEFILE_LIST)))
-
-# Configurable settings 
########################################################
-
-mingw_dir     := /MinGW_
-
-prefix        := /opt/lmi/local
-exec_prefix   := $(prefix)
-
-cache_dir     := /cache_for_lmi/downloads
-
-wx_dir        := /opt/lmi/wx-scratch
-
-# git sha1sum and archive md5sum 
###############################################
-
-# Use a string distinct from any official wxwidgets.org release name
-# and from any such string previously used in this makefile.
-
-wx_version        := 3.1.0-p1
-
-# Use a github archive as of a particular commit by specifying its
-# sha1sum--the "latest commit" shown here, for example:
-#   https://github.com/wxWidgets/wxWidgets
-# It is generally useful to retain only the last historical version.
-
-# wx_commit_sha     := 4c0e272589667c7cf57407d99f1810e2e83348e4
-# wx_md5            := 5fd8da132214bb973133d574fde5cbee
-wx_commit_sha     := 41045df7ea5f93e4c07c1bd846d7127a372705bd
-wx_md5            := 89775012799fe5c9bd8ea61e5fa43da7
-
-wx_archive        := wxWidgets-$(wx_commit_sha).zip
-
-$(wx_archive)-md5 := $(wx_md5)
-
-wx_server         := https://github.com/wxWidgets/wxWidgets/archive
-$(wx_archive)-url := $(wx_server)/$(wx_commit_sha).zip
-
-# Variables that normally should be left alone 
#################################
-
-# Specify $(build_type) explicitly, depending on `uname`. It would
-# seem cleaner to deduce it this way:
-#   build_type  := $(shell /path/to/config.guess)
-# but that script is not easy to find. There's a copy in the wx
-# archive, but that hasn't yet been extracted at this point. Debian
-# GNU/Linux provides it in /usr/share/misc/ and recommends:
-#   https://wiki.debian.org/AutoTools/autoconf
-#   "In general you are much better off building against the current
-#   versions of these files than the ones shipped with the tarball"
-# but that directory is not on $PATH . Alternatively, RH provides it
-# in /usr/lib/rpm/redhat/ .
-
-mingw_bin_dir :=
-build_type    := x86_64-unknown-linux-gnu
-host_type     := i686-w64-mingw32
-
-uname := $(shell uname -s 2>/dev/null)
-ifeq (CYGWIN,$(findstring CYGWIN,$(uname)))
-  mingw_bin_dir := $(mingw_dir)/bin/
-  build_type    := i686-pc-cygwin
-  host_type     := i686-w64-mingw32
-endif
-
-compiler       := gcc-$(shell $(mingw_bin_dir)$(host_type)-gcc -dumpversion)
-vendor         := $(subst .,,$(compiler))-$(wx_md5)
-
-source_dir     := $(wx_dir)/wxWidgets-$(wx_version)
-build_dir      := $(source_dir)/$(vendor)
-
-# Configuration reference:
-#   http://lists.nongnu.org/archive/html/lmi/2007-11/msg00001.html
-
-wx_cc_flags    := -fno-omit-frame-pointer
-wx_cxx_flags   := -fno-omit-frame-pointer -std=c++11
-
-config_options = \
-  --prefix=$(prefix) \
-  --exec-prefix=$(exec_prefix) \
-  --build=$(build_type) \
-  --host=$(host_type) \
-  --disable-apple_ieee \
-  --disable-aui \
-  --disable-compat30 \
-  --disable-dependency-tracking \
-  --disable-fswatcher \
-  --disable-gif \
-  --disable-mediactrl \
-  --disable-precomp-headers \
-  --disable-propgrid \
-  --disable-ribbon \
-  --disable-richtext \
-  --disable-stc \
-  --disable-webview \
-  --enable-monolithic \
-  --enable-option-checking \
-  --enable-shared \
-  --enable-stl \
-  --enable-vendor='$(vendor)' \
-  --with-cxx=11 \
-  --without-libjpeg \
-  --without-libtiff \
-  --without-opengl \
-  --without-subdirs \
-  CFLAGS='$(wx_cc_flags)' \
-  CXXFLAGS='$(wx_cxx_flags)' \
-
-# Utilities 
####################################################################
-
-ECHO   := echo
-MD5SUM := md5sum
-MKDIR  := mkdir
-PATCH  := patch
-RM     := rm
-TAR    := tar
-UNZIP  := unzip
-WGET   := wget
-
-# Targets 
######################################################################
-
-source_archives := $(wx_archive)
-patchset        := wx-$(wx_version).patch
-PATCHFLAGS      := --directory=$(source_dir) --strip=1
-
-.PHONY: all
-all: clobber_exec_prefix_only $(source_archives)
-       [ ! -e $(patchset) ] || $(PATCH) $(PATCHFLAGS) <$(patchset)
-       $(MKDIR) --parents $(build_dir)
-       $(MAKE) --file=$(this_makefile) --directory=$(build_dir) wx
-
-# Simulated order-only prerequisites.
-$(source_archives): initial_setup
-initial_setup: clobber_exec_prefix_only
-
-.PHONY: initial_setup
-initial_setup:
-       $(MKDIR) --parents $(prefix)
-       $(MKDIR) --parents $(exec_prefix)
-       $(MKDIR) --parents $(cache_dir)
-       $(MKDIR) --parents $(wx_dir)
-
-TARFLAGS := --keep-old-files
-%.tar.bz2: TARFLAGS += --bzip2
-%.tar.gz:  TARFLAGS += --gzip
-
-UNZIPFLAGS := -q
-
-WGETFLAGS :=
-
-.PHONY: %.tar.bz2 %.tar.gz
-%.tar.bz2 %.tar.gz:
-       cd $(cache_dir) && [ -e $@ ] || $(WGET) $(WGETFLAGS) $(address@hidden)
-       cd $(cache_dir) && $(ECHO) "$(address@hidden) *$@" | $(MD5SUM) --check
-       -$(TAR) --extract $(TARFLAGS) --directory=$(wx_dir) 
--file=$(cache_dir)/$@
-
-# Used only for retrieval from github by sha1sum.
-#
-# This archive is dynamically created by github, as of a commit
-# specified by the sha1sum embedded in the URL. Not being a static
-# file, it doesn't bear a historical timestamp corresponding to the
-# commit date--see:
-#   http://lists.nongnu.org/archive/html/lmi/2015-08/msg00012.html
-# By default, the cached archive's name would be just the sha1sum plus
-# a '.zip' extension, which does not obviously have anything to do
-# with wx, so use '--output-document' to prepend "wxWidgets-" to its
-# name (while this is not that option's intended purpose, it does the
-# right thing in this case). The resulting filename is appropriate for
-# caching, but the name of the directory into which it extracts is
-# inconvenient for actual use, so rename that directory immediately.
-
-%.zip: WGETFLAGS += '--output-document=$@'
-
-.PHONY: %.zip
-%.zip:
-       cd $(cache_dir) && [ -e $@ ] || $(WGET) $(WGETFLAGS) $(address@hidden)
-       cd $(cache_dir) && $(ECHO) "$(address@hidden) *$@" | $(MD5SUM) --check
-       -$(UNZIP) $(UNZIPFLAGS) $(cache_dir)/$@ -d $(wx_dir)
-       cp -a $(wx_dir)/$(basename $@) $(source_dir)
-
-.PHONY: wx
-wx:
-       export PATH="$(mingw_bin_dir):${PATH}" \
-         && ../configure $(config_options) && $(MAKE) && $(MAKE) install \
-
-# This incidentally removes wxPdfDoc, but it's probably a good idea
-# to rebuild that whenever wx is upgraded anyway.
-
-.PHONY: clobber_exec_prefix_only
-clobber_exec_prefix_only:
-       -$(RM) --force --recursive $(exec_prefix)/bin/wx*
-       -$(RM) --force --recursive $(exec_prefix)/include/wx*
-       -$(RM) --force --recursive $(exec_prefix)/lib/wx*
-       -$(RM) --force --recursive $(exec_prefix)/lib/libwx*
-       -$(RM) --force --recursive $(wx_dir)
-
diff --git a/install_wx.sh b/install_wx.sh
new file mode 100755
index 0000000..a044560
--- /dev/null
+++ b/install_wx.sh
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+# Install msw-native wx with options suitable for lmi.
+#
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 
2016, 2017, 2018 Gregory W. Chicares.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# http://savannah.nongnu.org/projects/lmi
+# email: <address@hidden>
+# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+# Configurable settings 
########################################################
+
+wx_git_url=${wx_git_url:-https://github.com/wxWidgets/wxWidgets.git}
+
+wx_commit_sha=${wx_commit_sha:-41045df7ea5f93e4c07c1bd846d7127a372705bd}
+
+coefficiency=${coefficiency:---jobs=4}
+MAKE=${MAKE:-make $coefficiency}
+
+# Variables that normally should be left alone 
#################################
+
+mingw_dir=/MinGW_
+
+prefix=/opt/lmi/local
+exec_prefix=${prefix}
+
+wx_dir=/opt/lmi/third_party/src/wxWidgets
+
+# Script commands 
##############################################################
+
+set -e
+
+if [ ! -d $wx_dir ]
+then
+    wx_dir_parent=${wx_dir%/*}
+    [ -d $wx_dir_parent ] || mkdir -p $wx_dir_parent
+    cd $wx_dir_parent
+    git clone $wx_git_url ${wx_dir##*/}
+    cd $wx_dir
+else
+    cd $wx_dir
+    git rev-parse --quiet --verify "$wx_commit_sha^{commit}" >/dev/null || git 
fetch $wx_git_url
+fi
+
+if [ `git rev-parse HEAD` != $wx_commit_sha ]
+then
+    git checkout $wx_commit_sha
+    git submodule update --init
+fi
+
+[ "$wx_skip_clean" = 1 ] || git clean -dfx
+
+# This incidentally removes wxPdfDoc, but it's a good idea to rebuild that
+# whenever wx is upgraded anyway.
+rm --force --recursive $exec_prefix/bin/wx*
+rm --force --recursive $exec_prefix/include/wx*
+rm --force --recursive $exec_prefix/lib/wx*
+rm --force --recursive $exec_prefix/lib/libwx*
+
+build_type=`$wx_dir/config.guess`
+host_type=i686-w64-mingw32
+
+case `uname` in
+    CYGWIN*)
+        mingw_bin_dir=$mingw_dir/bin/
+        ;;
+esac
+
+# Construct a vendor string for this build using the compiler name and version
+# and the unique commit SHA-1.
+gcc_version=`${mingw_bin_dir}${host_type}-gcc -dumpversion|tr -d '.\r'`
+vendor=gcc-$gcc_version-$wx_commit_sha
+
+build_dir=$wx_dir/lmi-gcc-$gcc_version
+mkdir -p $build_dir
+
+# Configuration reference:
+#   http://lists.nongnu.org/archive/html/lmi/2007-11/msg00001.html
+
+wx_cc_flags=-fno-omit-frame-pointer
+wx_cxx_flags=$wx_cc_flags
+
+config_options="
+  --prefix=$prefix
+  --exec-prefix=$exec_prefix
+  --build=$build_type
+  --host=$host_type
+  --disable-apple_ieee
+  --disable-aui
+  --disable-compat30
+  --disable-dependency-tracking
+  --disable-fswatcher
+  --disable-gif
+  --disable-mediactrl
+  --disable-precomp-headers
+  --disable-propgrid
+  --disable-ribbon
+  --disable-richtext
+  --disable-stc
+  --disable-webview
+  --enable-monolithic
+  --enable-option-checking
+  --enable-shared
+  --enable-stl
+  --enable-vendor=$vendor
+  --with-cxx=11
+  --with-expat=builtin
+  --with-libpng=builtin
+  --with-zlib=builtin
+  --without-libjpeg
+  --without-libtiff
+  --without-opengl
+  --without-subdirs
+  CPPFLAGS=-I$prefix/include
+  CFLAGS=$wx_cc_flags
+  CXXFLAGS=$wx_cxx_flags
+  LDFLAGS=-L$exec_prefix/lib
+"
+
+[ -n $mingw_bin_dir ] && export PATH="$mingw_bin_dir:${PATH}"
+
+cd $build_dir
+../configure $config_options
+$MAKE
+$MAKE install
+
+exit 0



reply via email to

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