From 27ffd10c5dfc4a7b4b042529b2bcbad16e72e4f1 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Thu, 26 Oct 2017 17:29:23 +1100 Subject: glib: refactor native tools fixes #1934 The method of symlinks to native tools fails when glib versions drift too far apart - the obvious solution would be to update more frequently, but glib (and downstream friends) are always difficult to update. This set of changes: - always builds tools on linux - builds tools only once - uses pre-built packages for darwin - is untested on freebsd --- docs/index.html | 2 +- plugins/native/darwin/glib2-macports.mk | 1 + plugins/native/gettext.mk | 15 ----- plugins/native/glib2-macports.mk | 22 +++++++ plugins/native/jessie/gettext.mk | 1 - plugins/native/jessie/libiconv.mk | 1 - plugins/native/libiconv.mk | 14 ----- plugins/native/trusty/gettext.mk | 1 - plugins/native/trusty/libiconv.mk | 1 - plugins/native/wheezy/gettext.mk | 1 - plugins/native/wheezy/libiconv.mk | 1 - src/gettext.mk | 13 ++-- src/glib.mk | 104 ++++++++++++++------------------ src/libiconv.mk | 13 ++-- src/zlib.mk | 3 +- 15 files changed, 87 insertions(+), 106 deletions(-) create mode 120000 plugins/native/darwin/glib2-macports.mk delete mode 100644 plugins/native/gettext.mk create mode 100644 plugins/native/glib2-macports.mk delete mode 120000 plugins/native/jessie/gettext.mk delete mode 120000 plugins/native/jessie/libiconv.mk delete mode 100644 plugins/native/libiconv.mk delete mode 120000 plugins/native/trusty/gettext.mk delete mode 120000 plugins/native/trusty/libiconv.mk delete mode 120000 plugins/native/wheezy/gettext.mk delete mode 120000 plugins/native/wheezy/libiconv.mk diff --git a/docs/index.html b/docs/index.html index fc24ab5..087b66f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -811,7 +811,7 @@ USE_OSGPLUGIN(<plugin2>)
sudo port install \
     autoconf automake bison coreutils flex gettext \
-    gdk-pixbuf2 glib2 gnutar gsed intltool libffi libtool \
+    gdk-pixbuf2 gnutar gsed intltool libffi libtool \
     openssl p5-xml-parser p7zip pkgconfig scons wget xz
Method 2 - Rudix
diff --git a/plugins/native/darwin/glib2-macports.mk b/plugins/native/darwin/glib2-macports.mk new file mode 120000 index 0000000..da39c4a --- /dev/null +++ b/plugins/native/darwin/glib2-macports.mk @@ -0,0 +1 @@ +../glib2-macports.mk \ No newline at end of file diff --git a/plugins/native/gettext.mk b/plugins/native/gettext.mk deleted file mode 100644 index ea6edcb..0000000 --- a/plugins/native/gettext.mk +++ /dev/null @@ -1,15 +0,0 @@ -# This file is part of MXE. See LICENSE.md for licensing information. - -PKG := gettext -$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) -$(PKG)_DEPS_$(BUILD) := libiconv - -define $(PKG)_BUILD_$(BUILD) - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)/$(TARGET)' \ - --disable-shared \ - --with-included-libxml - $(MAKE) -C '$(1).build' -j '$(JOBS)' man1_MANS= - $(MAKE) -C '$(1).build' -j 1 install man1_MANS= -endef diff --git a/plugins/native/glib2-macports.mk b/plugins/native/glib2-macports.mk new file mode 100644 index 0000000..536fd00 --- /dev/null +++ b/plugins/native/glib2-macports.mk @@ -0,0 +1,22 @@ +# This file is part of MXE. See LICENSE.md for licensing information. + +PKG := glib2-macports +$(PKG)_WEBSITE := packages.macports.org +$(PKG)_DESCR := glib2 pre-built macports package +$(PKG)_IGNORE := +$(PKG)_VERSION := 2.50.3 +$(PKG)_CHECKSUM := b7327d69c8a32d2f4ec4e885c0de189618ca6cd54999c62d1de5d37d78c515cd +$(PKG)_SUBDIR := . +$(PKG)_FILE := glib2-$($(PKG)_VERSION)_0.darwin_16.x86_64.tbz2 +$(PKG)_URL := https://packages.macports.org/glib2/glib2-$($(PKG)_VERSION)_0.darwin_16.x86_64.tbz2 +$(PKG)_DEPS := +$(PKG)_TARGETS := $(BUILD) + +glib_DEPS_$(BUILD) := $(PKG) +gettext_BUILD_$(BUILD) := +libiconv_BUILD_$(BUILD) := + +define $(PKG)_UPDATE + echo 'manually update glib2-macports as necessary' >&2; + echo $(glib2-macports_VERSION) +endef diff --git a/plugins/native/jessie/gettext.mk b/plugins/native/jessie/gettext.mk deleted file mode 120000 index 6314aff..0000000 --- a/plugins/native/jessie/gettext.mk +++ /dev/null @@ -1 +0,0 @@ -../gettext.mk \ No newline at end of file diff --git a/plugins/native/jessie/libiconv.mk b/plugins/native/jessie/libiconv.mk deleted file mode 120000 index 629a668..0000000 --- a/plugins/native/jessie/libiconv.mk +++ /dev/null @@ -1 +0,0 @@ -../libiconv.mk \ No newline at end of file diff --git a/plugins/native/libiconv.mk b/plugins/native/libiconv.mk deleted file mode 100644 index 922739a..0000000 --- a/plugins/native/libiconv.mk +++ /dev/null @@ -1,14 +0,0 @@ -# This file is part of MXE. See LICENSE.md for licensing information. - -PKG := libiconv -$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) -$(PKG)_DEPS_$(BUILD) := - -define $(PKG)_BUILD_$(BUILD) - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)/$(TARGET)' \ - --disable-shared - $(MAKE) -C '$(1).build' -j '$(JOBS)' man1_MANS= - $(MAKE) -C '$(1).build' -j 1 install man1_MANS= -endef diff --git a/plugins/native/trusty/gettext.mk b/plugins/native/trusty/gettext.mk deleted file mode 120000 index 6314aff..0000000 --- a/plugins/native/trusty/gettext.mk +++ /dev/null @@ -1 +0,0 @@ -../gettext.mk \ No newline at end of file diff --git a/plugins/native/trusty/libiconv.mk b/plugins/native/trusty/libiconv.mk deleted file mode 120000 index 629a668..0000000 --- a/plugins/native/trusty/libiconv.mk +++ /dev/null @@ -1 +0,0 @@ -../libiconv.mk \ No newline at end of file diff --git a/plugins/native/wheezy/gettext.mk b/plugins/native/wheezy/gettext.mk deleted file mode 120000 index 6314aff..0000000 --- a/plugins/native/wheezy/gettext.mk +++ /dev/null @@ -1 +0,0 @@ -../gettext.mk \ No newline at end of file diff --git a/plugins/native/wheezy/libiconv.mk b/plugins/native/wheezy/libiconv.mk deleted file mode 120000 index 629a668..0000000 --- a/plugins/native/wheezy/libiconv.mk +++ /dev/null @@ -1 +0,0 @@ -../libiconv.mk \ No newline at end of file diff --git a/src/gettext.mk b/src/gettext.mk index ee5674d..e4f7de8 100644 --- a/src/gettext.mk +++ b/src/gettext.mk @@ -11,6 +11,9 @@ $(PKG)_URL := https://ftp.gnu.org/gnu/gettext/$($(PKG)_FILE) $(PKG)_URL_2 := https://ftpmirror.gnu.org/gettext/$($(PKG)_FILE) $(PKG)_DEPS := gcc libiconv +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) +$(PKG)_DEPS_$(BUILD) := libiconv + define $(PKG)_UPDATE $(WGET) -q -O- 'https://ftp.gnu.org/gnu/gettext/' | \ grep 'gettext-' | \ @@ -30,9 +33,9 @@ define $(PKG)_BUILD endef define $(PKG)_BUILD_$(BUILD) - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)/$(TARGET)' - $(MAKE) -C '$(1).build' -j '$(JOBS)' man1_MANS= - $(MAKE) -C '$(1).build' -j 1 install man1_MANS= + # build and install the library + cd '$(BUILD_DIR)' && $(SOURCE_DIR)/configure \ + $(MXE_CONFIGURE_OPTS) + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MXE_DISABLE_DOCS) + $(MAKE) -C '$(BUILD_DIR)' -j 1 install $(MXE_DISABLE_DOCS) endef diff --git a/src/glib.mk b/src/glib.mk index 9f1bb46..d70693d 100644 --- a/src/glib.mk +++ b/src/glib.mk @@ -10,6 +10,9 @@ $(PKG)_SUBDIR := glib-$($(PKG)_VERSION) $(PKG)_FILE := glib-$($(PKG)_VERSION).tar.xz $(PKG)_URL := https://download.gnome.org/sources/glib/$(call SHORT_PKG_VERSION,$(PKG))/$($(PKG)_FILE) $(PKG)_DEPS := gcc dbus gettext libffi libiconv pcre zlib +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) + +$(PKG)_DEPS_$(BUILD) := gettext libiconv zlib define $(PKG)_UPDATE $(WGET) -q -O- 'https://git.gnome.org/browse/glib/refs/tags' | \ @@ -18,28 +21,17 @@ define $(PKG)_UPDATE head -1 endef -define $(PKG)_NATIVE_BUILD - cp -Rp '$(1)' '$(1).native' - - # native build of libiconv (used by glib-genmarshal) - cd '$(1).native' && $(call UNPACK_PKG_ARCHIVE,libiconv) - $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/libiconv-*.patch)), - (cd '$(1).native/$(libiconv_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH)) - cd '$(1).native/$(libiconv_SUBDIR)' && ./configure \ - --disable-shared \ - --disable-nls - $(MAKE) -C '$(1).native/$(libiconv_SUBDIR)' -j '$(JOBS)' - - # native build of zlib... - cd '$(1).native' && $(call UNPACK_PKG_ARCHIVE,zlib) - cd '$(1).native/$(zlib_SUBDIR)' && ./configure \ - --static - $(MAKE) -C '$(1).native/$(zlib_SUBDIR)' -j '$(JOBS)' +define $(PKG)_BUILD_DARWIN + # on darwin, use pre-built tools from macports with pinned + # version set in plugins/native/darwin/glib2-macports + $(call PREPARE_PKG_SOURCE,glib2-macports,$(BUILD_DIR)) + cp -Rp '$(BUILD_DIR)/opt/local/bin' '$(PREFIX)/$(TARGET)/' +endef - # native build for glib-genmarshal, without gettext - cd '$(1).native' && ./configure \ - --disable-shared \ - --prefix='$(PREFIX)/$(TARGET)' \ +define $(PKG)_BUILD_NATIVE + # native build for glib-tools + cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ + $(MXE_CONFIGURE_OPTS) \ --enable-regex \ --disable-threads \ --disable-selinux \ @@ -50,44 +42,38 @@ define $(PKG)_NATIVE_BUILD --disable-libmount \ --with-libiconv=gnu \ --with-pcre=internal \ - CPPFLAGS='-I$(1).native/$(libiconv_SUBDIR)/include -I$(1).native/$(zlib_SUBDIR)' \ - LDFLAGS='-L$(1).native/$(libiconv_SUBDIR)/lib/.libs -L$(1).native/$(zlib_SUBDIR)' - $(SED) -i 's,#define G_ATOMIC.*,,' '$(1).native/config.h' - $(MAKE) -C '$(1).native/glib' -j '$(JOBS)' - $(MAKE) -C '$(1).native/gthread' -j '$(JOBS)' - $(MAKE) -C '$(1).native/gmodule' -j '$(JOBS)' - $(MAKE) -C '$(1).native/gobject' -j '$(JOBS)' lib_LTLIBRARIES= install-exec - $(MAKE) -C '$(1).native/gio/xdgmime' -j '$(JOBS)' - $(MAKE) -C '$(1).native/gio' -j '$(JOBS)' glib-compile-schemas - $(MAKE) -C '$(1).native/gio' -j '$(JOBS)' glib-compile-resources - $(INSTALL) -m755 '$(1).native/gio/glib-compile-schemas' '$(PREFIX)/$(TARGET)/bin/' - $(INSTALL) -m755 '$(1).native/gio/glib-compile-resources' '$(PREFIX)/$(TARGET)/bin/' + CPPFLAGS='-I$(PREFIX)/$(TARGET)/include' \ + LDFLAGS='-L$(PREFIX)/$(TARGET)/lib' + $(SED) -i 's,#define G_ATOMIC.*,,' '$(BUILD_DIR)/config.h' + $(MAKE) -C '$(BUILD_DIR)/glib' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)/gthread' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)/gmodule' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)/gobject' -j '$(JOBS)' lib_LTLIBRARIES= install-exec + $(MAKE) -C '$(BUILD_DIR)/gio/xdgmime' -j '$(JOBS)' + $(MAKE) -C '$(BUILD_DIR)/gio' -j '$(JOBS)' glib-compile-schemas + $(MAKE) -C '$(BUILD_DIR)/gio' -j '$(JOBS)' glib-compile-resources + $(INSTALL) -m755 '$(BUILD_DIR)/gio/glib-compile-schemas' '$(PREFIX)/$(TARGET)/bin/' + $(INSTALL) -m755 '$(BUILD_DIR)/gio/glib-compile-resources' '$(PREFIX)/$(TARGET)/bin/' endef -define $(PKG)_SYMLINK - ln -sf `which glib-genmarshal` '$(PREFIX)/$(TARGET)/bin/' - ln -sf `which glib-compile-schemas` '$(PREFIX)/$(TARGET)/bin/' - ln -sf `which glib-compile-resources` '$(PREFIX)/$(TARGET)/bin/' +define $(PKG)_BUILD_$(BUILD) + # glib tools need to be close to glib-cross version. + # easy to build on linux, but error-prone on darwin (and freebsd?) + $(if $(findstring darwin, $(OS_SHORT_NAME)), \ + $($(PKG)_BUILD_DARWIN), \ + $($(PKG)_BUILD_NATIVE)) endef define $(PKG)_BUILD - cd '$(1)' && NOCONFIGURE=true ./autogen.sh - rm -f '$(PREFIX)/$(TARGET)/bin/glib-*' - - # Detecting if these GLib tools are already available on host machine, - # either because of a host package installation or from an earlier MXE - # installation of GLib. - # If it is installed, we symlink it into the MXE bin/. - # If not, we build it. - $(if $(findstring y,\ - $(shell [ -x "`which glib-genmarshal`" ] && \ - [ -x "`which glib-compile-schemas`" ] && \ - [ -x "`which glib-compile-resources`" ] && echo y)), \ - $($(PKG)_SYMLINK), \ - $($(PKG)_NATIVE_BUILD)) + # other packages expect glib-tools in $(TARGET)/bin + rm -f '$(PREFIX)/$(TARGET)/bin/glib-*' + ln -sf '$(PREFIX)/$(BUILD)/bin/glib-genmarshal' '$(PREFIX)/$(TARGET)/bin/' + ln -sf '$(PREFIX)/$(BUILD)/bin/glib-compile-schemas' '$(PREFIX)/$(TARGET)/bin/' + ln -sf '$(PREFIX)/$(BUILD)/bin/glib-compile-resources' '$(PREFIX)/$(TARGET)/bin/' # cross build - cd '$(1)' && ./configure \ + cd '$(SOURCE_DIR)' && NOCONFIGURE=true ./autogen.sh + cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \ $(MXE_CONFIGURE_OPTS) \ --with-threads=win32 \ --with-pcre=system \ @@ -98,11 +84,11 @@ define $(PKG)_BUILD GLIB_GENMARSHAL='$(PREFIX)/$(TARGET)/bin/glib-genmarshal' \ GLIB_COMPILE_SCHEMAS='$(PREFIX)/$(TARGET)/bin/glib-compile-schemas' \ GLIB_COMPILE_RESOURCES='$(PREFIX)/$(TARGET)/bin/glib-compile-resources' - $(MAKE) -C '$(1)/glib' -j '$(JOBS)' install sbin_PROGRAMS= noinst_PROGRAMS= - $(MAKE) -C '$(1)/gmodule' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= - $(MAKE) -C '$(1)/gthread' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= - $(MAKE) -C '$(1)/gobject' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= - $(MAKE) -C '$(1)/gio' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= MISC_STUFF= - $(MAKE) -C '$(1)' -j '$(JOBS)' install-pkgconfigDATA - $(MAKE) -C '$(1)/m4macros' install + $(MAKE) -C '$(BUILD_DIR)/glib' -j '$(JOBS)' install sbin_PROGRAMS= noinst_PROGRAMS= + $(MAKE) -C '$(BUILD_DIR)/gmodule' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + $(MAKE) -C '$(BUILD_DIR)/gthread' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + $(MAKE) -C '$(BUILD_DIR)/gobject' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + $(MAKE) -C '$(BUILD_DIR)/gio' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= MISC_STUFF= + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' install-pkgconfigDATA + $(MAKE) -C '$(BUILD_DIR)/m4macros' install endef diff --git a/src/libiconv.mk b/src/libiconv.mk index 39eee94..f1b5c46 100644 --- a/src/libiconv.mk +++ b/src/libiconv.mk @@ -9,6 +9,9 @@ $(PKG)_SUBDIR := libiconv-$($(PKG)_VERSION) $(PKG)_FILE := libiconv-$($(PKG)_VERSION).tar.gz $(PKG)_URL := https://ftp.gnu.org/gnu/libiconv/$($(PKG)_FILE) $(PKG)_DEPS := gcc +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) + +$(PKG)_DEPS_$(BUILD) := define $(PKG)_UPDATE $(WGET) -q -O- 'https://www.gnu.org/software/libiconv/' | \ @@ -32,9 +35,9 @@ define $(PKG)_BUILD endef define $(PKG)_BUILD_$(BUILD) - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)/$(TARGET)' - $(MAKE) -C '$(1).build' -j '$(JOBS)' man1_MANS= - $(MAKE) -C '$(1).build' -j 1 install man1_MANS= + # build and install the library + cd '$(BUILD_DIR)' && $(SOURCE_DIR)/configure \ + $(MXE_CONFIGURE_OPTS) + $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' $(MXE_DISABLE_DOCS) + $(MAKE) -C '$(BUILD_DIR)' -j 1 install $(MXE_DISABLE_DOCS) endef diff --git a/src/zlib.mk b/src/zlib.mk index 8cb7833..7ad0c3f 100644 --- a/src/zlib.mk +++ b/src/zlib.mk @@ -10,9 +10,10 @@ $(PKG)_FILE := zlib-$($(PKG)_VERSION).tar.xz $(PKG)_URL := https://zlib.net/$($(PKG)_FILE) $(PKG)_URL_2 := https://$(SOURCEFORGE_MIRROR)/project/libpng/$(PKG)/$($(PKG)_VERSION)/$($(PKG)_FILE) $(PKG)_DEPS := gcc -$(PKG)_DEPS_$(BUILD) := $(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) +$(PKG)_DEPS_$(BUILD) := + define $(PKG)_UPDATE $(WGET) -q -O- 'https://zlib.net/' | \ $(SED) -n 's,.*zlib-\([0-9][^>]*\)\.tar.*,\1,ip' | \ -- cgit v0.12