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

Ports: Undo POSIX sh compliance changes for now

Partial revert of 704f48d7f3.
These changes made the ports system unusable.
This commit is contained in:
Andreas Kling 2019-11-03 10:05:02 +01:00
parent 4565b2d2d9
commit 3d239be7b4
22 changed files with 35 additions and 38 deletions

View file

@ -1,7 +1,4 @@
#!/bin/bash #!/bin/bash
# This file will need to be run in bash, for now.
if [ -z "$SERENITY_ROOT" ]; then if [ -z "$SERENITY_ROOT" ]; then
echo "You must source UseIt.sh to build ports." echo "You must source UseIt.sh to build ports."
exit 1 exit 1
@ -33,19 +30,19 @@ run() {
(cd "$workdir" && "$@") (cd "$workdir" && "$@")
} }
run_replace_in_file(){ run_replace_in_file(){
run perl -p -i -e "$1" "$2" run perl -p -i -e "$1" $2
} }
# Checks if a function is defined. In this case, if the function is not defined in the port's script, then we will use our defaults. This way, ports don't need to include these functions every time, but they can override our defaults if needed. # Checks if a function is defined. In this case, if the function is not defined in the port's script, then we will use our defaults. This way, ports don't need to include these functions every time, but they can override our defaults if needed.
func_defined() { func_defined() {
PATH=$(command -V "$1" > /dev/null 2>&1) PATH= command -V "$1" > /dev/null 2>&1
} }
func_defined fetch || fetch() { func_defined fetch || fetch() {
OLDIFS=$IFS OLDIFS=$IFS
IFS=$'\n' IFS=$'\n'
for f in $files; do for f in $files; do
IFS=$OLDIFS IFS=$OLDIFS
read url filename <<< "$(echo $f)" read url filename <<< $(echo "$f")
run_nocd curl "${curlopts:-}" "$url" -o "$filename" run_nocd curl ${curlopts:-} "$url" -o "$filename"
case "$filename" in case "$filename" in
*.tar*|.tbz*|*.txz|*.tgz) *.tar*|.tbz*|*.txz|*.tgz)
run_nocd tar xf "$filename" run_nocd tar xf "$filename"
@ -68,13 +65,13 @@ func_defined configure || configure() {
run ./"$configscript" --host=i686-pc-serenity $configopts run ./"$configscript" --host=i686-pc-serenity $configopts
} }
func_defined build || build() { func_defined build || build() {
run make "$makeopts" run make $makeopts
} }
func_defined install || install() { func_defined install || install() {
run make DESTDIR="$SERENITY_ROOT"/Root $installopts install run make DESTDIR="$SERENITY_ROOT"/Root $installopts install
} }
func_defined clean || clean() { func_defined clean || clean() {
rm -rf "$workdir" -- *.out rm -rf "$workdir" *.out
} }
func_defined clean_dist || clean_dist() { func_defined clean_dist || clean_dist() {
OLDIFS=$IFS OLDIFS=$IFS
@ -86,7 +83,7 @@ func_defined clean_dist || clean_dist() {
done done
} }
func_defined clean_all || clean_all() { func_defined clean_all || clean_all() {
rm -rf "$workdir" -- *.out rm -rf "$workdir" *.out
OLDIFS=$IFS OLDIFS=$IFS
IFS=$'\n' IFS=$'\n'
for f in $files; do for f in $files; do
@ -106,7 +103,7 @@ addtodb() {
echo "auto $port $version" >> "$prefix"/packages.db echo "auto $port $version" >> "$prefix"/packages.db
else else
echo "manual $port $version" >> "$prefix"/packages.db echo "manual $port $version" >> "$prefix"/packages.db
if [ -n "${dependlist:-}" ]; then if [ ! -z "${dependlist:-}" ]; then
echo "dependency $port$dependlist" >> "$prefix/packages.db" echo "dependency $port$dependlist" >> "$prefix/packages.db"
fi fi
fi fi
@ -197,10 +194,10 @@ if [ -z "${1:-}" ]; then
else else
case "$1" in case "$1" in
fetch|configure|build|install|clean|clean_dist|clean_all|uninstall) fetch|configure|build|install|clean|clean_dist|clean_all|uninstall)
do_"$1" do_$1
;; ;;
--auto) --auto)
do_all "$1" do_all $1
;; ;;
*) *)
>&2 echo "I don't understand $1! Supported arguments: fetch, configure, build, install, clean, clean_dist, clean_all, uninstall." >&2 echo "I don't understand $1! Supported arguments: fetch, configure, build, install, clean, clean_dist, clean_all, uninstall."

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=SDL2 port=SDL2
version=serenity-git version=serenity-git
workdir=SDL-master-serenity workdir=SDL-master-serenity
@ -8,5 +8,5 @@ files="https://github.com/SerenityOS/SDL/archive/master-serenity.tar.gz SDL2-git
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt -DPULSEAUDIO=OFF" configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_ROOT/Toolchain/CMakeToolchain.txt -DPULSEAUDIO=OFF"
configure() { configure() {
run cmake "$configopts" run cmake $configopts
} }

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=bash port=bash
version=5.0 version=5.0
useconfigure=true useconfigure=true
@ -8,5 +8,5 @@ files="https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz bash-5.0.tar.gz"
build() { build() {
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 "$makeopts" run make $makeopts
} }

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=binutils port=binutils
version=2.32 version=2.32
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=curl port=curl
version=7.65.3 version=7.65.3
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=doom port=doom
workdir=SerenityDOOM-master workdir=SerenityDOOM-master
version=serenity-git version=serenity-git

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=figlet port=figlet
version=2.2.5 version=2.2.5
files="http://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz figlet-2.2.5.tar.gz" files="http://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz figlet-2.2.5.tar.gz"

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=gcc port=gcc
version=8.3.0 version=8.3.0
useconfigure=true useconfigure=true
@ -18,10 +18,10 @@ fetch() {
done done
} }
build() { build() {
run make "$makeopts" run make $makeopts
run find ./host-i686-pc-serenity/gcc/ -maxdepth 1 -type f -executable -exec strip --strip-debug {} \; || echo run find ./host-i686-pc-serenity/gcc/ -maxdepth 1 -type f -executable -exec strip --strip-debug {} \; || echo
} }
install() { install() {
run make "$installopts" run make $installopts
} }

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=less port=less
version=530 version=530
useconfigure="true" useconfigure="true"

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=libarchive port=libarchive
version=3.4.0 version=3.4.0
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=libexpat port=libexpat
version=2.2.9 version=2.2.9
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=libiconv port=libiconv
version=1.16 version=1.16
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=links port=links
version=2.19 version=2.19
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=lua port=lua
version=5.3.5 version=5.3.5
files="http://www.lua.org/ftp/lua-5.3.5.tar.gz lua-5.3.5.tar.gz" files="http://www.lua.org/ftp/lua-5.3.5.tar.gz lua-5.3.5.tar.gz"

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=make port=make
version=4.2.1 version=4.2.1
useconfigure=true useconfigure=true

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=mbedtls port=mbedtls
version=2.16.2 version=2.16.2
files="https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz mbedtls-2.16.2-apache.tgz" files="https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz mbedtls-2.16.2-apache.tgz"

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=ncurses port=ncurses
version=git version=git
workdir=ncurses-master workdir=ncurses-master

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=nyancat port=nyancat
version=git version=git
workdir=nyancat-master workdir=nyancat-master

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=quake port=quake
version=0.65 version=0.65
workdir=SerenityQuake-master workdir=SerenityQuake-master

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=tinycc port=tinycc
workdir=tinycc-dev workdir=tinycc-dev
version=dev version=dev

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=vim port=vim
version=git version=git
workdir=vim-master workdir=vim-master

View file

@ -1,4 +1,4 @@
#!/bin/sh ../.port_include.sh #!/bin/bash ../.port_include.sh
port=zlib port=zlib
version=1.2.11 version=1.2.11
useconfigure=true useconfigure=true