buildsystem: rework patching. prepare to remove patches.upstream/

This commit is contained in:
Stefan Saraev 2014-01-02 13:59:46 +02:00
parent 244c8fab2d
commit f920a33507
2 changed files with 13 additions and 6 deletions

View File

@ -55,6 +55,13 @@ setup_toolchain() {
fi
}
apply_patch() {
patch -d "$2" -p0 -f --dry-run < $1 &> /dev/null && patch -d "$2" -p0 < $1 && return 0
patch -d "$2" -p1 -f --dry-run < $1 &> /dev/null && patch -d "$2" -p1 < $1 && return 0
echo "*** Failed to apply '$1'! ***"
return 1
}
kernel_path() {
if [ -f $ROOT/packages/linux/package.mk ] ; then
. $ROOT/packages/linux/package.mk

View File

@ -74,6 +74,9 @@ fi
printf "%${BUILD_INDENT}c ${boldcyan}UNPACK${endcolor} $1\n" ' '>&$SILENT_OUT
export BUILD_INDENT=$((${BUILD_INDENT:-1}+$BUILD_INDENT_SIZE))
# todo: deprecated
[ -f "$PKG_DIR/unpack" ] && $PKG_DIR/unpack $@ >&$VERBOSE_OUT
if [ -n "$PKG_URL" ]; then
$SCRIPTS/extract $1 "$1*.tar.bz2" $BUILD
$SCRIPTS/extract $1 "$1*.tbz" $BUILD
@ -103,7 +106,7 @@ for i in $PKG_DIR/patches/$PKG_NAME-*.patch ; do
continue;
else
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}(common)${endcolor} $i\n" ' '>&$SILENT_OUT
cat $i | patch -d `echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 >&$VERBOSE_OUT
apply_patch $i $PKG_BUILD || exit 1
fi
fi
done
@ -117,7 +120,7 @@ for i in $PKG_DIR/patches/$PKG_VERSION/*.patch ; do
continue;
else
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}($PKG_VERSION)${endcolor} $i\n" ' '>&$SILENT_OUT
cat $i | patch -d `echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 >&$VERBOSE_OUT
apply_patch $i $PKG_BUILD || exit 1
fi
fi
done
@ -131,7 +134,7 @@ for i in $PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch ; do
continue;
else
printf "%${BUILD_INDENT}c ${boldgreen}APPLY PATCH${endcolor} ${boldwhite}(project)${endcolor} $i\n" ' '>&$SILENT_OUT
cat $i | patch -d `echo "$PKG_BUILD" | cut -f1 -d\ ` -p1 >&$VERBOSE_OUT
apply_patch $i $PKG_BUILD || exit 1
fi
fi
done
@ -151,9 +154,6 @@ if [ -f $PKG_DIR/package.mk ]; then
fi
fi
# todo: deprecated
[ -f "$PKG_DIR/unpack" ] && $PKG_DIR/unpack $@ >&$VERBOSE_OUT
for config in `find $BUILD/$1* -name config.guess | sed 's/config.guess//'`; do
printf "%${BUILD_INDENT}c ${boldyellow}FIXCONFIG${endcolor} $config\n" ' '>&$SILENT_OUT