1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:57:35 +00:00

port_include: Various updates

* Prints what is run, which is useful for trace purposes.
* Fix autotools configure to respect arguments
* Add run_patch for applying patches
This commit is contained in:
Robin Burchell 2019-05-28 01:25:29 +02:00 committed by Andreas Kling
parent 5c82d14128
commit 19afcfe03c

44
Ports/.port_include.sh Normal file → Executable file
View file

@ -19,57 +19,65 @@ if [ -z "$PORT_DIR" ]; then
exit 1 exit 1
fi fi
function run_command() {
echo "+ $@"
(cd "$PORT_DIR" && "$@")
echo "+ FINISHED: $@"
}
function run_fetch_git() { function run_fetch_git() {
if [ -d "$PORT_DIR/.git" ]; then if [ -d "$PORT_DIR/.git" ]; then
(cd "$PORT_DIR" && git fetch && git reset --hard FETCH_HEAD) run_command git fetch
run_command git reset --hard FETCH_HEAD
else else
git clone "$1" "$PORT_DIR" run_command git clone "$1" "$PORT_DIR"
fi fi
} }
function run_patch() {
echo "+ Applying patch $1"
run_command patch "$2" < "$1"
}
function run_configure_cmake() { function run_configure_cmake() {
( run_command cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" .
cd "$PORT_DIR"
cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" .
)
} }
function run_configure_autotools() { function run_configure_autotools() {
( run_command ./configure --host=i686-pc-serenity "$@"
cd "$PORT_DIR"
./configure --host=i686-pc-serenity
)
} }
function run_make() { function run_make() {
( run_command make $MAKEOPTS "$@"
cd "$PORT_DIR"
make $MAKEOPTS "$@"
)
} }
function run_make_install() { function run_make_install() {
( run_command make $INSTALLOPTS install "$@"
cd "$PORT_DIR"
make $INSTALLOPTS install "$@"
)
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "+ Fetching..."
fetch fetch
echo "+ Configuring..."
configure configure
echo "+ Building..."
build build
echo "+ Installing..."
install install
exit 0 exit 0
fi fi
if [ "$1" == "fetch" ]; then if [ "$1" == "fetch" ]; then
echo "+ Fetching..."
fetch fetch
elif [ "$1" == "configure" ]; then elif [ "$1" == "configure" ]; then
echo "+ Configuring..."
configure configure
elif [ "$1" == "build" ]; then elif [ "$1" == "build" ]; then
echo "+ Building..."
build build
elif [ "$1" == "install" ]; then elif [ "$1" == "install" ]; then
echo "+ Installing..."
install install
else else
echo "Unknown verb: $1" echo "Unknown verb: $1"