2014-09-18 20:52:32 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-07-28 17:56:57 +08:00
|
|
|
# BasedOn: http://blog.coolaj86.com/articles/how-to-unpackage-and-repackage-pkg-osx.html
|
|
|
|
# Also: https://gist.github.com/SchizoDuckie/2a1a1cc71284e6463b9a
|
2014-09-18 20:52:32 +08:00
|
|
|
|
|
|
|
# to uninstall:
|
|
|
|
# sudo pkgutil --forget org.radare.radare2
|
|
|
|
|
|
|
|
SRC=/tmp/r2osx
|
2016-03-23 02:24:25 +08:00
|
|
|
PREFIX=/usr/local
|
2015-06-17 10:59:01 +08:00
|
|
|
DST="$(pwd)/sys/osx-pkg/radare2.unpkg"
|
2016-07-07 06:32:59 +08:00
|
|
|
if [ -n "$1" ]; then
|
|
|
|
VERSION="$1"
|
|
|
|
else
|
2021-07-28 17:56:57 +08:00
|
|
|
# VERSION="`./configure --version| head -n 1|awk '{print $1}'|cut -d - -f 2`"
|
|
|
|
VERSION="`./configure -qV`"
|
|
|
|
[ -z "${VERSION}" ] && VERSION=`r2 -qv`
|
|
|
|
[ -z "${VERSION}" ] && VERSION=5.4.0
|
2016-07-07 06:32:59 +08:00
|
|
|
fi
|
2016-04-26 20:35:51 +08:00
|
|
|
[ -z "${MAKE}" ] && MAKE=make
|
2014-09-18 20:52:32 +08:00
|
|
|
|
2015-03-11 22:28:39 +08:00
|
|
|
rm -rf "${SRC}"
|
2016-12-10 08:39:27 +08:00
|
|
|
${MAKE} mrproper 2>/dev/null
|
2021-07-28 17:56:57 +08:00
|
|
|
export CFLAGS="-O2"
|
2019-06-27 02:15:54 +08:00
|
|
|
./configure --prefix="${PREFIX}" --without-libuv || exit 1
|
2016-04-26 20:35:51 +08:00
|
|
|
${MAKE} -j4 || exit 1
|
2014-09-18 20:52:32 +08:00
|
|
|
# TODO: run sys/install.sh
|
2016-04-26 20:35:51 +08:00
|
|
|
${MAKE} install PREFIX="${PREFIX}" DESTDIR=${SRC} || exit 1
|
2015-03-11 22:28:39 +08:00
|
|
|
if [ -d "${SRC}" ]; then
|
|
|
|
(
|
|
|
|
cd ${SRC} && \
|
2021-07-28 17:56:57 +08:00
|
|
|
find . | cpio -o --format odc | gzip -9 -c > "${DST}/Payload"
|
2015-03-11 22:28:39 +08:00
|
|
|
)
|
|
|
|
mkbom ${SRC} "${DST}/Bom"
|
|
|
|
# Repackage
|
|
|
|
pkgutil --flatten "${DST}" "${DST}/../radare2-${VERSION}.pkg"
|
|
|
|
else
|
|
|
|
echo "Failed install. DESTDIR is empty"
|
|
|
|
exit 1
|
|
|
|
fi
|