Skip to content

Commit

Permalink
build: Adapt ports to a new common definitions of paths (prefixes)
Browse files Browse the repository at this point in the history
JIRA: NIL-595, CI-339
  • Loading branch information
Darchiv committed Sep 20, 2024
1 parent 86f00c5 commit 89d1aff
Show file tree
Hide file tree
Showing 21 changed files with 221 additions and 287 deletions.
18 changes: 7 additions & 11 deletions azure_sdk/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,20 @@ install_binary () {
AZURE_VER="lts_01_2022"
AZURE="azure-iot-sdk-c"

PREFIX_AZURE="${PREFIX_PROJECT}/phoenix-rtos-ports/azure_sdk"
PREFIX_AZURE_BUILD="${PREFIX_BUILD}/azure_sdk"
PREFIX_AZURE_SRC="${PREFIX_AZURE_BUILD}/${AZURE}-${AZURE_VER}"
PREFIX_AZURE_MARKERS="${PREFIX_AZURE_BUILD}/markers"
PREFIX_AZURE_ROOT="${PREFIX_AZURE_BUILD}/root"
PREFIX_AZURE_SRC="${PREFIX_PORT_BUILD}/${AZURE}-${AZURE_VER}"
PREFIX_AZURE_MARKERS="${PREFIX_PORT_BUILD}/markers"
PREFIX_AZURE_ROOT="${PREFIX_PORT_BUILD}/root"
PREFIX_AZURE_LIB="${PREFIX_AZURE_ROOT}/lib"
PREFIX_AZURE_INC="${PREFIX_AZURE_ROOT}/include"
PREFIX_AZURE_PATCHES="${PREFIX_AZURE}/patches"

b_log "Building azure iot sdk"
PREFIX_AZURE_PATCHES="${PREFIX_PORT}/patches"

update_options=(--init)
if [ "${LONG_TEST}" = "y" ]; then
update_options=("${update_options[@]}" --recursive)
fi

# Download in the specified version, it can't be done via wget, because tar.gz does not include submodules
mkdir -p "${PREFIX_AZURE_BUILD}" "${PREFIX_AZURE_MARKERS}"
mkdir -p "${PREFIX_PORT_BUILD}" "${PREFIX_AZURE_MARKERS}"
if ! [ -d "${PREFIX_AZURE_SRC}" ]; then
git clone -b "${AZURE_VER}" https://github.com/Azure/azure-iot-sdk-c.git "${PREFIX_AZURE_SRC}"
# Get the extended version only if the LONG_TEST option was set
Expand All @@ -47,7 +43,7 @@ for patchfile in "${PREFIX_AZURE_PATCHES}"/*.patch; do
grep -q "armv7m7-imxrt106x" <<< "${TARGET}" || continue
fi
echo "applying patch: $patchfile"
patch -d "${PREFIX_AZURE_BUILD}" -p0 -i "$patchfile" && touch "${PREFIX_AZURE_MARKERS}/${PATCH_NAME}.applied"
patch -d "${PREFIX_PORT_BUILD}" -p0 -i "$patchfile" && touch "${PREFIX_AZURE_MARKERS}/${PATCH_NAME}.applied"
fi
# There are some cpp sources, which is currently not supported in Phoenix-RTOS
[ "${LONG_TEST}" = "y" ] && rm -rf "${PREFIX_AZURE_SRC}/c-utility/testtools/micromock"
Expand All @@ -70,7 +66,7 @@ export PHOENIX_COMPILER_CMD PHOENIX_SYSROOT
# Build (http and amqp protocols are currently not supported yet)
# Treat Phoenix-RTOS as Linux and providing toolchain file was the most suitable solution
(cd "${PREFIX_AZURE_SRC}/build_all/linux" && ./build.sh \
--toolchain-file "${PREFIX_AZURE}/toolchain-phoenix.cmake" -cl --sysroot="${PHOENIX_SYSROOT}" \
--toolchain-file "${PREFIX_PORT}/toolchain-phoenix.cmake" -cl --sysroot="${PHOENIX_SYSROOT}" \
--no-http --no-amqp)

# Create azure root directory with provided libs, includes and binaries
Expand Down
37 changes: 17 additions & 20 deletions busybox/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@ BUSYBOX=busybox-1.27.2
PKG_URL="https://busybox.net/downloads/${BUSYBOX}.tar.bz2"
PKG_MIRROR_URL="https://files.phoesys.com/ports/${BUSYBOX}.tar.bz2"

b_log "Building busybox"
PREFIX_BUSYBOX="${PREFIX_PROJECT}/phoenix-rtos-ports/busybox"
PREFIX_BUSYBOX_BUILD="$PREFIX_BUILD/busybox/"
PREFIX_BUSYBOX_SRC="$PREFIX_BUSYBOX_BUILD/${BUSYBOX}/"
PREFIX_BUSYBOX_MARKERS="$PREFIX_BUSYBOX_BUILD/markers/"
: "${BUSYBOX_CONFIG:="${PREFIX_BUSYBOX}/config"}"
PREFIX_BUSYBOX_SRC="$PREFIX_PORT_BUILD/${BUSYBOX}/"
PREFIX_BUSYBOX_MARKERS="$PREFIX_PORT_BUILD/markers/"
: "${BUSYBOX_CONFIG:="${PREFIX_PORT}/config"}"


#
# Download and unpack
#
mkdir -p "$PREFIX_BUSYBOX_BUILD" "$PREFIX_BUSYBOX_MARKERS"
if [ ! -f "$PREFIX_BUSYBOX/${BUSYBOX}.tar.bz2" ]; then
if ! wget -T 10 "$PKG_URL" -P "${PREFIX_BUSYBOX}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_BUSYBOX}" --no-check-certificate
mkdir -p "$PREFIX_PORT_BUILD" "$PREFIX_BUSYBOX_MARKERS"
if [ ! -f "$PREFIX_PORT/${BUSYBOX}.tar.bz2" ]; then
if ! wget -T 10 "$PKG_URL" -P "${PREFIX_PORT}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_PORT}" --no-check-certificate
fi
fi
[ -d "$PREFIX_BUSYBOX_SRC" ] || ( tar jxf "$PREFIX_BUSYBOX/${BUSYBOX}.tar.bz2" -C "$PREFIX_BUSYBOX_BUILD" && rm -rf "${PREFIX_BUSYBOX_MARKERS:?}/*")
[ -d "$PREFIX_BUSYBOX_SRC" ] || ( tar jxf "$PREFIX_PORT/${BUSYBOX}.tar.bz2" -C "$PREFIX_PORT_BUILD" && rm -rf "${PREFIX_BUSYBOX_MARKERS:?}/*")

#
# Apply patches
#
for patchfile in "$PREFIX_BUSYBOX"/*.patch; do
for patchfile in "$PREFIX_PORT"/*.patch; do
if [ ! -f "$PREFIX_BUSYBOX_MARKERS/$(basename "$patchfile").applied" ]; then
echo "applying patch: $patchfile"
patch -d "$PREFIX_BUSYBOX_SRC" -p1 < "$patchfile"
Expand All @@ -39,13 +36,13 @@ done
#
# Configure
#
if [ ! -f "${PREFIX_BUSYBOX_BUILD}/.config" ] || [ "${BUSYBOX_CONFIG}" -nt "${PREFIX_BUSYBOX_BUILD}/.config" ]; then
cp -a "${BUSYBOX_CONFIG}" "${PREFIX_BUSYBOX_BUILD}"/.config
make -C "${PREFIX_BUSYBOX_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" clean
if [ ! -f "${PREFIX_PORT_BUILD}/.config" ] || [ "${BUSYBOX_CONFIG}" -nt "${PREFIX_PORT_BUILD}/.config" ]; then
cp -a "${BUSYBOX_CONFIG}" "${PREFIX_PORT_BUILD}"/.config
make -C "${PREFIX_PORT_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" clean
fi

# hackish: remove the final binary to re-link potential libc changes
rm -rf "$PREFIX_BUSYBOX_BUILD/busybox_unstripped" "$PREFIX_BUSYBOX_BUILD/busybox"
rm -rf "$PREFIX_PORT_BUILD/busybox_unstripped" "$PREFIX_PORT_BUILD/busybox"

# For MacOS
export LC_CTYPE=C
Expand All @@ -55,13 +52,13 @@ else
UNSTRIPPED=n
fi

make -C "${PREFIX_BUSYBOX_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" SKIP_STRIP="$UNSTRIPPED" all
make -C "${PREFIX_BUSYBOX_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" SKIP_STRIP="$UNSTRIPPED" install
cp -a "$PREFIX_BUSYBOX_BUILD/busybox_unstripped" "$PREFIX_PROG"
make -C "${PREFIX_PORT_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" SKIP_STRIP="$UNSTRIPPED" all
make -C "${PREFIX_PORT_BUILD}" KBUILD_SRC="$PREFIX_BUSYBOX_SRC" -f "${PREFIX_BUSYBOX_SRC}"/Makefile CROSS_COMPILE="$CROSS" CONFIG_PREFIX="$PREFIX_FS/root" SKIP_STRIP="$UNSTRIPPED" install
cp -a "$PREFIX_PORT_BUILD/busybox_unstripped" "$PREFIX_PROG"

if [ "$LONG_TEST" = "y" ]; then
mkdir -p "$PREFIX_ROOTFS/usr/test/busybox"
cp -a "$PREFIX_BUSYBOX_SRC/testsuite" "$PREFIX_ROOTFS/usr/test/busybox"
# busybox test suite requires .config file and busybox binary in the same bin directory
cp "$PREFIX_BUSYBOX_BUILD/.config" "$PREFIX_ROOTFS/bin"
cp "$PREFIX_PORT_BUILD/.config" "$PREFIX_ROOTFS/bin"
fi
29 changes: 13 additions & 16 deletions coremark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,30 @@ COREMARK_COMMIT="d5fad6bd094899101a4e5fd53af7298160ced6ab"
PKG_URL="https://github.com/eembc/coremark/archive/${COREMARK_COMMIT}.tar.gz"
PKG_MIRROR_URL="https://files.phoesys.com/ports/${COREMARK}.tar.gz"

b_log "Building coremark"
PREFIX_COREMARK="${PREFIX_PROJECT}/phoenix-rtos-ports/coremark"
PREFIX_COREMARK_BUILD="${PREFIX_BUILD}/coremark"
PREFIX_COREMARK_SRC="${PREFIX_COREMARK_BUILD}/${COREMARK}"
PREFIX_COREMARK_MARKERS="${PREFIX_COREMARK_BUILD}/markers"
PREFIX_COREMARK_SRC="${PREFIX_PORT_BUILD}/${COREMARK}"
PREFIX_COREMARK_MARKERS="${PREFIX_PORT_BUILD}/markers"

#
# Download and unpack
#
mkdir -p "$PREFIX_COREMARK_BUILD"
if ! [ -f "${PREFIX_COREMARK}/${COREMARK}.tar.gz" ]; then
if ! wget "$PKG_URL" -O "${PREFIX_COREMARK}/${COREMARK}.tar.gz" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_COREMARK}" --no-check-certificate
mkdir -p "$PREFIX_PORT_BUILD"
if ! [ -f "${PREFIX_PORT}/${COREMARK}.tar.gz" ]; then
if ! wget "$PKG_URL" -O "${PREFIX_PORT}/${COREMARK}.tar.gz" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_PORT}" --no-check-certificate
fi
fi

if ! [ -d "${PREFIX_COREMARK_SRC}" ]; then
tar xzf "${PREFIX_COREMARK}/${COREMARK}.tar.gz" -C "${PREFIX_COREMARK_BUILD}" && mv "${PREFIX_COREMARK_BUILD}"/coremark-"${COREMARK_COMMIT}" "${PREFIX_COREMARK_BUILD}"/${COREMARK}
tar xzf "${PREFIX_PORT}/${COREMARK}.tar.gz" -C "${PREFIX_PORT_BUILD}" && mv "${PREFIX_PORT_BUILD}"/coremark-"${COREMARK_COMMIT}" "${PREFIX_PORT_BUILD}"/${COREMARK}
fi

#
# Apply patches
#
mkdir -p "$PREFIX_COREMARK_MARKERS"

for patchfile in "$PREFIX_COREMARK"/*.patch; do
if [ ! -f "$PREFIX_COREMARK_BUILD/markers/$(basename "$patchfile").applied" ]; then
for patchfile in "$PREFIX_PORT"/*.patch; do
if [ ! -f "$PREFIX_PORT_BUILD/markers/$(basename "$patchfile").applied" ]; then
echo "applying patch: $patchfile"
patch -d "$PREFIX_COREMARK_SRC" -p1 < "$patchfile"
touch "$PREFIX_COREMARK_MARKERS/$(basename "$patchfile").applied"
Expand All @@ -44,10 +41,10 @@ done
#
# Configure
#
mkdir -p "${PREFIX_COREMARK_BUILD}/${COREMARK}/phoenix"
cp -a "$PREFIX_COREMARK/core-portme.mak" "$PREFIX_COREMARK_BUILD/${COREMARK}/phoenix/core_portme.mak"
mkdir -p "${PREFIX_PORT_BUILD}/${COREMARK}/phoenix"
cp -a "$PREFIX_PORT/core-portme.mak" "$PREFIX_PORT_BUILD/${COREMARK}/phoenix/core_portme.mak"

cd "${PREFIX_COREMARK_BUILD}/${COREMARK}"
cd "${PREFIX_PORT_BUILD}/${COREMARK}"

if [ -z ${PORTS_COREMARK_THREADS+x} ]; then
PORTS_COREMARK_THREADS="1"
Expand All @@ -58,6 +55,6 @@ export XCFLAGS="${CFLAGS} -DUSE_PTHREAD -DMULTITHREAD=${PORTS_COREMARK_THREADS}
# Build coremark
PORT_DIR=phoenix make compile

cp -a "$PREFIX_COREMARK_BUILD/${COREMARK}/coremark" "$PREFIX_PROG/coremark"
cp -a "$PREFIX_PORT_BUILD/${COREMARK}/coremark" "$PREFIX_PROG/coremark"
$STRIP -o "${PREFIX_PROG_STRIPPED}/coremark" "${PREFIX_PROG}/coremark"
b_install "$PREFIX_PORTS_INSTALL/coremark" /bin
25 changes: 11 additions & 14 deletions curl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,35 @@ CURL=curl-7.64.1
PKG_URL="https://curl.haxx.se/download/${CURL}.tar.gz"
PKG_MIRROR_URL="https://files.phoesys.com/ports/${CURL}.tar.gz"

b_log "Building curl"
PREFIX_CURL="${PREFIX_PROJECT}/phoenix-rtos-ports/curl"
PREFIX_CURL_BUILD="${PREFIX_BUILD}/curl"
PREFIX_CURL_SRC="${PREFIX_CURL_BUILD}/${CURL}"
PREFIX_CURL_INSTALL="$PREFIX_CURL_BUILD/install"
PREFIX_CURL_SRC="${PREFIX_PORT_BUILD}/${CURL}"
PREFIX_CURL_INSTALL="$PREFIX_PORT_BUILD/install"

#
# Download and unpack
#
mkdir -p "$PREFIX_CURL_BUILD" "$PREFIX_CURL_INSTALL"
if [ ! -f "$PREFIX_CURL/${CURL}.tar.gz" ]; then
if ! wget "$PKG_URL" -P "${PREFIX_CURL}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_CURL}" --no-check-certificate
mkdir -p "$PREFIX_PORT_BUILD" "$PREFIX_CURL_INSTALL"
if [ ! -f "$PREFIX_PORT/${CURL}.tar.gz" ]; then
if ! wget "$PKG_URL" -P "${PREFIX_PORT}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_PORT}" --no-check-certificate
fi
fi
[ -d "$PREFIX_CURL_SRC" ] || tar zxf "$PREFIX_CURL/${CURL}.tar.gz" -C "$PREFIX_CURL_BUILD"
[ -d "$PREFIX_CURL_SRC" ] || tar zxf "$PREFIX_PORT/${CURL}.tar.gz" -C "$PREFIX_PORT_BUILD"


#
# Configure
#
if [ ! -f "$PREFIX_CURL_BUILD/config.status" ]; then
( cd "$PREFIX_CURL_BUILD" && PKG_CONFIG="" "$PREFIX_CURL_SRC/configure" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
if [ ! -f "$PREFIX_PORT_BUILD/config.status" ]; then
( cd "$PREFIX_PORT_BUILD" && PKG_CONFIG="" "$PREFIX_CURL_SRC/configure" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
--host="${HOST}" --sbindir="$PREFIX_PROG" --disable-pthreads --disable-threaded-resolver \
--disable-ipv6 --prefix="$PREFIX_CURL_INSTALL" --disable-ntlm-wb --without-zlib )
fi

#
# Make
#
make -C "$PREFIX_CURL_BUILD"
make -C "$PREFIX_CURL_BUILD" install
make -C "$PREFIX_PORT_BUILD"
make -C "$PREFIX_PORT_BUILD" install

cp -a "$PREFIX_CURL_INSTALL/include/curl" "$PREFIX_H"
cp -a "$PREFIX_CURL_INSTALL/lib/"* "$PREFIX_A"
Expand Down
31 changes: 14 additions & 17 deletions dropbear/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,24 @@ DROPBEAR=dropbear-2018.76
PKG_URL="https://matt.ucc.asn.au/dropbear/releases/${DROPBEAR}.tar.bz2"
PKG_MIRROR_URL="https://files.phoesys.com/ports/${DROPBEAR}.tar.bz2"

b_log "Building dropbear"
PREFIX_DROPBEAR="${PREFIX_PROJECT}/phoenix-rtos-ports/dropbear"
PREFIX_DROPBEAR_BUILD="${PREFIX_BUILD}/dropbear"
PREFIX_DROPBEAR_SRC="${PREFIX_DROPBEAR_BUILD}/${DROPBEAR}"
PREFIX_DROPBEAR_MARKERS="${PREFIX_DROPBEAR_BUILD}/markers"
PREFIX_DROPBEAR_SRC="${PREFIX_PORT_BUILD}/${DROPBEAR}"
PREFIX_DROPBEAR_MARKERS="${PREFIX_PORT_BUILD}/markers"

#
# Download and unpack
#
mkdir -p "$PREFIX_DROPBEAR_BUILD" "$PREFIX_DROPBEAR_MARKERS"
if [ ! -f "$PREFIX_DROPBEAR/${DROPBEAR}.tar.bz2" ]; then
if ! wget "$PKG_URL" -P "${PREFIX_DROPBEAR}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_DROPBEAR}" --no-check-certificate
mkdir -p "$PREFIX_PORT_BUILD" "$PREFIX_DROPBEAR_MARKERS"
if [ ! -f "$PREFIX_PORT/${DROPBEAR}.tar.bz2" ]; then
if ! wget "$PKG_URL" -P "${PREFIX_PORT}" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_PORT}" --no-check-certificate
fi
fi
[ -d "$PREFIX_DROPBEAR_SRC" ] || ( tar jxf "$PREFIX_DROPBEAR/${DROPBEAR}.tar.bz2" -C "${PREFIX_DROPBEAR_BUILD}" && rm -rf "${PREFIX_DROPBEAR_MARKERS:?}/*" )
[ -d "$PREFIX_DROPBEAR_SRC" ] || ( tar jxf "$PREFIX_PORT/${DROPBEAR}.tar.bz2" -C "${PREFIX_PORT_BUILD}" && rm -rf "${PREFIX_DROPBEAR_MARKERS:?}/*" )

#
# Apply patches
#
for patchfile in "$PREFIX_DROPBEAR"/patch/*; do
for patchfile in "$PREFIX_PORT"/patch/*; do
if [ ! -f "$PREFIX_DROPBEAR_MARKERS/$(basename "$patchfile").applied" ]; then
echo "applying patch: $patchfile"
patch -d "$PREFIX_DROPBEAR_SRC" -p1 < "$patchfile"
Expand All @@ -37,15 +34,15 @@ done
#
# Configure
#
if [ ! -f "$PREFIX_DROPBEAR_BUILD/config.h" ]; then
cp -a "$PREFIX_DROPBEAR/localoptions.h" "$PREFIX_DROPBEAR_BUILD"
if [ ! -f "$PREFIX_PORT_BUILD/config.h" ]; then
cp -a "$PREFIX_PORT/localoptions.h" "$PREFIX_PORT_BUILD"

DROPBEAR_CFLAGS="-DENDIAN_LITTLE -DUSE_DEV_PTMX ${DROPBEAR_CUSTOM_CFLAGS}"
DROPBEAR_LDFLAGS=""
ENABLE_ZLIB="no" && [ "$PORTS_ZLIB" = "y" ] && ENABLE_ZLIB="yes"
export OLDCFLAGS="-v" # HACKISH: fix ./configure script not detecting externally-provided CFLAGS

( cd "${PREFIX_DROPBEAR_BUILD}" && "${PREFIX_DROPBEAR_SRC}/configure" CFLAGS="${CFLAGS} ${DROPBEAR_CFLAGS}" \
( cd "${PREFIX_PORT_BUILD}" && "${PREFIX_DROPBEAR_SRC}/configure" CFLAGS="${CFLAGS} ${DROPBEAR_CFLAGS}" \
LDFLAGS="${CFLAGS} ${LDFLAGS} ${DROPBEAR_LDFLAGS}" ARFLAGS="-r" \
--host="${HOST}" --includedir="${PREFIX_H}" \
--prefix="${PREFIX_PROG}" --program-prefix="${PREFIX_PROG}" --libdir="${PREFIX_A}" --bindir="${PREFIX_PROG}" --enable-zlib="$ENABLE_ZLIB" --enable-static \
Expand All @@ -56,10 +53,10 @@ fi
# Make
#
# create multi-binary and hardlinks
make PROGRAMS="dropbear dbclient dropbearkey scp" -C "${PREFIX_DROPBEAR_BUILD}" CROSS_COMPILE="$CROSS" MULTI=1 NO_ADDTL_WARNINGS=1
make PROGRAMS="dropbear dbclient dropbearkey scp" -C "${PREFIX_PORT_BUILD}" CROSS_COMPILE="$CROSS" MULTI=1 NO_ADDTL_WARNINGS=1

$STRIP -o "$PREFIX_PROG_STRIPPED/dropbearmulti" "$PREFIX_DROPBEAR_BUILD/dropbearmulti"
cp -a "$PREFIX_DROPBEAR_BUILD/dropbearmulti" "$PREFIX_PROG/dropbearmulti"
$STRIP -o "$PREFIX_PROG_STRIPPED/dropbearmulti" "$PREFIX_PORT_BUILD/dropbearmulti"
cp -a "$PREFIX_PORT_BUILD/dropbearmulti" "$PREFIX_PROG/dropbearmulti"

b_install "$PREFIX_PORTS_INSTALL/dropbearmulti" /usr/bin
mkdir -p "$PREFIX_ROOTFS/usr/sbin"
Expand Down
23 changes: 10 additions & 13 deletions fs_mark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,27 @@ FS_MARK_COMMIT="2628be58146de63a13260ff64550f84275556c0e"
PKG_URL="https://github.com/josefbacik/fs_mark/archive/${FS_MARK_COMMIT}.tar.gz"
PKG_MIRROR_URL="https://files.phoesys.com/ports/${FS_MARK}.tar.gz"

b_log "Building fs_mark"
PREFIX_FS_MARK=${PREFIX_PROJECT}/phoenix-rtos-ports/fs_mark
PREFIX_FS_MARK_BUILD="${PREFIX_BUILD}/fs_mark"
PREFIX_FS_MARK_SRC="${PREFIX_FS_MARK_BUILD}/${FS_MARK}"
PREFIX_FS_MARK_MARKERS="${PREFIX_FS_MARK_BUILD}/markers"
PREFIX_FS_MARK_SRC="${PREFIX_PORT_BUILD}/${FS_MARK}"
PREFIX_FS_MARK_MARKERS="${PREFIX_PORT_BUILD}/markers"

#
# Download and unpack
#
mkdir -p "$PREFIX_FS_MARK_BUILD" "$PREFIX_FS_MARK_MARKERS"
if ! [ -f "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" ]; then
if ! wget "$PKG_URL" -O "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_FS_MARK}" --no-check-certificate
mkdir -p "$PREFIX_PORT_BUILD" "$PREFIX_FS_MARK_MARKERS"
if ! [ -f "${PREFIX_PORT}/${FS_MARK}.tar.gz" ]; then
if ! wget "$PKG_URL" -O "${PREFIX_PORT}/${FS_MARK}.tar.gz" --no-check-certificate; then
wget "$PKG_MIRROR_URL" -P "${PREFIX_PORT}" --no-check-certificate
fi
fi

if ! [ -d "${PREFIX_FS_MARK_SRC}" ]; then
tar xzf "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" -C "${PREFIX_FS_MARK_BUILD}" && mv "${PREFIX_FS_MARK_BUILD}"/fs_mark-"${FS_MARK_COMMIT}" "${PREFIX_FS_MARK_BUILD}"/${FS_MARK}
tar xzf "${PREFIX_PORT}/${FS_MARK}.tar.gz" -C "${PREFIX_PORT_BUILD}" && mv "${PREFIX_PORT_BUILD}"/fs_mark-"${FS_MARK_COMMIT}" "${PREFIX_PORT_BUILD}"/${FS_MARK}
fi

#
# Apply patches
#
for patchfile in "$PREFIX_FS_MARK"/patch/*; do
for patchfile in "$PREFIX_PORT"/patch/*; do
if [ ! -f "$PREFIX_FS_MARK_MARKERS/$(basename "$patchfile").applied" ]; then
echo "applying patch: $patchfile"
patch -d "$PREFIX_FS_MARK_SRC" -p1 < "$patchfile"
Expand All @@ -40,8 +37,8 @@ for patchfile in "$PREFIX_FS_MARK"/patch/*; do
done

# Build fs_mark
cd "${PREFIX_FS_MARK_BUILD}/${FS_MARK}" && make
cd "${PREFIX_PORT_BUILD}/${FS_MARK}" && make

cp -a "$PREFIX_FS_MARK_BUILD/${FS_MARK}/fs_mark" "$PREFIX_PROG/fs_mark"
cp -a "$PREFIX_PORT_BUILD/${FS_MARK}/fs_mark" "$PREFIX_PROG/fs_mark"
$STRIP -o "${PREFIX_PROG_STRIPPED}/fs_mark" "${PREFIX_PROG}/fs_mark"
b_install "$PREFIX_PORTS_INSTALL/fs_mark" /bin
Loading

0 comments on commit 89d1aff

Please sign in to comment.