From c9c6e63472701017041e66d3eeb2d750b1aafb32 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 16 Feb 2016 15:07:31 +0100 Subject: distribution helper script: let it be preprocessed/substituted by Autoconf * makes sense since it already extracted information from ./configure that is usually substituted. * it already had to be run from a configured build directory * it required the source tree directory, which had to be overwritten on the Make command line when using an out-of-source build dir. This is no longer necessary. * It is still a stand-alone Makefile to keep it isolated from the main build system, although it could certainly be translated to Automake. * the generated file will now be called distribute.mk to signify that it is a Makefile. --- .gitignore | 1 + configure.ac | 2 +- distribute | 142 ----------------------------------------------------- distribute.mk.in | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 147 insertions(+), 143 deletions(-) delete mode 100755 distribute create mode 100644 distribute.mk.in diff --git a/.gitignore b/.gitignore index 185dd0b..39983d8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ Makefile Makefile.in stamp-* +/distribute.mk # Autotest /tests/package.m4 diff --git a/configure.ac b/configure.ac index 4d17cf9..033b244 100644 --- a/configure.ac +++ b/configure.ac @@ -339,7 +339,7 @@ AC_ARG_ENABLE(static-executables, [static_executables=$enableval], [static_executables=no]) AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile distribute.mk]) AC_CONFIG_FILES([src/Makefile src/interface-gtk/Makefile src/interface-curses/Makefile]) AC_CONFIG_FILES([lib/Makefile]) AC_CONFIG_FILES([doc/Makefile doc/Doxyfile]) diff --git a/distribute b/distribute deleted file mode 100755 index 5b2e3d4..0000000 --- a/distribute +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/make -f - -# Overwrite, if building out-of-tree. -SRCDIR=. -ABS_SRCDIR=$(abspath $(SRCDIR)) - -# Try to extract version from ./configure -SCITECO_VERSION = $(shell $(SRCDIR)/configure --version | \ - sed -n 's/SciTECO configure //p') - -SCITECO_SRC = sciteco-$(SCITECO_VERSION).tar.gz - -$(SCITECO_SRC): - $(MAKE) dist - -all : $(SCITECO_SRC) debian mingw-binary - -# $(UBUNTU) sets the Ubuntu distribution and fixes the package's -# version -debian-prepare: debian-temp/ -.PHONY: debian-temp/ -debian-temp/ : $(SCITECO_SRC) - rm -rf debian-temp/ - mkdir debian-temp/ - (cd debian-temp/; \ - cp ../$(SCITECO_SRC) \ - sciteco_$(SCITECO_VERSION).orig.tar.gz; \ - tar xzf sciteco_$(SCITECO_VERSION).orig.tar.gz; \ - cp -r $(ABS_SRCDIR)/debian sciteco-$(SCITECO_VERSION)/; \ - ) -ifneq ($(UBUNTU),) - sciteco -e "@EB|debian-temp/sciteco-$(SCITECO_VERSION)/debian/changelog| \ - <@FS/ unstable;/ $(UBUNTU);/; -@S/)/R @I/ppa1~$(UBUNTU)1/ L> \ - @EW||" -endif - -SIGN ?= no -ifeq ($(SIGN),yes) -DEBUILD_FLAGS := -else -DEBUILD_FLAGS := -us -uc -endif - -# Whether to upload upstream sources (dist tarball) to the PPA -# This must be YES for new releases. -# It must be NO after the tarball has been -# uploaded once, else launchpad refuses -# building the source package. -# Launchpad will also refuse new versions of the -# tar ball for the same release, so the tarball -# should NOT be cleaned when uploading for multiple -# Ubuntu versions. -# If a bug is found only during PPA building, -# the upstream version must be increased since we -# cannot upload a new tarball and adding patches to the -# Debian package would be idiotic :-( -UPLOAD_SRC ?= yes -ifeq ($(UPLOAD_SRC),yes) -DEBUILD_FLAGS += -sa -else -DEBUILD_FLAGS += -sd -endif - -debian-source : debian-temp/source-stamp -debian-temp/source-stamp : debian-prepare - (cd debian-temp/sciteco-$(SCITECO_VERSION)/; \ - debuild -S $(DEBUILD_FLAGS); \ - ) - touch $@ - -debian-binary : debian-temp/binary-stamp -debian-temp/binary-stamp : debian-prepare - (cd debian-temp/sciteco-$(SCITECO_VERSION)/; \ - debuild -b $(DEBUILD_FLAGS); \ - ) - touch $@ - -debian : debian-source debian-binary - -ppa : debian-source - (cd debian-temp/; \ - dput ppa:robin-haberkorn/sciteco *.changes; \ - ) - -# Create Windows release. -# Assumes a correctly installed glib (with pkgconfig script) -# and static linking of all dependant libraries (no DLLs are -# added to the zip). -# If a win32.teco_ini exists, it is added to the release -# instead of sample.teco_ini. -# This also adds gspawn-win32-helper-console.exe to the archive -# which is required by the glib spawn functions. -# If we ever build a non-console version on Windows, -# we should include gspawn-win32-helper.exe instead. -# -# When linking in PDCurses/win32a statically, the -# environment variable PDCURSES_LIBS should be set to -# "-lpdcurses -lgdi32 -lcomdlg32" -MINGW_UI=pdcurses - -mingw-binary : sciteco-$(SCITECO_VERSION)-win32.zip -sciteco-$(SCITECO_VERSION)-win32.zip : $(SCITECO_SRC) - tar xzf $(SCITECO_SRC) - (cd sciteco-$(SCITECO_VERSION); \ - PKG_CONFIG=i686-w64-mingw32-pkg-config \ - PKG_CONFIG_LIBDIR=/usr/i686-w64-mingw32/lib/pkgconfig \ - ./configure --host=i686-w64-mingw32 build=i386-pc-linux-gnu \ - --prefix=/usr \ - --enable-static-executables \ - --disable-dependency-tracking \ - --with-interface=$(MINGW_UI) \ - --disable-bootstrap \ - --enable-html-manual \ - CFLAGS="-g -O3 -flto" CXXFLAGS="-g -O3 -flto" \ - LDFLAGS="-flto"; \ - ) - $(MAKE) -C sciteco-$(SCITECO_VERSION) \ - install-strip DESTDIR=`pwd`/temp-install - rm -rf sciteco-$(SCITECO_VERSION)/ - mkdir temp-bin/ - cp -r temp-install/usr/bin/* temp-install/usr/share/sciteco/* \ - temp-install/usr/share/doc/sciteco/* \ - temp-bin/ - cp $(SRCDIR)/win32.teco_ini temp-bin/.teco_ini || \ - cp temp-install/usr/share/sciteco/sample.teco_ini \ - temp-bin/.teco_ini - cp $(SRCDIR)/COPYING $(SRCDIR)/ChangeLog temp-bin/ - rm -rf temp-install/ -# cp /usr/i686-w64-mingw32/bin/intl.dll \ -# /usr/i686-w64-mingw32/bin/libglib-2.0-0.dll \ -# /usr/i686-w64-mingw32/bin/pdcurses.dll \ -# temp-bin/ - cp /usr/i686-w64-mingw32/bin/gspawn-win32-helper-console.exe \ - temp-bin/ - i686-w64-mingw32-strip -s temp-bin/gspawn-win32-helper-console.exe - cd temp-bin/; zip -r ../$@ . - rm -rf temp-bin/ - -clean: - rm -rf $(SCITECO_SRC) - rm -rf debian-temp/ - rm -rf sciteco-$(SCITECO_VERSION)/ diff --git a/distribute.mk.in b/distribute.mk.in new file mode 100644 index 0000000..18e0fe6 --- /dev/null +++ b/distribute.mk.in @@ -0,0 +1,145 @@ +#!/usr/bin/make -f +# This is a Makefile "script" that aids in creating +# releases of SciTECO. +# It is probably of little help to ordinary users. +# It is not part of the normal build process. +# Since we need the source tarball and other files +# from the source tree, this script is substituted +# by ./configure and must thus be run from some configured +# build directory. + +# Distribution tarball +SCITECO_SRC = @PACKAGE@-@VERSION@.tar.gz +# Directory name in $(SCITECO_SRC) +SCITECO_DIR = @PACKAGE@-@VERSION@ + +$(SCITECO_SRC): + $(MAKE) dist + +all : $(SCITECO_SRC) debian mingw-binary + +# $(UBUNTU) sets the Ubuntu distribution and fixes the package's +# version +debian-prepare: debian-temp/ +.PHONY: debian-temp/ +debian-temp/ : $(SCITECO_SRC) + rm -rf debian-temp/ + mkdir debian-temp/ + (cd debian-temp/; \ + cp ../$(SCITECO_SRC) \ + sciteco_@PACKAGE_VERSION@.orig.tar.gz; \ + tar xzf sciteco_@PACKAGE_VERSION@.orig.tar.gz; \ + cp -r @abs_srcdir@/debian $(SCITECO_DIR)/; \ + ) +ifneq ($(UBUNTU),) + sciteco -e "@EB|debian-temp/$(SCITECO_DIR)/debian/changelog| \ + <@FS/ unstable;/ $(UBUNTU);/; -@S/)/R @I/ppa1~$(UBUNTU)1/ L> \ + @EW||" +endif + +SIGN ?= no +ifeq ($(SIGN),yes) +DEBUILD_FLAGS := +else +DEBUILD_FLAGS := -us -uc +endif + +# Whether to upload upstream sources (dist tarball) to the PPA +# This must be YES for new releases. +# It must be NO after the tarball has been +# uploaded once, else launchpad refuses +# building the source package. +# Launchpad will also refuse new versions of the +# tar ball for the same release, so the tarball +# should NOT be cleaned when uploading for multiple +# Ubuntu versions. +# If a bug is found only during PPA building, +# the upstream version must be increased since we +# cannot upload a new tarball and adding patches to the +# Debian package would be idiotic :-( +UPLOAD_SRC ?= yes +ifeq ($(UPLOAD_SRC),yes) +DEBUILD_FLAGS += -sa +else +DEBUILD_FLAGS += -sd +endif + +debian-source : debian-temp/source-stamp +debian-temp/source-stamp : debian-prepare + (cd debian-temp/$(SCITECO_DIR)/; \ + debuild -S $(DEBUILD_FLAGS); \ + ) + touch $@ + +debian-binary : debian-temp/binary-stamp +debian-temp/binary-stamp : debian-prepare + (cd debian-temp/$(SCITECO_DIR)/; \ + debuild -b $(DEBUILD_FLAGS); \ + ) + touch $@ + +debian : debian-source debian-binary + +ppa : debian-source + (cd debian-temp/; \ + dput ppa:robin-haberkorn/sciteco *.changes; \ + ) + +# Create Windows release. +# Assumes a correctly installed glib (with pkgconfig script) +# and static linking of all dependant libraries (no DLLs are +# added to the zip). +# If a win32.teco_ini exists, it is added to the release +# instead of sample.teco_ini. +# This also adds gspawn-win32-helper-console.exe to the archive +# which is required by the glib spawn functions. +# If we ever build a non-console version on Windows, +# we should include gspawn-win32-helper.exe instead. +# +# When linking in PDCurses/win32a statically, the +# environment variable PDCURSES_LIBS should be set to +# "-lpdcurses -lgdi32 -lcomdlg32" +MINGW_UI=pdcurses + +mingw-binary : @PACKAGE@-@PACKAGE_VERSION@-win32.zip +@PACKAGE@-@PACKAGE_VERSION@-win32.zip : $(SCITECO_SRC) + tar xzf $(SCITECO_SRC) + (cd $(SCITECO_DIR); \ + PKG_CONFIG=i686-w64-mingw32-pkg-config \ + PKG_CONFIG_LIBDIR=/usr/i686-w64-mingw32/lib/pkgconfig \ + ./configure --host=i686-w64-mingw32 build=i386-pc-linux-gnu \ + --prefix=/usr \ + --enable-static-executables \ + --disable-dependency-tracking \ + --with-interface=$(MINGW_UI) \ + --disable-bootstrap \ + --enable-html-manual \ + CFLAGS="-g -O3 -flto" CXXFLAGS="-g -O3 -flto" \ + LDFLAGS="-flto"; \ + ) + $(MAKE) -C $(SCITECO_DIR) \ + install-strip DESTDIR=`pwd`/temp-install + rm -rf $(SCITECO_DIR)/ + mkdir temp-bin/ + cp -r temp-install/usr/bin/* temp-install/usr/share/sciteco/* \ + temp-install/usr/share/doc/sciteco/* \ + temp-bin/ + cp @srcdir@/win32.teco_ini temp-bin/.teco_ini || \ + cp temp-install/usr/share/sciteco/sample.teco_ini \ + temp-bin/.teco_ini + cp @srcdir@/COPYING @srcdir@/ChangeLog temp-bin/ + rm -rf temp-install/ +# cp /usr/i686-w64-mingw32/bin/intl.dll \ +# /usr/i686-w64-mingw32/bin/libglib-2.0-0.dll \ +# /usr/i686-w64-mingw32/bin/pdcurses.dll \ +# temp-bin/ + cp /usr/i686-w64-mingw32/bin/gspawn-win32-helper-console.exe \ + temp-bin/ + i686-w64-mingw32-strip -s temp-bin/gspawn-win32-helper-console.exe + cd temp-bin/; zip -r ../$@ . + rm -rf temp-bin/ + +clean: + rm -rf $(SCITECO_SRC) + rm -rf debian-temp/ + rm -rf $(SCITECO_DIR)/ -- cgit v1.2.3