summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2015-10-25 02:02:30 (GMT)
committerTony Theodore <tonyt@logyst.com>2015-10-25 02:02:30 (GMT)
commitffca3f5b83fd5711478b4887ce02551329f33f83 (patch)
treed0b1e81af172ebfbc228765c56903f3d61b35df8
parentb5d2ade2bf4b1f039767987fe4462fc648dfebc6 (diff)
parent99ff9ca3fee7d5c04efb91912747d22c4338944d (diff)
downloadmxe-ffca3f5b83fd5711478b4887ce02551329f33f83.zip
mxe-ffca3f5b83fd5711478b4887ce02551329f33f83.tar.gz
mxe-ffca3f5b83fd5711478b4887ce02551329f33f83.tar.bz2
Merge pull request #925 from tonytheodore/toolchain
Toolchain re-org - target dependencies
-rw-r--r--.gitignore2
-rw-r--r--Makefile40
-rw-r--r--index.html16
-rw-r--r--src/gcc-gmp.mk27
-rw-r--r--src/gcc-isl.mk28
-rw-r--r--src/gcc-mpc.mk28
-rw-r--r--src/gcc-mpfr.mk28
-rw-r--r--src/gcc.mk18
-rw-r--r--src/gendef.mk2
-rw-r--r--src/gmp.mk6
-rw-r--r--src/isl.mk8
-rw-r--r--src/mpc.mk8
-rw-r--r--src/mpfr.mk12
-rw-r--r--src/mxe-conf.mk26
-rw-r--r--src/pkgconf.mk19
-rw-r--r--src/yasm.mk22
-rwxr-xr-xtools/build-pkg.lua339
17 files changed, 241 insertions, 388 deletions
diff --git a/.gitignore b/.gitignore
index 540ab11..76be1b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,6 @@
# generated by build-pkg
/*-*.list
/mxe-*.tar.xz
-/mxe-*.deb
+/mxe-*.deb*
/wheezy
/jessie
diff --git a/Makefile b/Makefile
index 9c57064..4e5241c 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)))
@@ -327,6 +328,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 +410,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 +473,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 +512,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-%:
@@ -525,9 +542,24 @@ 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
+
+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:
diff --git a/index.html b/index.html
index 38ded2c..f6a3f0c 100644
--- a/index.html
+++ b/index.html
@@ -1291,22 +1291,6 @@ local-pkg-list: $(LOCAL_PKG_LIST)</pre>
<td class="website"><a href="http://gcc.gnu.org/">GCC</a></td>
</tr>
<tr>
- <td class="package">gcc-gmp</td>
- <td class="website"><a href="http://www.gmplib.org/">GMP for GCC</a></td>
- </tr>
- <tr>
- <td class="package">gcc-isl</td>
- <td class="website"><a href="http://isl.gforge.inria.fr/">ISL for GCC</a></td>
- </tr>
- <tr>
- <td class="package">gcc-mpc</td>
- <td class="website"><a href="http://www.multiprecision.org/">MPC for GCC</a></td>
- </tr>
- <tr>
- <td class="package">gcc-mpfr</td>
- <td class="website"><a href="http://www.mpfr.org/">MPFR for GCC</a></td>
- </tr>
- <tr>
<td class="package">gd</td>
<td class="website"><a href="http://www.libgd.org/">GD (without support for xpm)</a></td>
</tr>
diff --git a/src/gcc-gmp.mk b/src/gcc-gmp.mk
deleted file mode 100644
index d9f0a48..0000000
--- 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 a99a9da..0000000
--- 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 9311c9a..0000000
--- 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 78192c9..0000000
--- 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 946aa38..64a90a0 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) :=
@@ -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' \
@@ -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)
diff --git a/src/gendef.mk b/src/gendef.mk
index de6f90e..d89d7d6 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
diff --git a/src/gmp.mk b/src/gmp.mk
index 52e80a3..860c79b 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 '<a href="' | \
@@ -41,8 +44,7 @@ endef
define $(PKG)_BUILD_$(BUILD)
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
- --prefix='$(PREFIX)/$(TARGET)' \
- --disable-shared
+ $(MXE_CONFIGURE_OPTS)
$(MAKE) -C '$(1).build' -j '$(JOBS)' man1_MANS=
$(MAKE) -C '$(1).build' -j 1 install man1_MANS=
endef
diff --git a/src/isl.mk b/src/isl.mk
index 6651902..348ea33 100644
--- a/src/isl.mk
+++ b/src/isl.mk
@@ -9,8 +9,11 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.bz2
$(PKG)_URL := http://isl.gforge.inria.fr/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://gcc.gnu.org/pub/gcc/infrastructure/$($(PKG)_FILE)
+$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)
$(PKG)_DEPS := gcc gmp
+$(PKG)_DEPS_$(BUILD) := gmp
+
# stick to tested versions from gcc
define $(PKG)_UPDATE
$(WGET) -q -O- 'ftp://gcc.gnu.org/pub/gcc/infrastructure/' | \
@@ -21,10 +24,7 @@ endef
define $(PKG)_BUILD
cd '$(1)' && ./configure \
- --host='$(TARGET)' \
- --enable-static \
- --disable-shared \
- --prefix='$(PREFIX)/$(TARGET)' \
+ $(MXE_CONFIGURE_OPTS) \
--with-gmp-prefix='$(PREFIX)/$(TARGET)'
$(MAKE) -C '$(1)' -j '$(JOBS)'
$(MAKE) -C '$(1)' -j '$(JOBS)' install
diff --git a/src/mpc.mk b/src/mpc.mk
index 047efb6..5a7de48 100644
--- a/src/mpc.mk
+++ b/src/mpc.mk
@@ -9,22 +9,28 @@ $(PKG)_SUBDIR := mpc-$($(PKG)_VERSION)
$(PKG)_FILE := mpc-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := http://www.multiprecision.org/mpc/download/$($(PKG)_FILE)
$(PKG)_URL_2 := http://ftp.debian.org/debian/pool/main/m/mpclib/mpclib_$($(PKG)_VERSION).orig.tar.gz
+$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)
$(PKG)_DEPS := gcc gmp mpfr
+$(PKG)_DEPS_$(BUILD) := gmp mpfr
+
define $(PKG)_UPDATE
$(WGET) -q -O- 'https://gforge.inria.fr/scm/viewvc.php/tags/?root=mpc&sortby=date' | \
$(SED) -n 's,.*<a name="\([0-9][^"]*\)".*,\1,p' | \
head -1
endef
-define $(PKG)_BUILD
+define $(PKG)_BUILD_$(BUILD)
cd '$(1)' && ./configure \
$(MXE_CONFIGURE_OPTS) \
--with-gmp='$(PREFIX)/$(TARGET)/' \
--with-mpfr='$(PREFIX)/$(TARGET)/'
$(MAKE) -C '$(1)' -j '$(JOBS)'
$(MAKE) -C '$(1)' -j '$(JOBS)' install
+endef
+define $(PKG)_BUILD
+ $($(PKG)_BUILD_$(BUILD))
# build runtime tests to verify toolchain components
-$(MAKE) -C '$(1)' -j '$(JOBS)' check -k
rm -rf '$(PREFIX)/$(TARGET)/bin/$(PKG)-tests'
diff --git a/src/mpfr.mk b/src/mpfr.mk
index 4a14146..43fe8c0 100644
--- a/src/mpfr.mk
+++ b/src/mpfr.mk
@@ -9,8 +9,11 @@ $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.xz
$(PKG)_URL := ftp://ftp.gnu.org/pub/gnu/$(PKG)/$($(PKG)_FILE)
$(PKG)_URL_2 := http://www.mpfr.org/mpfr-$($(PKG)_VERSION)/$($(PKG)_FILE)
+$(PKG)_TARGETS := $(BUILD) $(MXE_TARGETS)
$(PKG)_DEPS := gcc gmp
+$(PKG)_DEPS_$(BUILD) := gmp
+
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://www.mpfr.org/mpfr-current/#download' | \
grep 'mpfr-' | \
@@ -37,3 +40,12 @@ define $(PKG)_BUILD
printf 'for /R %%%%f in (*.exe) do %%%%f || echo %%%%f fail >> 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
diff --git a/src/mxe-conf.mk b/src/mxe-conf.mk
index 5d814de..b1afedf 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)
diff --git a/src/pkgconf.mk b/src/pkgconf.mk
index dffbfc9..657d995 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 dc21cb6..92c4c90 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
diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua
index 856977b..4b47b14 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'
@@ -43,47 +43,15 @@ 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/',
}
-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'
-
local TARGETS = {
'i686-w64-mingw32.static',
'x86_64-w64-mingw32.static',
@@ -91,10 +59,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
@@ -129,14 +95,27 @@ 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
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 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')
@@ -179,34 +158,27 @@ 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)
+local NATIVE_TARGET = trim(shell("ext/config.guess"))
+local function isCross(target)
+ return target ~= NATIVE_TARGET
+end
+
+-- 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))
@@ -214,29 +186,36 @@ 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
+ 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()
- 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()
@@ -244,8 +223,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)
@@ -315,12 +294,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'
@@ -330,73 +310,68 @@ 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
+ if t ~= target and isInString(t, file) 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 isInString(target, file) and isCross(target) 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 function buildItem(item, item2deps, file2item)
+ 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 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)
@@ -409,7 +384,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
@@ -429,8 +405,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
@@ -451,9 +428,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))
@@ -462,6 +436,9 @@ local function makeDeb(pkg, list_path, deps, ver, add_common)
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'
@@ -471,14 +448,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
@@ -487,7 +456,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
@@ -498,96 +468,48 @@ 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
- 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)
+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
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()
local index_html = io.open 'index.html'
local text = index_html:read('*all')
@@ -654,10 +576,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')