summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2016-08-02 18:53:13 (GMT)
committerTony Theodore <tonyt@logyst.com>2016-08-11 16:54:56 (GMT)
commitca90832bd76582aa61a85b49429006d1021217f6 (patch)
treeb7885a2acf64e7a5ac832135be2068bfcb89b6e5 /Makefile
parentc7218bfbc45d182e59ba3c3543cde6e591fbe92a (diff)
downloadmxe-ca90832bd76582aa61a85b49429006d1021217f6.zip
mxe-ca90832bd76582aa61a85b49429006d1021217f6.tar.gz
mxe-ca90832bd76582aa61a85b49429006d1021217f6.tar.bz2
Makefile: enable local $(PKG)_SOURCE_TREE
This is very handy for testing against a local repo, especially when upstream changes are happening quickly. See also #183
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 20 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 96c8d94..a8d2b1a 100644
--- a/Makefile
+++ b/Makefile
@@ -201,17 +201,25 @@ PKG_PATCHES = $(if $(findstring undefined,$(origin $(1)_PATCHES)), \
$($(1)_PATCHES))
define PREPARE_PKG_SOURCE
- cd '$(2)' && $(call UNPACK_PKG_ARCHIVE,$(1))
- cd '$(2)/$($(1)_SUBDIR)'
- $(foreach PKG_PATCH,$(PKG_PATCHES),
- (cd '$(2)/$($(1)_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
+ $(if $($(1)_SOURCE_TREE),\
+ ln -si '$(realpath $($(1)_SOURCE_TREE))' '$(2)/$($(1)_SUBDIR)'
+ $(else),\
+ cd '$(2)' && $(call UNPACK_PKG_ARCHIVE,$(1))
+ cd '$(2)/$($(1)_SUBDIR)'
+ $(foreach PKG_PATCH,$(PKG_PATCHES),
+ (cd '$(2)/$($(1)_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
+ )
endef
PKG_CHECKSUM = \
openssl dgst -sha256 '$(PKG_DIR)/$($(1)_FILE)' 2>/dev/null | $(SED) -n 's,^.*\([0-9a-f]\{64\}\)$$,\1,p'
CHECK_PKG_ARCHIVE = \
- [ '$($(1)_CHECKSUM)' == "`$$(call PKG_CHECKSUM,$(1))`" ]
+ $(if $($(1)_SOURCE_TREE),\
+ $(PRINTF_FMT) '[local]' '$(1)' '$($(1)_SOURCE_TREE)' | $(RTRIM)\
+ $(else),\
+ [ '$($(1)_CHECKSUM)' == "`$$(call PKG_CHECKSUM,$(1))`" ]\
+ )
ESCAPE_PKG = \
echo '$($(1)_FILE)' | perl -lpe 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($$$$1))/seg'
@@ -222,6 +230,9 @@ BACKUP_DOWNLOAD = \
$(WGET) -O- $(PKG_CDN)/`$(call ESCAPE_PKG,$(1))`))
DOWNLOAD_PKG_ARCHIVE = \
+ $(if $($(1)_SOURCE_TREE),\
+ true\
+ $(else),\
mkdir -p '$(PKG_DIR)' && ( \
$(WGET) -T 30 -t 3 -O- '$($(1)_URL)' \
$(if $($(1)_URL_2), \
@@ -237,7 +248,8 @@ DOWNLOAD_PKG_ARCHIVE = \
( echo; \
echo 'Download failed!'; \
echo; \
- rm -f '$(PKG_DIR)/$($(1)_FILE)'; )
+ rm -f '$(PKG_DIR)/$($(1)_FILE)'; )\
+ )
# open issue from 2002:
# http://savannah.gnu.org/bugs/?712
@@ -538,8 +550,8 @@ build-only-$(1)_$(3): LIB_SUFFIX = $(if $(findstring shared,$(3)),dll,a)
build-only-$(1)_$(3): BITS = $(if $(findstring x86_64,$(3)),64,32)
build-only-$(1)_$(3): BUILD_TYPE = $(if $(findstring debug,$(3) $($(1)_CONFIGURE_OPTS)),debug,release)
build-only-$(1)_$(3): BUILD_TYPE_SUFFIX = $(if $(findstring debug,$(3) $($(1)_CONFIGURE_OPTS)),d)
-build-only-$(1)_$(3): SOURCE_DIR = $(2)/$($(1)_SUBDIR)
-build-only-$(1)_$(3): BUILD_DIR = $(2)/$($(1)_SUBDIR).build_
+build-only-$(1)_$(3): SOURCE_DIR = $(or $($(1)_SOURCE_TREE),$(2)/$($(1)_SUBDIR))
+build-only-$(1)_$(3): BUILD_DIR = $(2)/$(if $($(1)_SOURCE_TREE),local,$($(1)_SUBDIR)).build_
build-only-$(1)_$(3): TEST_FILE = $($(1)_TEST_FILE)
build-only-$(1)_$(3): CMAKE_RUNRESULT_FILE = $(PREFIX)/share/cmake/modules/TryRunResults.cmake
build-only-$(1)_$(3): CMAKE_TOOLCHAIN_FILE = $(PREFIX)/$(3)/share/cmake/mxe-conf.cmake