Ports: Switch to new ports system (#594)

Much redundancy is removed from package scripts with this system.
It also supports simple dependency management, uninstalling (through
BSD ports style plist files), cleaning up after itself (with clean,
clean_dist, clean_all commands), etc.
This commit is contained in:
Larkin 2019-09-24 02:56:39 -04:00 committed by Andreas Kling
parent d5f1c57fe2
commit 18249b5996
Notes: sideshowbarker 2024-07-19 11:59:41 +09:00
47 changed files with 6563 additions and 428 deletions

1
.gitignore vendored
View file

@ -29,3 +29,4 @@ Toolchain/Local
compile_commands.json
.clang_complete
*Endpoint.h
Ports/packages.db

View file

@ -1,123 +1,207 @@
#!/bin/sh
# This script contains common helpers for all ports.
set -e
#!/bin/bash
if [ -z "$SERENITY_ROOT" ]; then
echo "You must source UseIt.sh to build ports."
exit 1
fi
set -eu
prefix=$(pwd)/..
export CC=i686-pc-serenity-gcc
export CXX=i686-pc-serenity-g++
if [ -z "$MAKEOPTS" ]; then
MAKEOPTS="-j $(nproc)"
fi
if [ -z "$INSTALLOPTS" ]; then
INSTALLOPTS=""
fi
if [ -z "$SERENITY_ROOT" ]; then
echo "You must have source'd UseIt.sh to build any ports!"
exit 1
fi
. "$@"
shift
if [ -z "$PORT_DIR" ]; then
echo "Must set PORT_DIR to where the source should be cloned."
exit 1
fi
: "${makeopts:=-j$(nproc)}"
: "${installopts:=}"
: "${workdir:=$port-$version}"
: "${configscript:=configure}"
: "${configopts:=}"
: "${useconfigure:=false}"
: "${depends:=}"
: "${patchlevel:=1}"
run_command() {
echo "+ $@"
(cd "$PORT_DIR" && "$@")
echo "+ FINISHED: $@"
}
run_command_nocd() {
run_nocd() {
echo "+ $@ (nocd)"
("$@")
echo "+ FINISHED (nocd): $@"
}
run_fetch_git() {
if [ -d "$PORT_DIR/.git" ]; then
run_command git fetch
run_command git reset --hard FETCH_HEAD
run_command git clean -fx
run() {
echo "+ $@"
(cd "$workdir" && "$@")
}
run_replace_in_file(){
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.
func_defined() {
PATH= command -V "$1" > /dev/null 2>&1
}
func_defined fetch || fetch() {
OLDIFS=$IFS
IFS=$'\n'
for f in $files; do
IFS=$OLDIFS
read url filename <<< $(echo "$f")
run_nocd curl ${curlopts:-} "$url" -o "$filename"
case "$filename" in
*.tar*|.tbz*|*.txz|*.tgz)
run_nocd tar xf "$filename"
;;
*.gz)
run_nocd gunzip "$filename"
;;
*)
echo "Note: no case for file $filename."
;;
esac
done
if [ -d patches ]; then
for f in patches/*; do
run patch -p"$patchlevel" < "$f"
done
fi
}
func_defined configure || configure() {
run ./"$configscript" --host=i686-pc-serenity $configopts
}
func_defined build || build() {
run make $makeopts
}
func_defined install || install() {
run make DESTDIR="$SERENITY_ROOT"/Root $installopts install
}
func_defined clean || clean() {
rm -rf "$workdir" *.out
}
func_defined clean_dist || clean_dist() {
OLDIFS=$IFS
IFS=$'\n'
for f in $files; do
IFS=$OLDIFS
read url filename hash <<< $(echo "$f")
rm -f "$filename"
done
}
func_defined clean_all || clean_all() {
rm -rf "$workdir" *.out
OLDIFS=$IFS
IFS=$'\n'
for f in $files; do
IFS=$OLDIFS
read url filename hash <<< $(echo "$f")
rm -f "$filename"
done
}
addtodb() {
if [ ! -f "$prefix"/packages.db ]; then
echo "Note: $prefix/packages.db does not exist. Creating."
touch "$prefix"/packages.db
fi
if ! grep -E "^(auto|manual) $port $version" "$prefix"/packages.db > /dev/null; then
echo "Adding $port $version to database of installed ports!"
if [ "${1:-}" = "--auto" ]; then
echo "auto $port $version" >> "$prefix"/packages.db
else
echo "manual $port $version" >> "$prefix"/packages.db
if [ ! -z "${dependlist:-}" ]; then
echo "dependency $port$dependlist" >> "$prefix/packages.db"
fi
fi
else
run_command_nocd git clone "$1" "$PORT_DIR"
>&2 echo "Warning: $port $version already installed. Not adding to database of installed ports!"
fi
}
run_fetch_web() {
if [ -d "$PORT_DIR" ]; then
run_command_nocd rm -rf "$PORT_DIR"
installdepends() {
for depend in $depends; do
dependlist="${dependlist:-} $depend"
done
for depend in $depends; do
if ! grep "$depend" "$prefix"/packages.db > /dev/null; then
(cd "../$depend" && ./package.sh --auto)
fi
done
}
uninstall() {
if grep "^manual $port " "$prefix"/packages.db > /dev/null; then
if [ -f plist ]; then
for f in `cat plist`; do
case $f in
*/)
run rmdir "$prefix"/$f || true
;;
*)
run rm -rf "$prefix"/$f
;;
esac
done
# Without || true, mv will not be executed if you are uninstalling your only remaining port.
grep -v "^manual $port " "$prefix"/packages.db > packages.dbtmp || true
mv packages.dbtmp "$prefix"/packages.db
else
>&2 echo "Error: This port does not have a plist yet. Cannot uninstall."
fi
else
>&2 echo "Error: $port is not installed. Cannot uninstall."
fi
file=$(basename "$1")
run_command_nocd curl -L "$1" -o "$file"
mkdir "$PORT_DIR"
# may need to make strip-components configurable, as I bet some sick person
# out there has an archive that isn't in a directory :shrug:
run_command_nocd tar xavf "$file" -C "$PORT_DIR" --strip-components=1
}
run_export_env() {
export $1="$2"
}
run_replace_in_file() {
run_command perl -p -i -e "$1" $2
}
run_patch() {
echo "+ Applying patch $1"
run_command patch "$2" < "$1"
}
run_configure_cmake() {
run_command cmake -DCMAKE_TOOLCHAIN_FILE="$SERENITY_ROOT/Toolchain/CMakeToolchain.txt" $CMAKEOPTS .
}
run_configure_autotools() {
run_command ./configure --host=i686-pc-serenity "$@"
}
run_make() {
run_command make $MAKEOPTS "$@"
}
run_make_install() {
run_command make $INSTALLOPTS install "$@"
}
run_send_to_file() {
echo "+ rewrite '$1'"
(cd "$PORT_DIR" && echo "$2" > "$1")
echo "+ FINISHED"
}
if [ -z "$1" ]; then
echo "+ Fetching..."
do_fetch() {
installdepends
echo "Fetching $port!"
fetch
echo "+ Configuring..."
configure
echo "+ Building..."
}
do_configure() {
if [ "$useconfigure" = "true" ]; then
echo "Configuring $port!"
configure
else
echo "This port does not use a configure script. Skipping configure step."
fi
}
do_build() {
echo "Building $port!"
build
echo "+ Installing..."
}
do_install() {
echo "Installing $port!"
install
exit 0
fi
addtodb "${1:-}"
}
do_clean() {
echo "Cleaning workdir and .out files in $port!"
clean
}
do_clean_dist() {
echo "Cleaning dist in $port!"
clean_dist
}
do_clean_all() {
echo "Cleaning all in $port!"
clean_all
}
do_uninstall() {
echo "Uninstalling $port!"
uninstall
}
do_all() {
do_fetch
do_configure
do_build
do_install "${1:-}"
}
if [ "$1" = "fetch" ]; then
echo "+ Fetching..."
fetch
elif [ "$1" = "configure" ]; then
echo "+ Configuring..."
configure
elif [ "$1" = "build" ]; then
echo "+ Building..."
build
elif [ "$1" = "install" ]; then
echo "+ Installing..."
install
if [ -z "${1:-}" ]; then
do_all
else
echo "Unknown verb: $1"
echo "Supported: (one of) fetch configure build install"
exit 1
case "$1" in
fetch|configure|build|install|clean|clean_dist|clean_all|uninstall)
do_$1
;;
--auto)
do_all $1
;;
*)
>&2 echo "I don't understand $1! Supported arguments: fetch, configure, build, install, clean, clean_dist, clean_all, uninstall."
exit 1
;;
esac
fi

View file

@ -2,13 +2,13 @@
Serenity has software patched to run on it.
These shell scripts will allow you to build that sort of software, easily.
For example, if you want to install SDL2, simply run the SDL2.sh script.
For example, if you want to install SDL2, simply run its package.sh script.
Note that you should have already built Serenity, and be in a Serenity build environment.
# Using ports scripts
To do everything, just run the script: `./SDL2.sh`
To do a single step, you can specify it: `./SDL2.sh build`
To do everything, just run the script: `./package.sh`
To do a single step, you can specify it: `./package.sh build`
# How do I contribute?

View file

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

12
Ports/SDL2/package.sh Executable file
View file

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

View file

@ -1,28 +0,0 @@
#!/bin/sh
PORT_DIR=bash
fetch() {
run_fetch_git "https://git.savannah.gnu.org/git/bash.git"
# Add serenity as a system for configure
run_patch configure-system.patch -p1
# For some reason, the build fails due to FILE* being undefined without this.
# This is probably a LibC bug, but work around it for now.
run_patch include-stdio.patch -p1
# Locale calls crash right now. LibC bug, probably.
run_patch disable-locale.patch -p1
}
configure() {
run_configure_autotools --disable-nls --without-bash-malloc
}
build() {
# 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 CAN_REDEFINE_GETENV 1/undef CAN_REDEFINE_GETENV/" config.h
run_make
}
install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

12
Ports/bash/package.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash ../.port_include.sh
port=bash
version=5.0
useconfigure=true
configopts="--disable-nls --without-bash-malloc"
files="https://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz bash-5.0.tar.gz"
build() {
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 make $makeopts
}

View file

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

6
Ports/binutils/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=binutils
version=2.32
useconfigure=true
configopts="--target=i686-pc-serenity --with-sysroot=/ --with-build-sysroot=$SERENITY_ROOT/Root --disable-werror --disable-gdb --disable-nls"
files="https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz binutils-2.32.tar.xz"

View file

@ -0,0 +1,127 @@
diff -Nru ../binutils-2.32/bfd/config.bfd binutils-2.32-serenity/bfd/config.bfd
--- ../binutils-2.32/bfd/config.bfd 2019-01-19 17:01:32.000000000 +0100
+++ binutils-2.32-serenity/bfd/config.bfd 2019-04-04 17:41:07.000000000 +0200
@@ -223,6 +223,20 @@
;;
# START OF targmatch.h
+
+ i[3-7]86-*-serenity*)
+ targ_defvec=i386_elf32_vec
+ targ_selvecs=
+ targ64_selvecs=x86_64_elf64_vec
+ ;;
+#ifdef BFD64
+ x86_64-*-serenity*)
+ targ_defvec=x86_64_elf64_vec
+ targ_selvecs=i386_elf32_vec
+ want64=true
+ ;;
+#endif
+
#ifdef BFD64
aarch64-*-darwin*)
targ_defvec=aarch64_mach_o_vec
diff -Nru ../binutils-2.32/config.sub binutils-2.32-serenity/config.sub
--- ../binutils-2.32/config.sub 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/config.sub 2019-04-04 17:39:29.000000000 +0200
@@ -1337,6 +1337,7 @@
# Each alternative MUST end in a * to match a version number.
# sysv* is not here because it comes later, after sysvr4.
gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | serenity* \
| *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | kopensolaris* | plan9* \
diff -Nru ../binutils-2.32/gas/configure.tgt binutils-2.32-serenity/gas/configure.tgt
--- ../binutils-2.32/gas/configure.tgt 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/gas/configure.tgt 2019-04-04 17:41:40.000000000 +0200
@@ -121,6 +121,7 @@
generic_target=${cpu_type}-$vendor-$os
# Note: This table is alpha-sorted, please try to keep it that way.
case ${generic_target} in
+ i386-*-serenity*) fmt=elf;;
aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;;
aarch64*-*-linux*) fmt=elf em=linux
diff -Nru ../binutils-2.32/ld/Makefile.am binutils-2.32-serenity/ld/Makefile.am
--- ../binutils-2.32/ld/Makefile.am 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/ld/Makefile.am 2019-04-04 17:50:13.000000000 +0200
@@ -1289,6 +1289,10 @@
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)"
+
eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -1849,6 +1853,10 @@
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)"
+
eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff -Nru ../binutils-2.32/ld/Makefile.in binutils-2.32-serenity/ld/Makefile.in
--- ../binutils-2.32/ld/Makefile.in 2019-02-02 16:54:43.000000000 +0100
+++ binutils-2.32-serenity/ld/Makefile.in 2019-04-04 17:50:55.000000000 +0200
@@ -2893,6 +2893,10 @@
eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_i386_serenity.c: $(srcdir)/emulparams/elf_i386_serenity.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_i386_serenity "$(tdir_elf_i386_serenity)"
+
eelf_i386_be.c: $(srcdir)/emulparams/elf_i386_be.sh \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
@@ -3453,6 +3457,10 @@
eelf_x86_64.c: $(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf_x86_64_serenity.c: $(srcdir)/emulparams/elf_x86_64_serenity.sh \
+ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} elf_x86_64_serenity "$(tdir_elf_x86_64_serenity)"
+
eelf_x86_64_cloudabi.c: $(srcdir)/emulparams/elf_x86_64_cloudabi.sh \
$(srcdir)/emulparams/elf_x86_64.sh \
$(ELF_X86_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff -Nru ../binutils-2.32/ld/configure.tgt binutils-2.32-serenity/ld/configure.tgt
--- ../binutils-2.32/ld/configure.tgt 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-serenity/ld/configure.tgt 2019-04-04 17:42:40.000000000 +0200
@@ -45,6 +45,15 @@
# architecture variants should be kept together even if their names
# break the alpha sorting.
case "${targ}" in
+i[3-7]86-*-serenity*)
+ targ_emul=elf_i386_serenity
+ targ_extra_emuls=elf_i386
+ targ64_extra_emuls="elf_x86_64_serenity elf_x86_64"
+ ;;
+x86_64-*-serenity*)
+ targ_emul=elf_x86_64_serenity
+ targ_extra_emuls="elf_i386_serenity elf_x86_64 elf_i386"
+ ;;
aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
aarch64-*-elf | aarch64-*-rtems*)
diff -Nru ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_i386_serenity.sh 1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.32-serenity/ld/emulparams/elf_i386_serenity.sh 2019-04-04 17:43:12.000000000 +0200
@@ -0,0 +1,3 @@
+. ${srcdir}/emulparams/elf_i386.sh
+GENERATE_SHLIB_SCRIPT=yes
+GENERATE_PIE_SCRIPT=yes
diff -Nru ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh
--- ../binutils-2.32/ld/emulparams/elf_x86_64_serenity.sh 1970-01-01 01:00:00.000000000 +0100
+++ binutils-2.32-serenity/ld/emulparams/elf_x86_64_serenity.sh 2019-04-04 17:43:34.000000000 +0200
@@ -0,0 +1 @@
+. ${srcdir}/emulparams/elf_x86_64.sh

View file

@ -1,17 +0,0 @@
#!/bin/sh
PORT_DIR=curl
fetch() {
run_fetch_web "https://curl.haxx.se/download/curl-7.65.3.tar.bz2"
run_patch fix-autoconf.patch -p1
}
configure() {
run_export_env CC i686-pc-serenity-gcc
run_configure_autotools --disable-threaded-resolver
}
build() {
run_make
}
install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

6
Ports/curl/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=curl
version=7.65.3
useconfigure=true
configopts="--disable-threaded-resolver"
files="https://curl.haxx.se/download/curl-7.65.3.tar.bz2 curl-7.65.3.tar.bz2"

View file

@ -1,15 +0,0 @@
#!/bin/sh
PORT_DIR=SerenityDOOM
fetch() {
run_fetch_git "https://github.com/SerenityOS/SerenityDOOM.git"
}
configure() {
echo ""
}
build() {
run_make -C doomgeneric/
}
install() {
run_make_install -C doomgeneric/ DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

8
Ports/doom/package.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash ../.port_include.sh
port=doom
workdir=SerenityDOOM-master
version=serenity-git
curlopts="-L"
files="https://github.com/SerenityOS/SerenityDOOM/archive/master.tar.gz doom-git.tar.gz"
makeopts="-C doomgeneric/"
installopts="-C doomgeneric/"

View file

@ -1,23 +0,0 @@
#!/bin/sh
PORT_DIR=figlet
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
fetch() {
run_fetch_web "http://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz"
run_patch figlet-no-toilet-fonts.patch -p1
}
configure() {
echo "No configure script"
}
build() {
run_make CC=i686-pc-serenity-gcc LD=i686-pc-serenity-gcc
}
install() {
run_make_install
}
. ../.port_include.sh

5
Ports/figlet/package.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash ../.port_include.sh
port=figlet
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"
makeopts="CC=i686-pc-serenity-gcc LD=i686-pc-serenity-gcc"

View file

@ -1,33 +0,0 @@
#!/bin/sh
PORT_DIR=gcc
fetch() {
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.)
run_patch $SERENITY_ROOT/Toolchain/Patches/gcc.patch -p1
# Let GCC download mpfr, mpc and isl.
run_command contrib/download_prerequisites
# Patch mpfr, mpc and isl to teach them about "serenity" targets.
run_patch dependencies-config.patch -p1
}
configure() {
run_configure_autotools \
--target=i686-pc-serenity \
--with-sysroot=/ \
--with-build-sysroot=$SERENITY_ROOT/Root \
--with-newlib \
--enable-languages=c,c++ \
--disable-lto \
--disable-nls
}
build() {
MAKEOPTS=""
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
}
install() {
run_make $INSTALLOPTS DESTDIR="$SERENITY_ROOT"/Root install-gcc install-target-libgcc install-target-libstdc++-v3
}
. ../.port_include.sh

27
Ports/gcc/package.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash ../.port_include.sh
port=gcc
version=8.3.0
useconfigure=true
configopts="--target=i686-pc-serenity --with-sysroot=/ --with-build-sysroot=$SERENITY_ROOT/Root --with-newlib --enable-languages=c,c++ --disable-lto --disable-nls"
files="https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz gcc-8.3.0.tar.xz"
makeopts="all-gcc all-target-libgcc all-target-libstdc++-v3"
installopts="DESTDIR=$SERENITY_ROOT/Root install-gcc install-target-libgcc install-target-libstdc++-v3"
depends="binutils"
fetch() {
read url filename <<< $(echo "$files")
run_nocd curl -O "$url" -o "$filename"
run_nocd tar xf "$filename"
run contrib/download_prerequisites
for f in patches/*; do
run patch -p1 < "$f"
done
}
build() {
run make $makeopts
run find ./host-i686-pc-serenity/gcc/ -maxdepth 1 -type f -executable -exec strip --strip-debug {} \; || echo
}
install() {
run make $installopts
}

6111
Ports/gcc/patches/gcc.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,17 +0,0 @@
#!/bin/sh
PORT_DIR=less
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
fetch() {
run_fetch_web "http://ftp.gnu.org/gnu/less/less-530.tar.gz"
}
configure() {
run_configure_autotools
}
build() {
run_make
}
install() {
run_make_install
}
. ../.port_include.sh

6
Ports/less/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=less
version=530
useconfigure="true"
files="http://ftp.gnu.org/gnu/less/less-530.tar.gz less-530.tar.gz"
depends="ncurses"

View file

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

5
Ports/links/package.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash ../.port_include.sh
port=links
version=2.19
useconfigure=true
files="http://links.twibright.com/download/links-2.19.tar.bz2 links-2.19.tar.bz2"

View file

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

6
Ports/lua/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=lua
version=5.3.5
files="http://www.lua.org/ftp/lua-5.3.5.tar.gz lua-5.3.5.tar.gz"
makeopts="-j$(nproc) generic"
installopts="INSTALL_TOP=$SERENITY_ROOT/Root/"

View file

@ -1,20 +0,0 @@
#!/bin/sh
PORT_DIR=make
fetch() {
run_fetch_web "https://ftp.gnu.org/gnu/make/make-4.2.tar.bz2"
run_patch make-4.2-serenity.patch -p1
}
configure() {
run_configure_autotools \
--target=i686-pc-serenity \
--with-sysroot=/
}
build() {
run_make
}
install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

6
Ports/make/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=make
version=4.2
useconfigure=true
files="https://ftp.gnu.org/gnu/make/make-4.2.tar.bz2 make-4.2.tar.bz2"
configopts="--target=i686-pc-serenity --with-sysroot=/"

View file

@ -1,25 +0,0 @@
#!/bin/sh
PORT_DIR=mbedtls
fetch() {
run_fetch_web "https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz"
run_patch remove-net-from-config.patch -p1
run_patch add-missing-includes.patch -p1
}
configure() {
echo "move along, nothing to see here"
}
build() {
run_export_env CC i686-pc-serenity-gcc
run_make clean
run_make CFLAGS=-DPLATFORM_UTIL_USE_GMTIME
}
install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

5
Ports/mbedtls/package.sh Executable file
View file

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

View file

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

7
Ports/ncurses/package.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash ../.port_include.sh
port=ncurses
version=git
workdir=ncurses-master
useconfigure=true
curlopts="-L"
files="https://github.com/mirror/ncurses/archive/master.tar.gz ncurses-git.tar.gz"

View file

@ -1,16 +0,0 @@
#!/bin/sh
PORT_DIR=nyancat
fetch() {
run_fetch_git "https://github.com/klange/nyancat.git"
run_patch serenity-changes.patch -p1
}
configure() {
echo
}
build() {
run_make
}
install() {
run_make_install DESTDIR="$SERENITY_ROOT"/Root
}
. ../.port_include.sh

6
Ports/nyancat/package.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash ../.port_include.sh
port=nyancat
version=git
workdir=nyancat-master
curlopts="-L"
files="https://github.com/klange/nyancat/archive/master.tar.gz nyancat-git.tar.gz"

17
Ports/vim/package.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash ../.port_include.sh
port=vim
version=git
workdir=vim-master
useconfigure="true"
curlopts="-L"
files="https://github.com/vim/vim/archive/master.tar.gz vim-git.tar.gz"
configopts="--with-tlib=ncurses --with-features=small"
depends="ncurses"
export vim_cv_getcwd_broken=no
export vim_cv_memmove_handles_overlap=yes
export vim_cv_stat_ignores_slash=yes
export vim_cv_tgetent=zero
export vim_cv_terminfo=yes
export vim_cv_toupper_broken=no
export vim_cv_tty_group=world

View file

@ -1,30 +0,0 @@
#!/bin/sh
PORT_DIR=vim
INSTALLOPTS="DESTDIR=$SERENITY_ROOT/Root/"
fetch() {
run_fetch_git "https://github.com/vim/vim.git"
}
configure() {
run_send_to_file src/auto/config.cache "
vim_cv_getcwd_broken=no
vim_cv_memmove_handles_overlap=yes
vim_cv_stat_ignores_slash=yes
vim_cv_tgetent=zero
vim_cv_terminfo=yes
vim_cv_toupper_broken=no
vim_cv_tty_group=world
"
run_configure_autotools --with-tlib=ncurses --with-features=small
}
build() {
run_make
}
install() {
run_make_install
}
. ../.port_include.sh