1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 11:37:44 +00:00

Ports: Remove bashisms and switch all scripts to /bin/sh.

This commit is contained in:
Larkin Nickle 2019-06-04 21:21:24 +00:00 committed by Andreas Kling
parent 800242ed4e
commit d080f6e8dd
10 changed files with 64 additions and 64 deletions

View file

@ -19,19 +19,19 @@ if [ -z "$PORT_DIR" ]; then
exit 1 exit 1
fi fi
function run_command() { run_command() {
echo "+ $@" echo "+ $@"
(cd "$PORT_DIR" && "$@") (cd "$PORT_DIR" && "$@")
echo "+ FINISHED: $@" echo "+ FINISHED: $@"
} }
function run_command_nocd() { run_command_nocd() {
echo "+ $@ (nocd)" echo "+ $@ (nocd)"
("$@") ("$@")
echo "+ FINISHED (nocd): $@" echo "+ FINISHED (nocd): $@"
} }
function run_fetch_git() { run_fetch_git() {
if [ -d "$PORT_DIR/.git" ]; then if [ -d "$PORT_DIR/.git" ]; then
run_command git fetch run_command git fetch
run_command git reset --hard FETCH_HEAD run_command git reset --hard FETCH_HEAD
@ -41,7 +41,7 @@ function run_fetch_git() {
fi fi
} }
function run_fetch_web() { run_fetch_web() {
if [ -d "$PORT_DIR" ]; then if [ -d "$PORT_DIR" ]; then
run_command_nocd rm -rf "$PORT_DIR" run_command_nocd rm -rf "$PORT_DIR"
fi fi
@ -54,36 +54,36 @@ function run_fetch_web() {
run_command_nocd tar xavf "$file" -C "$PORT_DIR" --strip-components=1 run_command_nocd tar xavf "$file" -C "$PORT_DIR" --strip-components=1
} }
function run_export_env() { run_export_env() {
export $1="$2" export $1="$2"
} }
function run_replace_in_file() { run_replace_in_file() {
run_command perl -p -i -e "$1" $2 run_command perl -p -i -e "$1" $2
} }
function run_patch() { run_patch() {
echo "+ Applying patch $1" echo "+ Applying patch $1"
run_command patch "$2" < "$1" run_command patch "$2" < "$1"
} }
function run_configure_cmake() { run_configure_cmake() {
run_command cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" . run_command cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" .
} }
function run_configure_autotools() { run_configure_autotools() {
run_command ./configure --host=i686-pc-serenity "$@" run_command ./configure --host=i686-pc-serenity "$@"
} }
function run_make() { run_make() {
run_command make $MAKEOPTS "$@" run_command make $MAKEOPTS "$@"
} }
function run_make_install() { run_make_install() {
run_command make $INSTALLOPTS install "$@" run_command make $INSTALLOPTS install "$@"
} }
function run_send_to_file() { run_send_to_file() {
echo "+ rewrite '$1'" echo "+ rewrite '$1'"
(cd "$PORT_DIR" && echo "$2" > "$1") (cd "$PORT_DIR" && echo "$2" > "$1")
echo "+ FINISHED" echo "+ FINISHED"
@ -101,16 +101,16 @@ if [ -z "$1" ]; then
exit 0 exit 0
fi fi
if [ "$1" == "fetch" ]; then if [ "$1" = "fetch" ]; then
echo "+ Fetching..." echo "+ Fetching..."
fetch fetch
elif [ "$1" == "configure" ]; then elif [ "$1" = "configure" ]; then
echo "+ Configuring..." echo "+ Configuring..."
configure configure
elif [ "$1" == "build" ]; then elif [ "$1" = "build" ]; then
echo "+ Building..." echo "+ Building..."
build build
elif [ "$1" == "install" ]; then elif [ "$1" = "install" ]; then
echo "+ Installing..." echo "+ Installing..."
install install
else else

View file

@ -1,15 +1,15 @@
#!/bin/sh #!/bin/sh
PORT_DIR=SDL PORT_DIR=SDL
function fetch() { fetch() {
run_fetch_git "https://github.com/SerenityOS/SDL" run_fetch_git "https://github.com/SerenityOS/SDL"
} }
function configure() { configure() {
run_configure_cmake run_configure_cmake
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install run_make_install
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
PORT_DIR=bash PORT_DIR=bash
function fetch() { fetch() {
run_fetch_git "https://git.savannah.gnu.org/git/bash.git" run_fetch_git "https://git.savannah.gnu.org/git/bash.git"
# Add serenity as a system for configure # Add serenity as a system for configure
@ -13,16 +13,16 @@ function fetch() {
# Locale calls crash right now. LibC bug, probably. # Locale calls crash right now. LibC bug, probably.
run_patch disable-locale.patch -p1 run_patch disable-locale.patch -p1
} }
function configure() { configure() {
run_configure_autotools --disable-nls --without-bash-malloc run_configure_autotools --disable-nls --without-bash-malloc
} }
function build() { build() {
# Avoid some broken cross compile tests... # Avoid some broken cross compile tests...
run_replace_in_file "s/define GETCWD_BROKEN 1/undef GETCWD_BROKEN/" config.h run_replace_in_file "s/define GETCWD_BROKEN 1/undef GETCWD_BROKEN/" config.h
run_replace_in_file "s/define CAN_REDEFINE_GETENV 1/undef CAN_REDEFINE_GETENV/" config.h run_replace_in_file "s/define CAN_REDEFINE_GETENV 1/undef CAN_REDEFINE_GETENV/" config.h
run_make run_make
} }
function install() { install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root run_make_install DESTDIR="$SERENITY_ROOT"/Root
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/sh
PORT_DIR=binutils PORT_DIR=binutils
function fetch() { fetch() {
run_fetch_web "https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz" run_fetch_web "https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz"
# Add the big binutils patch (same one used by toolchain.) # Add the big binutils patch (same one used by toolchain.)
run_patch $SERENITY_ROOT/Toolchain/Patches/binutils.patch -p1 run_patch $SERENITY_ROOT/Toolchain/Patches/binutils.patch -p1
} }
function configure() { configure() {
run_configure_autotools \ run_configure_autotools \
--target=i686-pc-serenity \ --target=i686-pc-serenity \
--with-sysroot=/ \ --with-sysroot=/ \
@ -15,10 +15,10 @@ function configure() {
--disable-gdb \ --disable-gdb \
--disable-nls --disable-nls
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root run_make_install DESTDIR="$SERENITY_ROOT"/Root
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/sh
PORT_DIR=gcc PORT_DIR=gcc
function fetch() { fetch() {
run_fetch_web "https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz" run_fetch_web "https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz"
# Add the big GCC patch (same one used by toolchain.) # Add the big GCC patch (same one used by toolchain.)
@ -12,7 +12,7 @@ function fetch() {
# Patch mpfr, mpc and isl to teach them about "serenity" targets. # Patch mpfr, mpc and isl to teach them about "serenity" targets.
run_patch dependencies-config.patch -p1 run_patch dependencies-config.patch -p1
} }
function configure() { configure() {
run_configure_autotools \ run_configure_autotools \
--target=i686-pc-serenity \ --target=i686-pc-serenity \
--with-sysroot=/ \ --with-sysroot=/ \
@ -22,12 +22,12 @@ function configure() {
--disable-lto \ --disable-lto \
--disable-nls --disable-nls
} }
function build() { build() {
MAKEOPTS="" MAKEOPTS=""
run_make all-gcc all-target-libgcc all-target-libstdc++-v3 run_make all-gcc all-target-libgcc all-target-libstdc++-v3
run_command find ./host-i686-pc-serenity/gcc/ -maxdepth 1 -type f -executable -exec strip --strip-debug {} \; || echo run_command find ./host-i686-pc-serenity/gcc/ -maxdepth 1 -type f -executable -exec strip --strip-debug {} \; || echo
} }
function install() { install() {
run_make $INSTALLOPTS DESTDIR="$SERENITY_ROOT"/Root install-gcc install-target-libgcc install-target-libstdc++-v3 run_make $INSTALLOPTS DESTDIR="$SERENITY_ROOT"/Root install-gcc install-target-libgcc install-target-libstdc++-v3
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -2,16 +2,16 @@
PORT_DIR=less PORT_DIR=less
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/" INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
function fetch() { fetch() {
run_fetch_web "http://ftp.gnu.org/gnu/less/less-530.tar.gz" run_fetch_web "http://ftp.gnu.org/gnu/less/less-530.tar.gz"
} }
function configure() { configure() {
run_configure_autotools run_configure_autotools
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install run_make_install
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -1,16 +1,16 @@
#!/bin/sh #!/bin/sh
PORT_DIR=links PORT_DIR=links
function fetch() { fetch() {
run_fetch_web "http://links.twibright.com/download/links-2.19.tar.bz2" run_fetch_web "http://links.twibright.com/download/links-2.19.tar.bz2"
} }
function configure() { configure() {
run_export_env CC i686-pc-serenity-gcc run_export_env CC i686-pc-serenity-gcc
run_configure_autotools run_configure_autotools
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root run_make_install DESTDIR="$SERENITY_ROOT"/Root
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -4,21 +4,21 @@ MAKEOPTS='generic'
INSTALLOPTS="INSTALL_TOP=$SERENITY_ROOT/Root/" INSTALLOPTS="INSTALL_TOP=$SERENITY_ROOT/Root/"
function fetch() { fetch() {
run_fetch_web "http://www.lua.org/ftp/lua-5.3.5.tar.gz" run_fetch_web "http://www.lua.org/ftp/lua-5.3.5.tar.gz"
run_patch lua.patch -p1 run_patch lua.patch -p1
} }
function configure() { configure() {
run_export_env CC i686-pc-serenity-gcc run_export_env CC i686-pc-serenity-gcc
} }
function run_make() { run_make() {
run_command make $MAKEOPTS "$@" run_command make $MAKEOPTS "$@"
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root run_make_install DESTDIR="$SERENITY_ROOT"/Root
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -2,17 +2,17 @@
PORT_DIR=ncurses PORT_DIR=ncurses
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/" INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
function fetch() { fetch() {
run_fetch_git "https://github.com/mirror/ncurses.git" run_fetch_git "https://github.com/mirror/ncurses.git"
run_patch allow-serenity-os-ncurses.patch -p1 run_patch allow-serenity-os-ncurses.patch -p1
} }
function configure() { configure() {
run_configure_autotools run_configure_autotools
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install run_make_install
} }
source ../.port_include.sh . ../.port_include.sh

View file

@ -2,11 +2,11 @@
PORT_DIR=vim PORT_DIR=vim
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/" INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
function fetch() { fetch() {
run_fetch_git "https://github.com/vim/vim.git" run_fetch_git "https://github.com/vim/vim.git"
} }
function configure() { configure() {
run_send_to_file src/auto/config.cache " run_send_to_file src/auto/config.cache "
vim_cv_getcwd_broken=no vim_cv_getcwd_broken=no
vim_cv_memmove_handles_overlap=yes vim_cv_memmove_handles_overlap=yes
@ -19,12 +19,12 @@ function configure() {
run_configure_autotools --with-tlib=ncurses --with-features=small run_configure_autotools --with-tlib=ncurses --with-features=small
} }
function build() { build() {
run_make run_make
} }
function install() { install() {
run_make_install run_make_install
} }
source ../.port_include.sh . ../.port_include.sh