diff options
author | Tony Theodore <tonyt@logyst.com> | 2016-01-08 13:12:24 (GMT) |
---|---|---|
committer | Tony Theodore <tonyt@logyst.com> | 2016-01-08 13:12:24 (GMT) |
commit | 9ed7e2d92e7bdc3cf884332a00d821eb42f5aad5 (patch) | |
tree | ac8f7f2233796394ed595e6d92f8465939abb78d /tools/patch-tool-mxe | |
parent | 72477c9ac2dd029ce29d0f563492dde408a3093b (diff) | |
parent | 0edd0899ba948fc2ce775d257eb35c6efc3347f7 (diff) | |
download | mxe-9ed7e2d92e7bdc3cf884332a00d821eb42f5aad5.zip mxe-9ed7e2d92e7bdc3cf884332a00d821eb42f5aad5.tar.gz mxe-9ed7e2d92e7bdc3cf884332a00d821eb42f5aad5.tar.bz2 |
Merge pull request #1134 from LuaAndC/fix-patch-tool
reimplement patch-tool-mxe in Makefile
Diffstat (limited to 'tools/patch-tool-mxe')
-rwxr-xr-x | tools/patch-tool-mxe | 116 |
1 files changed, 12 insertions, 104 deletions
diff --git a/tools/patch-tool-mxe b/tools/patch-tool-mxe index ab021cb..b7720e6 100755 --- a/tools/patch-tool-mxe +++ b/tools/patch-tool-mxe @@ -10,122 +10,26 @@ patch_name=${3:-1-fixes} setupEnv() { # MXE directory export mxedir=$(cd $(dirname $0) && cd .. && pwd) - - # directory for unpacked tarballs/git repos - export gitsdir=${mxedir}/gits - - mkdir -p ${gitsdir} - - - export pkg_version=`grep '^$(PKG)_VERSION' $mxedir/src/$pkg.mk | \ - sed 's/.*:= \(.*\)/\1/'` - - export pkg_short_version=`echo $pkg_version | sed s/'\(.*\)\.[^.]*$'/'\1'/` - - export pkg_subdir=`grep '^$(PKG)_SUBDIR' $mxedir/src/$pkg.mk | \ - sed 's/.*:= \(.*\)/\1/' | \ - sed s/'$($(PKG)_VERSION)'/$pkg_version/ | \ - sed s/'$(call SHORT_PKG_VERSION,$(PKG))'/$pkg_short_version/ | \ - sed s/'$(PKG)'/$pkg/;` - - export pkg_file=`grep '^$(PKG)_FILE\>' $mxedir/src/$pkg.mk | \ - sed 's/.*:= \(.*\)/\1/' | \ - sed s/'$($(PKG)_VERSION)'/$pkg_version/ | \ - sed s/'$(call SHORT_PKG_VERSION,$(PKG))'/$pkg_short_version/ | \ - sed s/'$($(PKG)_SUBDIR)'/$pkg_subdir/ | \ - sed s/'$(PKG)'/$pkg/;` - - #echo $pkg - #echo $pkg_version - #echo $pkg_subdir - #echo $pkg_file - } -# init + function init_git { setupEnv - cd $gitsdir - - if [ -d $gitsdir/$pkg_subdir ]; then - echo "Error: $gitsdir/$pkg_subdir already exists. Cancelling init." >&2 - exit 1 - fi - - echo "Checking for cached $pkg_file" - if [ ! -f $mxedir/pkg/$pkg_file ]; then - make -C "$mxedir" download-only-$pkg - echo "Building the mxe Makefile target 'download-only-$pkg' to get missing file" - if [ ! $? -eq 0 ]; then - echo "Could not build target download-only-$pkg - cancelling init." >&2 - exit 1 - fi - fi - - echo "Unpacking archive..." - (echo $pkg_file | grep "\.tar\.gz") || (echo $pkg_file | grep "\.tgz") \ - >> /dev/null && tar xf $mxedir/pkg/$pkg_file - (echo $pkg_file | grep "\.tar\.bz2") || (echo $pkg_file | grep "\.tbz2") \ - >> /dev/null && tar xf $mxedir/pkg/$pkg_file - (echo $pkg_file | grep "\.tar\.xz") || (echo $pkg_file | grep "\.txz") \ - >> /dev/null && xz -dc $mxedir/pkg/$pkg_file | tar xf - - echo $pkg_file | grep "\.zip" >> /dev/null && unzip $mxedir/pkg/$pkg_file >> /dev/null - - echo "Initializing repo and adding all as first commit" - cd $gitsdir/$pkg_subdir && \ - (git init; git add -A; git commit -m "init") > /dev/null - - echo "Creating 'dist' tag for distribution tarball state" - git tag dist - - echo "Repository ready in $gitsdir/$pkg_subdir" + make -C $mxedir init-git-$pkg } function export_patch { setupEnv - if [ ! -d $gitsdir/$pkg_subdir ]; then - echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot export patches. Cancelling export." >&2 - exit 1 - fi - - cd $gitsdir/$pkg_subdir && \ - ( - echo 'This file is part of MXE.' - echo 'See index.html for further information.' - echo '' - echo 'Contains ad hoc patches for cross building.' - echo '' - git format-patch \ - --no-numbered \ - -p \ - --no-signature \ - --stdout \ - --text \ - dist..HEAD | \ - sed 's/^From [0-9a-f]\{40\} /From 0000000000000000000000000000000000000000 /' | \ - sed 's/^index .......\.\......../index 1111111..2222222/' - ) > $mxedir/src/${pkg}-${patch_name}.patch && \ - echo "Generated ${mxedir}/src/${pkg}-${patch_name}.patch" + make -C $mxedir export-patch-$pkg PATCH_NAME=${patch_name} } function import_patch { setupEnv - if [ ! -d $gitsdir/$pkg_subdir ]; then - echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot import patches. Cancelling import - try 'init' first." >&2 - exit 1 - fi + make -C $mxedir import-patch-$pkg PATCH_NAME=${patch_name} +} - if [ -f ${mxedir}/src/${pkg}-${patch_name}.patch ]; then - cd $gitsdir/$pkg_subdir && \ - cat ${mxedir}/src/${pkg}-${patch_name}.patch | \ - sed '/^From/,$ !d' | \ - sed s/'^From: MXE'/"From: fix@me"/'g;' | \ - git am --keep-cr && \ - echo "Imported ${mxedir}/src/${pkg}-${patch_name}.patch" - else - echo "patch file ${mxedir}/src/${pkg}-${patch_name}.patch not found." - echo "Cancelling import." >&2 - exit 1 - fi +function import_all_patches { + setupEnv + make -C $mxedir import-all-patches-$pkg } case "$cmd" in @@ -135,6 +39,9 @@ case "$cmd" in import) import_patch $pkg ;; + import-all) + import_all_patches $pkg + ;; export) export_patch $pkg ;; @@ -145,6 +52,7 @@ case "$cmd" in where COMMAND is one of: init - create a git directory for the package with the raw source import - apply the "pkgname-PATCHNAME.patch" patch commits + import-all - apply commits from all the patches of the package export - create/replace the "pkgname-PATCHNAME.patch" patch with a patch of all commits since init. If PATCHNAME is not set, it is default to "1-fixes". |