From c8dd7556b42d67c6134dc222399c026fdecf83ab Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:40:32 +1100 Subject: [PATCH 01/20] Makefile: enable target deps and native pkg build rules --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9c570641..f4e49eed 100644 --- a/Makefile +++ b/Makefile @@ -327,6 +327,21 @@ BUILD_PKGS := $(call set_create, \ $(SED) -n 's,.*src/\(.*\)\.mk,\1,p'), \ $(if $(value $(call LOOKUP_PKG_RULE,$(PKG),BUILD,$(BUILD))), $(PKG)))) +# create target sets for PKG_TARGET_RULE loop to avoid creating empty rules +# and having to explicitly disable $(BUILD) for most packages +CROSS_TARGETS := $(filter-out $(BUILD),$(MXE_TARGETS)) +$(foreach PKG,$(PKGS), \ + $(foreach TARGET,$(or $(sort $($(PKG)_TARGETS)),$(CROSS_TARGETS)), \ + $(eval $(TARGET)_PKGS += $(PKG)) \ + $(eval FILTERED_PKGS += $(PKG)))) + +# cross targets depend on native target +$(foreach TARGET,$(CROSS_TARGETS),\ + $(eval $(TARGET)_DEPS = $(BUILD))) + +# always add $(BUILD) to our targets +override MXE_TARGETS := $(CROSS_TARGETS) $(BUILD) + # set column widths for build status messages PKG_COL_WIDTH := $(call plus,2,$(call LIST_NMAX, $(sort $(call map, strlen, $(PKGS))))) MAX_TARGET_WIDTH := $(call LIST_NMAX, $(sort $(call map, strlen, $(MXE_TARGETS)))) @@ -394,6 +409,7 @@ $(PREFIX)/$(3)/installed/$(1): $(TOP_DIR)/src/$(1).mk \ $(PATCHES) \ $(wildcard $(TOP_DIR)/src/$(1)-test*) \ $(addprefix $(PREFIX)/$(3)/installed/,$(value $(call LOOKUP_PKG_RULE,$(1),DEPS,$(3)))) \ + $(and $($(3)_DEPS),$(addprefix $(PREFIX)/$($(3)_DEPS)/installed/,$($($(3)_DEPS)_PKGS))) \ | $(if $(DONT_CHECK_REQUIREMENTS),,check-requirements) \ $(if $(value $(call LOOKUP_PKG_RULE,$(1),URL,$(3))),download-only-$(1)) \ $(addprefix $(PREFIX)/$(3)/installed/,$(if $(call set_is_not_member,$(1),$(MXE_CONF_PKGS)),$(MXE_CONF_PKGS))) @@ -456,7 +472,7 @@ build-only-$(1)_$(3): endef $(foreach TARGET,$(MXE_TARGETS), \ $(shell [ -d '$(PREFIX)/$(TARGET)/installed' ] || mkdir -p '$(PREFIX)/$(TARGET)/installed') \ - $(foreach PKG,$(PKGS), \ + $(foreach PKG,$($(TARGET)_PKGS), \ $(eval $(call PKG_TARGET_RULE,$(PKG),$(call TMP_DIR,$(PKG)-$(TARGET)),$(TARGET))))) # convenience set-like functions for unique lists @@ -495,7 +511,7 @@ RECURSIVELY_EXCLUDED_PKGS = \ $(call WALK_DOWNSTREAM,$(EXCLUDE_PKGS))) .PHONY: all-filtered -all-filtered: $(filter-out $(call RECURSIVELY_EXCLUDED_PKGS),$(PKGS)) +all-filtered: $(filter-out $(call RECURSIVELY_EXCLUDED_PKGS),$(FILTERED_PKGS)) # print a list of upstream dependencies and downstream dependents show-deps-%: From 3132accaf157d8940a7f2287344cba2cd62c482f Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:44:04 +1100 Subject: [PATCH 02/20] remove gcc-* virtual packages --- index.html | 16 ---------------- src/gcc-gmp.mk | 27 --------------------------- src/gcc-isl.mk | 28 ---------------------------- src/gcc-mpc.mk | 28 ---------------------------- src/gcc-mpfr.mk | 28 ---------------------------- src/gcc.mk | 2 +- 6 files changed, 1 insertion(+), 128 deletions(-) delete mode 100644 src/gcc-gmp.mk delete mode 100644 src/gcc-isl.mk delete mode 100644 src/gcc-mpc.mk delete mode 100644 src/gcc-mpfr.mk diff --git a/index.html b/index.html index 38ded2cf..f6a3f0c2 100644 --- a/index.html +++ b/index.html @@ -1290,22 +1290,6 @@ local-pkg-list: $(LOCAL_PKG_LIST) gcc GCC - - gcc-gmp - GMP for GCC - - - gcc-isl - ISL for GCC - - - gcc-mpc - MPC for GCC - - - gcc-mpfr - MPFR for GCC - gd GD (without support for xpm) diff --git a/src/gcc-gmp.mk b/src/gcc-gmp.mk deleted file mode 100644 index d9f0a483..00000000 --- a/src/gcc-gmp.mk +++ /dev/null @@ -1,27 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := gcc-gmp -$(PKG)_IGNORE = $(gmp_IGNORE) -$(PKG)_VERSION = $(gmp_VERSION) -$(PKG)_CHECKSUM = $(gmp_CHECKSUM) -$(PKG)_SUBDIR = $(gmp_SUBDIR) -$(PKG)_FILE = $(gmp_FILE) -$(PKG)_URL = $(gmp_URL) -$(PKG)_URL_2 = $(gmp_URL_2) -$(PKG)_DEPS := - -define $(PKG)_UPDATE - echo $(gmp_VERSION) -endef - -define $(PKG)_BUILD - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)' \ - --disable-shared - $(MAKE) -C '$(1).build' -j '$(JOBS)' - $(MAKE) -C '$(1).build' -j 1 install -endef - -$(PKG)_BUILD_$(BUILD) = diff --git a/src/gcc-isl.mk b/src/gcc-isl.mk deleted file mode 100644 index a99a9da9..00000000 --- a/src/gcc-isl.mk +++ /dev/null @@ -1,28 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := gcc-isl -$(PKG)_IGNORE = $(isl_IGNORE) -$(PKG)_VERSION = $(isl_VERSION) -$(PKG)_CHECKSUM = $(isl_CHECKSUM) -$(PKG)_SUBDIR = $(isl_SUBDIR) -$(PKG)_FILE = $(isl_FILE) -$(PKG)_URL = $(isl_URL) -$(PKG)_URL_2 = $(isl_URL_2) -$(PKG)_DEPS := gcc-gmp - -define $(PKG)_UPDATE - echo $(isl_VERSION) -endef - -define $(PKG)_BUILD - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)' \ - --disable-shared \ - --with-gmp-prefix='$(PREFIX)' - $(MAKE) -C '$(1).build' -j '$(JOBS)' - $(MAKE) -C '$(1).build' -j 1 install -endef - -$(PKG)_BUILD_$(BUILD) = diff --git a/src/gcc-mpc.mk b/src/gcc-mpc.mk deleted file mode 100644 index 9311c9a2..00000000 --- a/src/gcc-mpc.mk +++ /dev/null @@ -1,28 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := gcc-mpc -$(PKG)_IGNORE = $(mpc_IGNORE) -$(PKG)_VERSION = $(mpc_VERSION) -$(PKG)_CHECKSUM = $(mpc_CHECKSUM) -$(PKG)_SUBDIR = $(mpc_SUBDIR) -$(PKG)_FILE = $(mpc_FILE) -$(PKG)_URL = $(mpc_URL) -$(PKG)_URL_2 = $(mpc_URL_2) -$(PKG)_DEPS := gcc-gmp gcc-mpfr - -define $(PKG)_UPDATE - echo $(mpc_VERSION) -endef - -define $(PKG)_BUILD - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)' \ - --disable-shared \ - --with-gmp='$(PREFIX)' - $(MAKE) -C '$(1).build' -j '$(JOBS)' - $(MAKE) -C '$(1).build' -j 1 install -endef - -$(PKG)_BUILD_$(BUILD) = diff --git a/src/gcc-mpfr.mk b/src/gcc-mpfr.mk deleted file mode 100644 index 78192c92..00000000 --- a/src/gcc-mpfr.mk +++ /dev/null @@ -1,28 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := gcc-mpfr -$(PKG)_IGNORE = $(mpfr_IGNORE) -$(PKG)_VERSION = $(mpfr_VERSION) -$(PKG)_CHECKSUM = $(mpfr_CHECKSUM) -$(PKG)_SUBDIR = $(mpfr_SUBDIR) -$(PKG)_FILE = $(mpfr_FILE) -$(PKG)_URL = $(mpfr_URL) -$(PKG)_URL_2 = $(mpfr_URL_2) -$(PKG)_DEPS := gcc-gmp - -define $(PKG)_UPDATE - echo $(mpfr_VERSION) -endef - -define $(PKG)_BUILD - mkdir '$(1).build' - cd '$(1).build' && '$(1)/configure' \ - --prefix='$(PREFIX)' \ - --disable-shared \ - --with-gmp='$(PREFIX)' - $(MAKE) -C '$(1).build' -j '$(JOBS)' - $(MAKE) -C '$(1).build' -j 1 install -endef - -$(PKG)_BUILD_$(BUILD) = diff --git a/src/gcc.mk b/src/gcc.mk index 946aa38c..d720e896 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -9,7 +9,7 @@ $(PKG)_SUBDIR := gcc-$($(PKG)_VERSION) $(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2 $(PKG)_URL := http://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE) $(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE) -$(PKG)_DEPS := binutils gcc-gmp gcc-isl gcc-mpc gcc-mpfr mingw-w64 +$(PKG)_DEPS := binutils mingw-w64 $(PKG)_FILE_$(BUILD) := From 3185b292b0b04bbd14fa9ea8a4a887a820edeec5 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:48:10 +1100 Subject: [PATCH 03/20] gcc and deps: use native builds and consolidate rules --- src/gcc.mk | 8 ++++---- src/gmp.mk | 6 ++++-- src/isl.mk | 8 ++++---- src/mpc.mk | 8 +++++++- src/mpfr.mk | 12 ++++++++++++ 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/gcc.mk b/src/gcc.mk index d720e896..129e2507 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -40,10 +40,10 @@ define $(PKG)_CONFIGURE --disable-win32-registry \ --enable-threads=win32 \ --disable-libgomp \ - --with-gmp='$(PREFIX)' \ - --with-isl='$(PREFIX)' \ - --with-mpc='$(PREFIX)' \ - --with-mpfr='$(PREFIX)' \ + --with-gmp='$(PREFIX)/$(BUILD)' \ + --with-isl='$(PREFIX)/$(BUILD)' \ + --with-mpc='$(PREFIX)/$(BUILD)' \ + --with-mpfr='$(PREFIX)/$(BUILD)' \ --with-as='$(PREFIX)/bin/$(TARGET)-as' \ --with-ld='$(PREFIX)/bin/$(TARGET)-ld' \ --with-nm='$(PREFIX)/bin/$(TARGET)-nm' \ diff --git a/src/gmp.mk b/src/gmp.mk index 52e80a37..860c79b6 100644 --- a/src/gmp.mk +++ b/src/gmp.mk @@ -9,8 +9,11 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION)a.tar.bz2 $(PKG)_URL := http://ftp.gnu.org/gnu/$(PKG)/$($(PKG)_FILE) $(PKG)_URL_2 := ftp://ftp.cs.tu-berlin.de/pub/gnu/$(PKG)/$($(PKG)_FILE) +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) $(PKG)_DEPS := gcc +$(PKG)_DEPS_$(BUILD) := + define $(PKG)_UPDATE $(WGET) -q -O- 'http://www.gmplib.org/' | \ grep '> all-tests-$(PKG)-$($(PKG)_VERSION).txt\r\n';) \ > '$(PREFIX)/$(TARGET)/bin/$(PKG)-tests/all-tests-$(PKG)-$($(PKG)_VERSION).bat' endef + +define $(PKG)_BUILD_$(BUILD) + mkdir '$(1).build' + cd '$(1).build' && '$(1)/configure' \ + $(MXE_CONFIGURE_OPTS) \ + --with-gmp='$(PREFIX)/$(TARGET)' + $(MAKE) -C '$(1).build' -j '$(JOBS)' + $(MAKE) -C '$(1).build' -j 1 install +endef From 870e439d0f5e02b0d83930b1fb7261ec8c6a9a3b Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:50:42 +1100 Subject: [PATCH 04/20] mxe-conf: consolidate rules and install cmake modules under usr --- src/mxe-conf.mk | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/mxe-conf.mk b/src/mxe-conf.mk index 5d814dee..b1afedfa 100644 --- a/src/mxe-conf.mk +++ b/src/mxe-conf.mk @@ -4,17 +4,14 @@ PKG := mxe-conf $(PKG)_VERSION := 1 $(PKG)_UPDATE := echo 1 +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) -define $(PKG)_BUILD_COMMON +define $(PKG)_BUILD # install target-specific autotools config file $(INSTALL) -d '$(PREFIX)/$(TARGET)/share' # setting ac_cv_build bypasses the config.guess check in every package echo "ac_cv_build=$(BUILD)" > '$(PREFIX)/$(TARGET)/share/config.site' - # install config.guess for general use - $(INSTALL) -d '$(PREFIX)/bin' - $(INSTALL) -m755 '$(EXT_DIR)/config.guess' '$(PREFIX)/bin/' - # create the CMake toolchain file # individual packages (e.g. hdf5) should add their # own files under CMAKE_TOOLCHAIN_DIR @@ -31,7 +28,7 @@ define $(PKG)_BUILD_COMMON echo 'set(CMAKE_CXX_COMPILER $(PREFIX)/bin/$(TARGET)-g++)'; \ echo 'set(CMAKE_Fortran_COMPILER $(PREFIX)/bin/$(TARGET)-gfortran)'; \ echo 'set(CMAKE_RC_COMPILER $(PREFIX)/bin/$(TARGET)-windres)'; \ - echo 'set(CMAKE_MODULE_PATH "$(PWD)/src/cmake/modules" $${CMAKE_MODULE_PATH}) # For mxe FindPackage scripts'; \ + echo 'set(CMAKE_MODULE_PATH "$(PREFIX)/share/cmake/modules" $${CMAKE_MODULE_PATH}) # For mxe FindPackage scripts'; \ echo 'set(CMAKE_INSTALL_PREFIX $(PREFIX)/$(TARGET) CACHE PATH "Installation Prefix")'; \ echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel")'; \ echo 'set(CMAKE_CROSS_COMPILING ON) # Workaround for http://www.cmake.org/Bug/view.php?id=14075'; \ @@ -66,10 +63,6 @@ define $(PKG)_BUILD_COMMON #create readonly directory to force wine to fail $(INSTALL) -m444 -d "$$WINEPREFIX" -endef - -define $(PKG)_BUILD - $($(PKG)_BUILD_COMMON) # create pkg-config files for OpenGL/GLU $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig' @@ -85,6 +78,17 @@ define $(PKG)_BUILD echo 'Libs: -lglu32';) \ > '$(PREFIX)/$(TARGET)/lib/pkgconfig/glu.pc' +endef + +define $(PKG)_BUILD_$(BUILD) + # install config.guess for general use + $(INSTALL) -d '$(PREFIX)/bin' + $(INSTALL) -m755 '$(EXT_DIR)/config.guess' '$(PREFIX)/bin/' + + # install cmake modules + $(INSTALL) -d '$(PREFIX)/share/cmake/modules' + $(INSTALL) -m644 '$(PWD)/src/cmake/modules/'* '$(PREFIX)/share/cmake/modules' + # fail early if autotools can't autoreconf # 1. detect mismatches in installation locations # 2. ??? @@ -97,5 +101,3 @@ define $(PKG)_BUILD cd '$(1)' && autoreconf -fiv cd '$(1)' && ./configure endef - -$(PKG)_BUILD_$(BUILD) = $($(PKG)_BUILD_COMMON) From 9732e4dc2961070ef9e9e9d839479c0e7490aa18 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:51:46 +1100 Subject: [PATCH 05/20] pkgconf yasm: enable native builds and consolidate rules --- src/pkgconf.mk | 19 ++++++++++--------- src/yasm.mk | 22 +++++++++------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/pkgconf.mk b/src/pkgconf.mk index dffbfc92..657d9956 100644 --- a/src/pkgconf.mk +++ b/src/pkgconf.mk @@ -8,10 +8,9 @@ $(PKG)_CHECKSUM := 91b2e5d7ce06583d5920c373b61d7d6554cd085cbd61ed176c7ff7ff30325 $(PKG)_SUBDIR := $(PKG)-$(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://github.com/$(PKG)/$(PKG)/tarball/$($(PKG)_VERSION)/$($(PKG)_FILE) +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) $(PKG)_DEPS := -$(PKG)_DEPS_$(BUILD) := automake - $(PKG)_UPDATE = $(call MXE_GET_GITHUB_SHA, pkgconf/pkgconf, master) define $(PKG)_UPDATE @@ -20,15 +19,9 @@ define $(PKG)_UPDATE endef define $(PKG)_BUILD - cd '$(1)' && ./autogen.sh - cd '$(1)' && ./configure \ - --prefix='$(PREFIX)/$(TARGET)' - $(MAKE) -C '$(1)' -j '$(JOBS)' - $(MAKE) -C '$(1)' -j 1 install - # create pkg-config script (echo '#!/bin/sh'; \ - echo 'PKG_CONFIG_PATH="$(PREFIX)/$(TARGET)/qt5/lib/pkgconfig":"$$PKG_CONFIG_PATH_$(subst .,_,$(subst -,_,$(TARGET)))" PKG_CONFIG_LIBDIR='\''$(PREFIX)/$(TARGET)/lib/pkgconfig'\'' exec '$(PREFIX)/$(TARGET)/bin/pkgconf' $(if $(BUILD_STATIC),--static) "$$@"') \ + echo 'PKG_CONFIG_PATH="$(PREFIX)/$(TARGET)/qt5/lib/pkgconfig":"$$PKG_CONFIG_PATH_$(subst .,_,$(subst -,_,$(TARGET)))" PKG_CONFIG_LIBDIR='\''$(PREFIX)/$(TARGET)/lib/pkgconfig'\'' exec '$(PREFIX)/$(BUILD)/bin/pkgconf' $(if $(BUILD_STATIC),--static) "$$@"') \ > '$(PREFIX)/bin/$(TARGET)-pkg-config' chmod 0755 '$(PREFIX)/bin/$(TARGET)-pkg-config' @@ -37,3 +30,11 @@ define $(PKG)_BUILD > '$(CMAKE_TOOLCHAIN_DIR)/pkgconf.cmake' endef + +define $(PKG)_BUILD_$(BUILD) + cd '$(1)' && ./autogen.sh + cd '$(1)' && ./configure \ + --prefix='$(PREFIX)/$(TARGET)' + $(MAKE) -C '$(1)' -j '$(JOBS)' + $(MAKE) -C '$(1)' -j 1 install +endef diff --git a/src/yasm.mk b/src/yasm.mk index dc21cb60..92c4c908 100644 --- a/src/yasm.mk +++ b/src/yasm.mk @@ -7,8 +7,11 @@ $(PKG)_CHECKSUM := 3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd56 $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://www.tortall.net/projects/$(PKG)/releases/$($(PKG)_FILE) +$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS) $(PKG)_DEPS := gcc +$(PKG)_DEPS_$(BUILD) := + define $(PKG)_UPDATE $(WGET) -q -O- 'https://github.com/yasm/yasm/tags' | \ $(SED) -n 's,.*href="/yasm/yasm/archive/v\([0-9][^"]*\)\.tar.*,\1,p' | \ @@ -16,21 +19,14 @@ define $(PKG)_UPDATE endef define $(PKG)_BUILD - # native build of yasm - will the same for all targets - # but we don't want to conflict with an un-prefixed version - mkdir '$(1).native' - cd '$(1).native' && '$(1)/configure' \ - --prefix='$(PREFIX)' \ - --program-prefix='$(TARGET)-' \ - --disable-nls \ - --disable-python - $(MAKE) -C '$(1).native' -j '$(JOBS)' install + # link to native yasm compiler on cross builds + $(if $(call sne,$(TARGET),$(BUILD)), + ln -sf '$(PREFIX)/$(BUILD)/bin/yasm' '$(PREFIX)/bin/$(TARGET)-yasm') # yasm is always static cd '$(1)' && '$(1)/configure' \ - --host='$(TARGET)' \ - --build="`config.guess`" \ - --prefix='$(PREFIX)/$(TARGET)' \ - --disable-nls + $(MXE_CONFIGURE_OPTS) \ + --disable-nls \ + --disable-python $(MAKE) -C '$(1)' -j '$(JOBS)' install endef From c96a007c6a4b03ca8d43c2ed848c47832f9e2baf Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:52:35 +1100 Subject: [PATCH 06/20] gcc: cleanup lib installation --- src/gcc.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gcc.mk b/src/gcc.mk index 129e2507..64a90a09 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -55,8 +55,11 @@ define $(PKG)_POST_BUILD rm -f $(addprefix $(PREFIX)/$(TARGET)/bin/, c++ g++ gcc gfortran) -mv '$(PREFIX)/lib/gcc/$(TARGET)/lib/'* '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/' -mv '$(PREFIX)/lib/gcc/$(TARGET)/'*.dll '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/' - -cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/' + -mv '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll '$(PREFIX)/$(TARGET)/bin/' -cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'*.dll.a '$(PREFIX)/$(TARGET)/lib/' + + # remove incorrectly installed libcc1 + rm -f '$(PREFIX)/lib/'libcc1* endef define $(PKG)_BUILD_mingw-w64 @@ -78,6 +81,9 @@ define $(PKG)_BUILD_mingw-w64 # build rest of gcc cd '$(1).build' $(MAKE) -C '$(1).build' -j '$(JOBS)' + + # cc1libdir isn't passed to subdirs so install correctly and rm later + $(MAKE) -C '$(1).build/libcc1' -j 1 install cc1libdir='$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)' $(MAKE) -C '$(1).build' -j 1 install $($(PKG)_POST_BUILD) From a8ed815d821423dfb37ccc45594cae4dabaf51a3 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 13 Oct 2015 23:53:34 +1100 Subject: [PATCH 07/20] Makefile: add print-deps-for-build-pkg target with inter-target deps --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f4e49eed..d67c63f1 100644 --- a/Makefile +++ b/Makefile @@ -253,7 +253,8 @@ LIST_NMIN = $(shell echo '$(strip $(1))' | tr ' ' '\n' | sort -n | head -1) NPROCS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1) JOBS_AUTO := $(call LIST_NMIN, $(DEFAULT_MAX_JOBS) $(NPROCS)) JOBS := $(strip $(if $(findstring undefined,$(origin JOBS)),\ - $(info [using autodetected $(JOBS_AUTO) job(s)]) \ + $(if $(and $(MAKECMDGOALS),$(filter $(MAKECMDGOALS),$(PKGS))), \ + $(info [using autodetected $(JOBS_AUTO) job(s)])) \ $(JOBS_AUTO)\ ,\ $(JOBS))) @@ -541,6 +542,18 @@ show-upstream-deps-%: @echo -n,\ $(error Package $* not found in index.html)) +# print first level pkg deps for use in build-pkg.lua +.PHONY: print-deps-for-build-pkg +print-deps-for-build-pkg: + $(foreach TARGET,$(MXE_TARGETS), \ + $(foreach PKG,$(sort $($(TARGET)_PKGS)), \ + $(info for-build-pkg $(TARGET)~$(PKG) \ + $(subst $(space),-,$($(PKG)_VERSION)) \ + $(addprefix $(TARGET)~,$(value $(call LOOKUP_PKG_RULE,$(PKG),DEPS,$(TARGET)))) \ + $(addprefix $(TARGET)~,$(if $(call set_is_not_member,$(PKG),$(MXE_CONF_PKGS)),$(MXE_CONF_PKGS))) \ + $(and $($(TARGET)_DEPS),$(addprefix $($(TARGET)_DEPS)~,$($($(TARGET)_DEPS)_PKGS)))))) + @echo -n + .PHONY: clean clean: rm -rf $(call TMP_DIR,*) $(PREFIX) build-matrix.html From 7c43d12a112f10150f2d930d88de9f0249d8cae0 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sun, 18 Oct 2015 14:42:37 +0200 Subject: [PATCH 08/20] build-pkg: remove most of the COMMON_FILES Source: https://github.com/mxe/mxe/pull/925#issuecomment-147992049 see #925 --- tools/build-pkg.lua | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 856977ba..25cae360 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -49,37 +49,9 @@ local BLACKLIST = { } local COMMON_FILES = { - ['gcc-isl'] = { - '^usr/include/isl/', - '^usr/lib/libisl%.', - '^usr/lib/pkgconfig/isl.pc$', - }, - ['gcc-mpc'] = { - '^usr/include/mpc.h$', - '^usr/lib/libmpc%.', - }, - ['gcc-gmp'] = { - '^usr/include/gmp.h$', - '^usr/lib/libgmp%.', - }, - ['gcc-mpfr'] = { - '^usr/include/mpf2mpfr.h$', - '^usr/include/mpfr.h$', - '^usr/lib/libmpfr%.', - }, - ['gcc'] = { - '^usr/lib/libcc1%.', - }, - ['yasm'] = { - '^usr/include/libyasm', - '^usr/lib/libyasm.a$', - }, ['ncurses'] = { '^usr/lib/pkgconfig/', }, - ['pkgconf'] = { - '^usr/bin/config.guess$', - }, } local ARCH_FOR_COMMON = 'i686-w64-mingw32.static' From 477f90994756a4595d77b613750f8c31772bb64a Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 14:57:43 +0200 Subject: [PATCH 09/20] build-pkg: rename local var "item" to "member" I want to use name "item" for something else. --- tools/build-pkg.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 25cae360..0b02dfd2 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -101,8 +101,8 @@ local function trim(str) end local function isInArray(element, array) - for _, item in ipairs(array) do - if item == element then + for _, member in ipairs(array) do + if member == element then return true end end From 856f1d3b0997b3fe85f9b96ecf168030e56c8955 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 17:03:39 +0200 Subject: [PATCH 10/20] update build-pkg.lua for toolchain re-org 1. Remove common packages. Common packages served a replacement for native target. Now we have native target and don't need common packages. Existing common files (ncurses) have to be fixed. 2. Package -> Item. Item means a string "target~package". All functions which used packages now use items. 3. One build list instead of 4 build lists. All items are sorted and built together without separation by target. 4. No module-global variable "target". All functions using target now get "item" and target is extracted from item. All remaining module-global variables don't change (are constants) or are created in the bottom of the module. 5. MXE_MAX_PACKAGES -> MXE_MAX_ITEMS see #925 see #919 --- tools/build-pkg.lua | 281 ++++++++++++++++---------------------------- 1 file changed, 103 insertions(+), 178 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 0b02dfd2..bb0492de 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -22,7 +22,7 @@ set environment variable MXE_NO_DEBS to 1 In this case fakeroot and dpkg-deb are not needed. To limit number of packages being built to x, -set environment variable MXE_MAX_PACKAGES to x, +set environment variable MXE_MAX_ITEMS to x, The following error: > fakeroot, while creating message channels: Invalid argument @@ -32,7 +32,7 @@ can be caused by leaked ipc resources originating in fakeroot. How to remove them: http://stackoverflow.com/a/4262545 ]] -local max_packages = tonumber(os.getenv('MXE_MAX_PACKAGES')) +local max_items = tonumber(os.getenv('MXE_MAX_ITEMS')) local no_debs = os.getenv('MXE_NO_DEBS') local ARCH = 'amd64' @@ -48,14 +48,6 @@ local BLACKLIST = { '^usr/[^/]+/share/info/', } -local COMMON_FILES = { - ['ncurses'] = { - '^usr/lib/pkgconfig/', - }, -} - -local ARCH_FOR_COMMON = 'i686-w64-mingw32.static' - local TARGETS = { 'i686-w64-mingw32.static', 'x86_64-w64-mingw32.static', @@ -63,10 +55,8 @@ local TARGETS = { 'x86_64-w64-mingw32.shared', } -local target -- used by many functions - local function log(fmt, ...) - print('[build-pkg]', target, fmt:format(...)) + print('[build-pkg]', fmt:format(...)) end -- based on http://lua-users.org/wiki/SplitJoin @@ -109,6 +99,15 @@ local function isInArray(element, array) return false end +local function sliceArray(list, nelements) + nelements = nelements or #list + local new_list = {} + for i = 1, nelements do + new_list[i] = list[i] + end + return new_list +end + local function shell(cmd) local f = io.popen(cmd, 'r') local text = f:read('*all') @@ -151,34 +150,22 @@ local function fileExists(name) end end --- return several tables describing packages --- * list of packages --- * map from package to list of deps --- * map from package to version of package -local function getPkgs() - -- create file deps.mk showing deps - -- (make show-upstream-deps-% does not present in - -- stable MXE) - local deps_mk_content = [[ -include Makefile -NOTHING:= -SPACE:=$(NOTHING) $(NOTHING) -NAME_WITH_UNDERSCORES:=$(subst $(SPACE),_,$(NAME)) -print-deps: - @$(foreach pkg,$(PKGS),echo \ - for-build-pkg $(pkg) \ - $(subst $(SPACE),-,$($(pkg)_VERSION)) \ - $($(pkg)_DEPS) \ - $(if $(call set_is_not_member,$(pkg),$(MXE_CONF_PKGS)), \ - $(MXE_CONF_PKGS));)]] - local deps_mk_file = io.open('deps.mk', 'w') - deps_mk_file:write(deps_mk_content) - deps_mk_file:close() - local pkgs = {} - local pkg2deps = {} - local pkg2ver = {} - local cmd = '%s -f deps.mk print-deps MXE_TARGETS=%s' - cmd = cmd:format(tool 'make', target) +-- return target and package from item name +local function parseItem(item) + return item:match("([^~]+)~([^~]+)") +end + +-- return several tables describing packages for all targets +-- * list of items +-- * map from item to list of deps (which are also items) +-- * map from item to version +-- Item is a string like "target~pkg" +local function getItems() + local items = {} + local item2deps = {} + local item2ver = {} + local cmd = '%s print-deps-for-build-pkg MXE_TARGETS=%q' + cmd = cmd:format(tool 'make', table.concat(TARGETS, ' ')) local make = io.popen(cmd) for line in make:lines() do local deps = split(trim(line)) @@ -186,29 +173,28 @@ print-deps: -- first value is marker 'for-build-pkg' table.remove(deps, 1) -- first value is name of package which depends on - local pkg = table.remove(deps, 1) + local item = table.remove(deps, 1) -- second value is version of package local ver = table.remove(deps, 1) - table.insert(pkgs, pkg) - pkg2deps[pkg] = deps - pkg2ver[pkg] = ver + table.insert(items, item) + item2deps[item] = deps + item2ver[item] = ver end end make:close() - os.remove('deps.mk') - return pkgs, pkg2deps, pkg2ver + return items, item2deps, item2ver end --- return packages ordered in build order --- this means, if pkg1 depends on pkg2, then --- pkg2 preceeds pkg1 in the list -local function sortForBuild(pkgs, pkg2deps) +-- return items ordered in build order +-- this means, if item depends on item2, then +-- item2 preceeds item1 in the list +local function sortForBuild(items, item2deps) -- use sommand tsort local tsort_input_fname = os.tmpname() local tsort_input = io.open(tsort_input_fname, 'w') - for _, pkg1 in ipairs(pkgs) do - for _, pkg2 in ipairs(pkg2deps[pkg1]) do - tsort_input:write(pkg2 .. ' ' .. pkg1 .. '\n') + for _, item1 in ipairs(items) do + for _, item2 in ipairs(item2deps[item1]) do + tsort_input:write(item2 .. ' ' .. item1 .. '\n') end end tsort_input:close() @@ -216,8 +202,8 @@ local function sortForBuild(pkgs, pkg2deps) local build_list = {} local tsort = io.popen('tsort ' .. tsort_input_fname, 'r') for line in tsort:lines() do - local pkg = trim(line) - table.insert(build_list, pkg) + local item = trim(line) + table.insert(build_list, item) end tsort:close() os.remove(tsort_input_fname) @@ -287,12 +273,13 @@ local function gitCommit(message) os.execute(cmd:format(message)) end -local function isValidBinary(file) +local function isValidBinary(target, file) local cmd = './usr/bin/%s-objdump -t %s > /dev/null 2>&1' return execute(cmd:format(target, file)) end -local function checkFile(file, pkg) +local function checkFile(file, item) + local target, _ = parseItem(item) -- if it is PE32 file, it must have '.exe' in name local ext = file:sub(-4):lower() local cmd = 'file --dereference --brief %q' @@ -302,73 +289,66 @@ local function checkFile(file, pkg) elseif ext == '.exe' then if not file_type:match('PE32') then log('File %s (%s) is %q. Remove .exe', - file, pkg, file_type) + file, item, file_type) end elseif ext == '.dll' then if not file_type:match('PE32.*DLL') then log('File %s (%s) is %q. Remove .dll', - file, pkg, file_type) + file, item, file_type) end else if file_type:match('PE32') then log('File %s (%s) is %q. Add exe or dll', - file, pkg, file_type) + file, item, file_type) end end for _, t in ipairs(TARGETS) do if t ~= target and file:match(t) then log('File %s (%s): other target %s in name', - file, pkg, t) + file, item, t) end end if file:match('/lib/.*%.dll$') then - log('File %s (%s): DLL in /lib/', file, pkg) + log('File %s (%s): DLL in /lib/', file, item) end if file:match('%.dll$') or file:match('%.a$') then - if file:find(target, 1, true) then -- not common - if not isValidBinary(file) then + if file:find(target, 1, true) then -- cross-compiled + if not isValidBinary(target, file) then log('File %s (%s): not recognized library', - file, pkg) + file, item) end end end end -- builds package, returns list of new files -local function buildPackage(pkg, pkg2deps, file2pkg) - local cmd = '%s %s MXE_TARGETS=%s --jobs=1' - os.execute(cmd:format(tool 'make', pkg, target)) +local function buildItem(item, item2deps, file2item) + local cmd = '%s %s --jobs=1' + os.execute(cmd:format(tool 'make', item)) gitAdd() local new_files, changed_files = gitStatus() - gitCommit(("Build %s for target %s"):format(pkg, target)) + gitCommit(("Build %s"):format(item)) for _, file in ipairs(new_files) do - checkFile(file, pkg) - file2pkg[file] = {pkg=pkg, target=target} + checkFile(file, item) + file2item[file] = item end for _, file in ipairs(changed_files) do - checkFile(file, pkg) + checkFile(file, item) -- add a dependency on a package created this file - local creator_pkg = assert(file2pkg[file]).pkg - local creator_target = assert(file2pkg[file]).target - local level = '' - if target == creator_target then - if not isInArray(creator_pkg, pkg2deps[pkg]) then - table.insert(pkg2deps[pkg], creator_pkg) - end - else - level = 'error' + local creator_item = assert(file2item[file]) + if not isInArray(creator_item, item2deps[item]) then + table.insert(item2deps[item], creator_item) end - log('Package %s changes %s, created by %s (%s) %s', - pkg, file, creator_pkg, creator_target, level) + log('Item %s changes %s, created by %s', + item, file, creator_item) end return new_files end -local function nameToDebian(pkg, t) - local name = 'mxe-%s-%s' - name = name:format(t or target, pkg) - name = name:gsub('_', '-') - return name +local function nameToDebian(item) + item = item:gsub('[~_]', '-') + local name = 'mxe-%s' + return name:format(item) end local function protectVersion(ver) @@ -381,7 +361,8 @@ local function protectVersion(ver) end end -local function listFile(pkg) +local function listFile(item) + local target, pkg = parseItem(item) return ('%s-%s.list'):format(target, pkg) end @@ -401,8 +382,9 @@ Description: MXE package %s for %s This package contains the files for MXE package %s. ]] -local function makeDeb(pkg, list_path, deps, ver, add_common) - local deb_pkg = nameToDebian(pkg) +local function makeDeb(item, list_path, deps, ver) + local target, pkg = parseItem(item) + local deb_pkg = nameToDebian(item) local dirname = ('%s_%s'):format(deb_pkg, protectVersion(ver)) -- make .tar.xz file @@ -423,9 +405,6 @@ local function makeDeb(pkg, list_path, deps, ver, add_common) for _, dep in ipairs(deps) do table.insert(deb_deps, nameToDebian(dep)) end - if add_common then - table.insert(deb_deps, nameToDebian(pkg, 'common')) - end local deb_deps_str = table.concat(deb_deps, ', ') -- make DEBIAN/control file os.execute(('mkdir -p %s/DEBIAN'):format(dirname)) @@ -443,14 +422,6 @@ local function makeDeb(pkg, list_path, deps, ver, add_common) os.execute(('rm -fr %s deb.fakeroot'):format(dirname)) end -local function readFileList(list_file) - local list = {} - for installed_file in io.lines(list_file) do - table.insert(list, installed_file) - end - return list -end - local function saveFileList(list_file, list) local file = io.open(list_file, 'w') for _, installed_file in ipairs(list) do @@ -459,7 +430,8 @@ local function saveFileList(list_file, list) file:close() end -local function isBuilt(pkg, files) +local function isBuilt(item, files) + local target, pkg = parseItem(item) local INSTALLED = 'usr/%s/installed/%s' local installed = INSTALLED:format(target, pkg) for _, file in ipairs(files) do @@ -470,94 +442,46 @@ local function isBuilt(pkg, files) return false end --- build all packages, save filelist to file #pkg.list -local function buildPackages(pkgs, pkg2deps, file2pkg) +-- build all packages, save filelist to list file +local function buildPackages(items, item2deps) local broken = {} local unbroken = {} - local function brokenDep(pkg) - for _, dep in ipairs(pkg2deps[pkg]) do + local file2item = {} + local function brokenDep(item) + for _, dep in ipairs(item2deps[item]) do if broken[dep] then return dep end end return false end - for _, pkg in ipairs(pkgs) do - if not brokenDep(pkg) then - local files = buildPackage(pkg, pkg2deps, file2pkg) - if isBuilt(pkg, files) then - saveFileList(listFile(pkg), files) - table.insert(unbroken, pkg) + for _, item in ipairs(items) do + if not brokenDep(item) then + local files = buildItem(item, item2deps, file2item) + if isBuilt(item, files) then + saveFileList(listFile(item), files) + table.insert(unbroken, item) else -- broken package - broken[pkg] = true - log('The package is broken: %s', pkg) + broken[item] = true + log('Item is broken: %s', item) end else - broken[pkg] = true - log('Package %s depends on broken %s', - pkg, brokenDep(pkg)) + broken[item] = true + log('Item %s depends on broken item %s', + item, brokenDep(item)) end end return unbroken end -local function filterFiles(pkg, filter_common) - local list = readFileList(listFile(pkg)) - local list2 = {} - local common_list = COMMON_FILES[pkg] - for _, installed_file in ipairs(list) do - local listed = isListed(installed_file, common_list) - if listed == filter_common then - table.insert(list2, installed_file) - end +local function makeDebs(items, item2deps, item2ver) + for _, item in ipairs(items) do + local deps = assert(item2deps[item], item) + local ver = assert(item2ver[item], item) + local list_path = listFile(item) + makeDeb(item, list_path, deps, ver) end - return list2 -end - -local function excludeCommon(pkg) - local noncommon_files = filterFiles(pkg, false) - saveFileList(listFile(pkg), noncommon_files) -end - -local function makeCommonDeb(pkg, ver) - local common_files = filterFiles(pkg, true) - local list_path = ('common-%s.list'):format(pkg) - saveFileList(list_path, common_files) - local orig_target = target - target = 'common' - makeDeb(pkg, list_path, {}, ver) - target = orig_target -end - -local function makeDebs(pkgs, pkg2deps, pkg2ver) - for _, pkg in ipairs(pkgs) do - local deps = assert(pkg2deps[pkg], pkg) - local ver = assert(pkg2ver[pkg], pkg) - local list_path = listFile(pkg) - local add_common = false - if COMMON_FILES[pkg] then - if target == ARCH_FOR_COMMON then - makeCommonDeb(pkg, ver) - end - add_common = true - excludeCommon(pkg) - end - makeDeb(pkg, list_path, deps, ver, add_common) - end -end - -local function buildForTarget(mxe_target, file2pkg) - target = mxe_target - local pkgs, pkg2deps, pkg2ver = getPkgs() - local build_list = sortForBuild(pkgs, pkg2deps) - if max_packages then - while #build_list > max_packages do - table.remove(build_list) - end - end - local unbroken = buildPackages(build_list, pkg2deps, file2pkg) - makeDebs(unbroken, pkg2deps, pkg2ver) end local function getMxeVersion() @@ -626,10 +550,11 @@ assert(execute(("%s check-requirements"):format(tool 'make'))) while not execute(('%s download -j 6 -k'):format(tool 'make')) do end gitInit() -local file2pkg = {} -for _, t in ipairs(TARGETS) do - buildForTarget(t, file2pkg) -end +local items, item2deps, item2ver = getItems() +local build_list = sortForBuild(items, item2deps) +build_list = sliceArray(build_list, max_items) +local unbroken = buildPackages(build_list, item2deps) +makeDebs(unbroken, item2deps, item2ver) if not no_debs then makeMxeRequirementsDeb('wheezy') makeMxeRequirementsDeb('jessie') From f15fc358a6dd5a6bda812752b6f0c92175f901c3 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 17:09:38 +0200 Subject: [PATCH 11/20] build-pkg: add function searching for a substring str:match(pattern) treats pattern as a regular expression. str:find(substring, 1, true) searches for a substring. The latter is needed to check if a filename contains a target. --- tools/build-pkg.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index bb0492de..b9ed8df1 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -108,6 +108,10 @@ local function sliceArray(list, nelements) return new_list end +local function isInString(substring, string) + return string:find(substring, 1, true) +end + local function shell(cmd) local f = io.popen(cmd, 'r') local text = f:read('*all') @@ -303,7 +307,7 @@ local function checkFile(file, item) end end for _, t in ipairs(TARGETS) do - if t ~= target and file:match(t) then + if t ~= target and isInString(t, file) then log('File %s (%s): other target %s in name', file, item, t) end @@ -312,7 +316,7 @@ local function checkFile(file, item) log('File %s (%s): DLL in /lib/', file, item) end if file:match('%.dll$') or file:match('%.a$') then - if file:find(target, 1, true) then -- cross-compiled + if isInString(target, file) then -- cross-compiled if not isValidBinary(target, file) then log('File %s (%s): not recognized library', file, item) From 79717d12cc4212e3e1df5fb7d8513523c86f0ff4 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 17:40:19 +0200 Subject: [PATCH 12/20] build-pkg: fix test for library format Fix warnings like: [build-pkg] File usr/x86_64-unknown-linux-gnu/lib/libyasm.a (x86_64-unknown-linux-gnu~yasm): not recognized library --- tools/build-pkg.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index b9ed8df1..1014fbb8 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -154,6 +154,10 @@ local function fileExists(name) end end +local function isCross(target) + return not isInString('unknown', target) +end + -- return target and package from item name local function parseItem(item) return item:match("([^~]+)~([^~]+)") @@ -316,7 +320,8 @@ local function checkFile(file, item) log('File %s (%s): DLL in /lib/', file, item) end if file:match('%.dll$') or file:match('%.a$') then - if isInString(target, file) then -- cross-compiled + if isInString(target, file) and isCross(target) then + -- cross-compiled if not isValidBinary(target, file) then log('File %s (%s): not recognized library', file, item) From 1c3e1e9a3b3a2987e18cf5eb7f94e3f4cce3cde4 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 17:51:45 +0200 Subject: [PATCH 13/20] build-pkg: pass MXE_TARGETS to "make pkg" "make target~pkg" doesn't work if target is not in MXE_TARGETS. I believe such behaviout to be a feature not a bug, because it seems to work faster with lesser MXE_TARGETS. --- tools/build-pkg.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 1014fbb8..76928862 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -332,8 +332,9 @@ end -- builds package, returns list of new files local function buildItem(item, item2deps, file2item) - local cmd = '%s %s --jobs=1' - os.execute(cmd:format(tool 'make', item)) + local target, pkg = parseItem(item) + local cmd = '%s %s MXE_TARGETS=%s --jobs=1' + os.execute(cmd:format(tool 'make', pkg, target)) gitAdd() local new_files, changed_files = gitStatus() gitCommit(("Build %s"):format(item)) From 894df3804828fdf3c2e85f4bd21024612d244a9b Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 18 Oct 2015 18:30:14 +0200 Subject: [PATCH 14/20] build-pkg: log cross-target dependencies Don't log dependencies on native target. --- tools/build-pkg.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 76928862..3d71351e 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -187,6 +187,14 @@ local function getItems() table.insert(items, item) item2deps[item] = deps item2ver[item] = ver + local target, _ = parseItem(item) + for _, dep_item in ipairs(deps) do + local target2, _ = parseItem(dep_item) + if isCross(target2) and target2 ~= target then + log("Cross-target dependency %s -> %s", + target2, target) + end + end end end make:close() From 987f8a09de28009c89878d6e792c7e152a93977a Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Mon, 19 Oct 2015 09:55:41 +0200 Subject: [PATCH 15/20] build-pkg: don't blacklist usr/share/cmake --- tools/build-pkg.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 3d71351e..2870cad7 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -43,7 +43,11 @@ local GIT = 'git --work-tree=./usr/ --git-dir=./usr/.git ' local BLACKLIST = { '^usr/installed/check%-requirements$', - '^usr/share/', + -- usr/share/cmake if useful + '^usr/share/doc/', + '^usr/share/info/', + '^usr/share/man/', + '^usr/share/gcc', '^usr/[^/]+/share/doc/', '^usr/[^/]+/share/info/', } From 4ed7cd1b1e8d540f0096be47bdb773097619f5f6 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Mon, 19 Oct 2015 10:01:52 +0200 Subject: [PATCH 16/20] build-pkg: use config.guess to get native target --- tools/build-pkg.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 2870cad7..aa32ebc0 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -158,8 +158,9 @@ local function fileExists(name) end end +local NATIVE_TARGET = trim(shell("ext/config.guess")) local function isCross(target) - return not isInString('unknown', target) + return target ~= NATIVE_TARGET end -- return target and package from item name From 3a462ae25c5a0393c3913d275063666f2662134c Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 19 Oct 2015 19:47:44 +1100 Subject: [PATCH 17/20] Makefile: clean files created by build-pkg --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d67c63f1..4e5241cf 100644 --- a/Makefile +++ b/Makefile @@ -554,9 +554,12 @@ print-deps-for-build-pkg: $(and $($(TARGET)_DEPS),$(addprefix $($(TARGET)_DEPS)~,$($($(TARGET)_DEPS)_PKGS)))))) @echo -n +BUILD_PKG_TMP_FILES := *-*.list mxe-*.tar.xz mxe-*.deb* wheezy jessie + .PHONY: clean clean: - rm -rf $(call TMP_DIR,*) $(PREFIX) build-matrix.html + rm -rf $(call TMP_DIR,*) $(PREFIX) build-matrix.html \ + $(addprefix $(TOP_DIR)/, $(BUILD_PKG_TMP_FILES)) .PHONY: clean-pkg clean-pkg: From 16e8f7d7739d9c2fce4813b8e01c5516d49f0070 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 19 Oct 2015 19:58:34 +1100 Subject: [PATCH 18/20] .gitignore: also ignore debian control files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 540ab11f..76be1b73 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,6 @@ # generated by build-pkg /*-*.list /mxe-*.tar.xz -/mxe-*.deb +/mxe-*.deb* /wheezy /jessie From eec1eb66cfa79a115e97583632f1e975a95b707c Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 19 Oct 2015 20:03:20 +1100 Subject: [PATCH 19/20] build-pkg: keep deb-control files --- tools/build-pkg.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index aa32ebc0..4b47b14d 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -436,6 +436,9 @@ local function makeDeb(item, list_path, deps, ver) control:write(CONTROL:format(deb_pkg, protectVersion(ver), ARCH, deb_deps_str, pkg, target, pkg)) control:close() + -- keep a copy of control file + local cmd = 'cp %s %s.deb-control' + os.execute(cmd:format(control_fname, dirname)) if not no_debs then -- make .deb file local cmd = 'fakeroot -i deb.fakeroot dpkg-deb -b %s' From 99ff9ca3fee7d5c04efb91912747d22c4338944d Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 20 Oct 2015 20:25:29 +1100 Subject: [PATCH 20/20] gendef: install to target specific prefix --- src/gendef.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gendef.mk b/src/gendef.mk index de6f90ec..d89d7d68 100644 --- a/src/gendef.mk +++ b/src/gendef.mk @@ -18,7 +18,7 @@ define $(PKG)_BUILD cd '$(1)/mingw-w64-tools/gendef' && ./configure \ --host='$(BUILD)' \ --build='$(BUILD)' \ - --prefix='$(PREFIX)' \ + --prefix='$(PREFIX)/$(TARGET)' \ --target='$(TARGET)' $(MAKE) -C '$(1)/mingw-w64-tools/gendef' -j '$(JOBS)' install endef