diff options
Diffstat (limited to 'make.sh')
-rwxr-xr-x | make.sh | 108 |
1 files changed, 47 insertions, 61 deletions
@@ -9,21 +9,23 @@ fi export PKG_MAKE=$0 export PKG_NAME=${1%_} - export PKG_BASE=$(realpath "$(dirname "$0")") -#export PATH=${PKG_BASE}/util:$PATH + . "${PKG_BASE}/helper.sh" -for dep in "${PKG_DEPS[@]}"; do - "${PKG_MAKE}" "$(basename "${dep}" .dep)" -done +if [[ ! -x ${PKG_BASE}/util/ldid || ${PKG_BASE}/util/ldid -ot ${PKG_BASE}/util/ldid.cpp ]]; then + g++ -I ~/menes -o "${PKG_BASE}"/util/ldid{,.cpp} -x c "${PKG_BASE}"/util/lookup2.c +fi + +#for DEP_NAME in "${PKG_DEPS[@]}"; do +# "${PKG_MAKE}" "${DEP_NAME}" +#done export PKG_HASH=$({ - find -L "${PKG_DATA}" \( -name '.svn' -o -name '_*' \) -prune -o -type f -print0 | sort -z | xargs -0 cat - for dep in "${PKG_DEPS[@]}"; do - DEP_NAME=$(basename "${dep}" .dep) - DEP_DEST=${PKG_BASE}/dest/${DEP_NAME} - "${PKG_BASE}"/util/catdir.sh "${DEP_DEST}" + "${PKG_BASE}"/util/catdir.sh -L "${PKG_DATA}" \( -name '.svn' -o -name '_*' \) -prune -o + + for DEP_NAME in "${PKG_DEPS[@]}"; do + "${PKG_BASE}"/util/catdir.sh "$(PKG_DEST_ "${DEP_NAME}")" done } | md5sum | cut -d ' ' -f 1) @@ -38,18 +40,10 @@ mkdir -p "${PKG_STAT}" rm -f "${PKG_STAT}/data-md5" rm -rf "${PKG_DEST}" -mkdir "${PKG_DEST}" +mkdir -p "${PKG_DEST}" rm -rf "${PKG_WORK}" -mkdir "${PKG_WORK}" - -function PKG_DATA_() { - echo "${PKG_BASE}/data/$1" -} - -function PKG_WORK_() { - echo "${PKG_BASE}/work/$1" -} +mkdir -p "${PKG_WORK}" function pkg:patch() { for diff in "${PKG_DATA}"/*.diff; do @@ -57,6 +51,8 @@ function pkg:patch() { done } +export -f pkg:patch + function pkg:bin() { if [[ $# -eq 0 ]]; then pushd "${PKG_DEST}/usr/bin" @@ -72,17 +68,28 @@ function pkg:bin() { rmdir --ignore-fail-on-non-empty -p "${PKG_DEST}/usr/bin" } +export -f pkg:bin + +function pkg:autoconf() { + for m4 in $(find -name "*.m4"); do + patch -r/dev/null "${m4}" "${PKG_BASE}/util/libtool.m4.diff" || true + done + + autoconf +} + +export -f pkg:autoconf + export PKG_CONF=./configure function pkg:configure() { for ltmain in $(find -name ltmain.sh); do - patch "${ltmain}" "${PKG_BASE}/util/libtool.diff" || true + patch -r/dev/null "${ltmain}" "${PKG_BASE}/util/libtool.diff" || true done - PKG_CONFIG="$(realpath "${PKG_BASE}/util/pkg-config.sh") --define-variable=prefix=${PKG_ROOT}/usr" \ - PKG_CONFIG_PATH=${PKG_ROOT}/usr/lib/pkgconfig \ + PKG_CONFIG="$(realpath "${PKG_BASE}/util/pkg-config.sh")" \ "${PKG_CONF}" \ - --host=arm-apple-darwin \ + --host="${PKG_TARG}" \ --enable-static=no \ --enable-shared=yes \ --prefix=/usr \ @@ -90,65 +97,39 @@ function pkg:configure() { "$@" } +export -f pkg:configure + function pkg:install() { make install DESTDIR="${PKG_DEST}" "$@" } -function pkg_ { - case "${1:0:1}" in - (/) echo "${PKG_DEST}$1";; - (%) echo "${PKG_DATA}${1:1}";; - (*) echo -"$1" | sed -e 's/^.//';; - esac -} - -function pkg: { - declare -a argv - declare argc=$# - - for ((i=0; $i != $argc; ++i)); do - argv[$i]=$(pkg_ "$1") - shift - done - - "${argv[@]}" -} +export -f pkg:install function pkg:extract() { for tgz in "${PKG_DATA}"/{*.tar.gz,*.tgz}; do tar -zxvf "${tgz}" done + for zip in "${PKG_DATA}"/*.zip; do unzip "${zip}" done + for tbz2 in "${PKG_DATA}"/*.tar.bz2; do tar -jxvf "${tbz2}" done } -function pkg:owner() { - owner=$1 - shift - - for file in "$@"; do - chown "${owner}" "${PKG_DEST}${file}" - done -} +export -f pkg:extract function pkg:usrbin() { pkg: mkdir -p /usr/bin pkg: cp -a "$@" /usr/bin } -function pkg:mkdir() { - for dir in "$@"; do - mkdir -p "${PKG_DEST}${dir}" - done -} +export -f pkg:usrbin cd "${PKG_WORK}" -. "${PKG_DATA}/make.sh" -tar -zcf- -C "${PKG_DEST}" . | tar -zxf- -C "${PKG_ROOT}" +"${PKG_BASE}/exec.sh" "${PKG_NAME}" . "${PKG_DATA}/make.sh" function rmdir_() { if [[ -d "$1" ]]; then @@ -176,9 +157,14 @@ rmdir_ "${PKG_DEST}/usr/local" rmdir_ "${PKG_DEST}/usr/lib" rmdir_ "${PKG_DEST}/usr" -if [[ -e "${PKG_DEST}"{/usr,}/?(s)bin ]]; then - find "${PKG_DEST}"{/usr,}/?(s)bin -type f -exec arm-apple-darwin-strip {} \; -fi +find "${PKG_DEST}" -type f -perm -0500 -print0 | while read -r -d $'\0' bin; do + case "$(file "${bin}")" in (\ + *': Mach-O executable acorn' |\ + *': Mach-O dynamically linked shared library acorn'\ + );; (*) continue;; esac + + "${PKG_TARG}-strip" -x -no_uuid "${bin}" +done cp -a "${PKG_DATA}/_metadata/version" "${PKG_STAT}/data-ver" echo "${PKG_HASH}" >"${PKG_STAT}/data-md5" |