From 3ea682b14ed5240b7d5f3bb65237f8e6a8005062 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sun, 23 Dec 2018 23:17:26 +1100 Subject: [PATCH] build-pkg changes --- Makefile | 4 ++-- tools/build-pkg.lua | 47 +++++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index b1b6e0b6..49245ab2 100644 --- a/Makefile +++ b/Makefile @@ -705,7 +705,7 @@ $(PREFIX)/$(3)/installed/$(1): $(PKG_MAKEFILES) \ $(if $(BUILD_DRY_RUN)$(MXE_BUILD_DRY_RUN), \ @$(PRINTF_FMT) '[dry-run]' '$(1)' '$(3)' | $(RTRIM) @[ -d '$(PREFIX)/$(3)/lib' ] || mkdir -p '$(PREFIX)/$(3)/lib' - @touch '$(PREFIX)/$(3)/lib/$(1).dry-run' + @echo $(1)~$(3) > '$(PREFIX)/$(3)/lib/$(1).dry-run' @touch '$(PREFIX)/$(3)/installed/$(1)' $(else), @$(PRINTF_FMT) '[build]' '$(1)' '$(3)' | $(RTRIM) @@ -907,7 +907,7 @@ print-deps-for-build-pkg: $(if $(or $(value $(call LOOKUP_PKG_RULE,$(PKG),BUILD,$(TARGET))), \ $(filter $($(PKG)_TYPE),$(BUILD_PKG_TYPES))), \ $(info $(strip for-build-pkg $(TARGET)~$(PKG) \ - $(subst $(space),-,$($(PKG)_VERSION)) \ + $(subst $(space),-,$($(PKG)_VERSION)-$(OS_SHORT_NAME)) \ $(subst /installed/,~,$(PKG_DEPS) $(PKG_OO_DEPS))))))) @echo -n diff --git a/tools/build-pkg.lua b/tools/build-pkg.lua index 46b9db58..3588c431 100755 --- a/tools/build-pkg.lua +++ b/tools/build-pkg.lua @@ -52,20 +52,23 @@ How to remove them: https://stackoverflow.com/a/4262545 Alternatively, to switch off using fakeroot (e.g. inside docker), set MXE_BUILD_PKG_NO_FAKEROOT to 1. -Bootstrapped build (non-debian systems building w/o deb pkgs): -export MXE_DIR=/path/to/mxe && \ +Bootstrapped build (non-debian systems building without +deb pkgs to test print-deps-for-build-pkg, control files etc.): + +export MXE_DIR=`pwd` && \ export BUILD=`$MXE_DIR/ext/config.guess` && \ -rm -rf $MXE_DIR/usr* && \ +rm -rf $MXE_DIR/usr $MXE_DIR/log $MXE_DIR/mxe-* && \ make -C $MXE_DIR lua \ MXE_TARGETS=$BUILD \ lua_TARGETS=$BUILD \ PREFIX=$MXE_DIR/usr.lua && \ -MXE_BUILD_PKG_TARGETS="`echo {i686-w64-mingw32,x86_64-w64-mingw32}.{static,shared}`" \ -MXE_BUILD_PKG_PKGS= \ +MXE_BUILD_PKG_CODENAME=trusty \ +MXE_BUILD_PKG_TARGETS="i686-w64-mingw32.static" \ +MXE_BUILD_PKG_PKGS=qt5 \ MXE_BUILD_DRY_RUN=1 \ MXE_BUILD_PKG_MAX_ITEMS= \ MXE_BUILD_PKG_NO_DEBS=1 \ -MXE_BUILD_PKG_NO_SECOND_PASS=0 \ +MXE_BUILD_PKG_NO_SECOND_PASS=1 \ $MXE_DIR/usr.lua/$BUILD/bin/lua $MXE_DIR/tools/build-pkg.lua ]] @@ -870,7 +873,7 @@ end local D1 = "MXE package %s for %s" local D2 = "This package contains the files for MXE package %s" -local function makeDeb(item, files, deps, ver) +local function makeDeb(item, files, deps, ver, codename) local target, pkg = parseItem(item) local deb_pkg = nameToDebian(item) local d1 = D1:format(pkg, target) @@ -879,7 +882,7 @@ local function makeDeb(item, files, deps, ver) for _, dep in ipairs(deps) do table.insert(deb_deps, nameToDebian(dep)) end - makePackage(deb_pkg, files, deb_deps, ver, d1, d2) + makePackage(deb_pkg, files, deb_deps, ver, d1, d2, codename) end local function findForeignInstalls(item, files) @@ -1001,12 +1004,12 @@ local function buildPackages(items, item2deps, pass, prev_item2files) return unbroken, item2files end -local function makeDebs(items, item2deps, item2ver, item2files) +local function makeDebs(items, item2deps, item2ver, item2files, codename) for _, item in ipairs(items) do local deps = assert(item2deps[item], item) local ver = assert(item2ver[item], item) local files = assert(item2files[item], item) - makeDeb(item, files, deps, ver) + makeDeb(item, files, deps, ver, codename) end end @@ -1022,9 +1025,8 @@ local MXE_REQUIREMENTS_DESCRIPTION2 = Other MXE packages depend on this package.]] local function makeMxeRequirementsPackage(release) - os.execute(('mkdir -p %s'):format(release)) local name = 'mxe-requirements' - local ver = getMxeVersion() .. release + local ver = getMxeVersion() .. '-' .. release -- MXE build requirements should not be strict dependencies here -- See https://github.com/mxe/mxe/issues/1537 local deps = {} @@ -1057,9 +1059,9 @@ local MXE_SOURCE_DESCRIPTION2 = [[This package contains MXE source files. Other MXE packages depend on this package.]] -local function makeMxeSourcePackage() +local function makeMxeSourcePackage(codename) local name = 'mxe-source' - local ver = getMxeVersion() + local ver = getMxeVersion() .. '-' .. codename -- dependencies local deps = {} local files = { @@ -1077,7 +1079,7 @@ local function makeMxeSourcePackage() } local d1 = "MXE source" local d2 = MXE_SOURCE_DESCRIPTION2 - makePackage(name, files, deps, ver, d1, d2) + makePackage(name, files, deps, ver, d1, d2, codename) end local function downloadPackages() @@ -1094,7 +1096,12 @@ local function downloadPackages() error('downloading failed') end + local function main() + local codename = os.getenv('MXE_BUILD_PKG_CODENAME') + or trim(shell('(lsb_release -sc 2>/dev/null || uname -s) | tr [:upper:] [:lower:]')) + assert(codename ~= '') + log("Building for: %s", codename) assert(not io.open('usr/.git'), 'Remove usr/') local MXE_DIR_EXPECTED = '/usr/lib/mxe' if MXE_DIR ~= MXE_DIR_EXPECTED then @@ -1127,12 +1134,10 @@ local function main() makeItem2Index(build_list), 'first' ) - makeDebs(unbroken, item2deps, item2ver, item2files) - if not no_debs then - makeMxeRequirementsPackage('wheezy') - makeMxeRequirementsPackage('jessie') - end - makeMxeSourcePackage() + os.execute(('mkdir -p %s'):format(codename)) + makeDebs(unbroken, item2deps, item2ver, item2files, codename) + makeMxeRequirementsPackage(codename) + makeMxeSourcePackage(codename) if not no_second_pass then local unbroken_second = buildPackages( build_list, item2deps, 'second', item2files