Skip to content

Commit

Permalink
forked version of termux-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kcubeterm committed Jul 2, 2022
0 parents commit a1c3f7f
Show file tree
Hide file tree
Showing 125 changed files with 12,983 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Default.
* text eol=lf

# Treat patch files as binaries but let diff'ing them
# as normal text.
*.diff binary diff
*.patch binary diff
*.patch32 binary diff
*.patch64 binary diff
*.patch.* binary diff

# Powershell scripts.
*.ps1 text eol=crlf

# Binaries.
*.gpg binary
*.gz binary
*.jpg binary
*.png binary
*.tar binary
*.tar.* binary
14 changes: 14 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
daysUntilStale: 45
daysUntilClose: 14

exemptLabels:
- "not stale"
- "package request"

markComment: >
This issue/PR has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
staleLabel: wontfix

23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

# Vagrant
scripts/*.log
scripts/.vagrant/

# Built *.deb files.
/debs/
/output/

# Preinstalled build tools.
/build-tools/

# Predownloaded packages sources.
/packages/*/cache
/root-packages/*/cache
/x11-packages/*/cache
11 changes: 11 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# License for package patches

The scripts and patches to build each package is licensed under the same
license as the actual package (so the patches and scripts to build bash are
licensed under the same license as bash, while the patches and scripts to build
python are licensed under the same license as python).

# License for the build infrastructure

For build infrastructure outside the `packages/` folder the license is
[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
88 changes: 88 additions & 0 deletions build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash
# build-all.sh - script to build all packages with a build order specified by buildorder.py

set -e -u -o pipefail

if [ "$(uname -o)" = "Android" ] || [ -e "/system/bin/app_process" ]; then
echo "On-device execution of this script is not supported."
exit 1
fi

# Read settings from .termuxrc if existing
test -f "$HOME"/.termuxrc && . "$HOME"/.termuxrc
: ${TERMUX_TOPDIR:="$HOME/.termux-build"}
: ${TERMUX_ARCH:="aarch64"}
: ${TERMUX_DEBUG_BUILD:=""}
: ${TERMUX_INSTALL_DEPS:="-s"}
# Set TERMUX_INSTALL_DEPS to -s unless set to -i

_show_usage() {
echo "Usage: ./build-all.sh [-a ARCH] [-d] [-i] [-o DIR]"
echo "Build all packages."
echo " -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
echo " -d Build with debug symbols."
echo " -i Build dependencies."
echo " -o Specify deb directory. Default: debs/."
exit 1
}

while getopts :a:hdio: option; do
case "$option" in
a) TERMUX_ARCH="$OPTARG";;
d) TERMUX_DEBUG_BUILD='-d';;
i) TERMUX_INSTALL_DEPS='-i';;
o) TERMUX_OUTPUT_DIR="$(realpath -m "$OPTARG")";;
h) _show_usage;;
*) _show_usage >&2 ;;
esac
done
shift $((OPTIND-1))
if [ "$#" -ne 0 ]; then _show_usage; fi

if [[ ! "$TERMUX_ARCH" =~ ^(all|aarch64|arm|i686|x86_64)$ ]]; then
echo "ERROR: Invalid arch '$TERMUX_ARCH'" 1>&2
exit 1
fi

BUILDSCRIPT=$(dirname "$0")/build-package.sh
BUILDALL_DIR=$TERMUX_TOPDIR/_buildall-$TERMUX_ARCH
BUILDORDER_FILE=$BUILDALL_DIR/buildorder.txt
BUILDSTATUS_FILE=$BUILDALL_DIR/buildstatus.txt

if [ -e "$BUILDORDER_FILE" ]; then
echo "Using existing buildorder file: $BUILDORDER_FILE"
else
mkdir -p "$BUILDALL_DIR"
./scripts/buildorder.py > "$BUILDORDER_FILE"
fi
if [ -e "$BUILDSTATUS_FILE" ]; then
echo "Continuing build-all from: $BUILDSTATUS_FILE"
fi

exec > >(tee -a "$BUILDALL_DIR"/ALL.out)
exec 2> >(tee -a "$BUILDALL_DIR"/ALL.err >&2)
trap 'echo ERROR: See $BUILDALL_DIR/${PKG}.err' ERR

while read -r PKG PKG_DIR; do
# Check build status (grepping is a bit crude, but it works)
if [ -e "$BUILDSTATUS_FILE" ] && grep "^$PKG\$" "$BUILDSTATUS_FILE" >/dev/null; then
echo "Skipping $PKG"
continue
fi

echo -n "Building $PKG... "
BUILD_START=$(date "+%s")
bash -x "$BUILDSCRIPT" -a "$TERMUX_ARCH" $TERMUX_DEBUG_BUILD \
${TERMUX_OUTPUT_DIR+-o $TERMUX_OUTPUT_DIR} $TERMUX_INSTALL_DEPS "$PKG_DIR" \
> "$BUILDALL_DIR"/"${PKG}".out 2> "$BUILDALL_DIR"/"${PKG}".err
BUILD_END=$(date "+%s")
BUILD_SECONDS=$(( BUILD_END - BUILD_START ))
echo "done in $BUILD_SECONDS"

# Update build status
echo "$PKG" >> "$BUILDSTATUS_FILE"
done<"${BUILDORDER_FILE}"

# Update build status
rm -f "$BUILDSTATUS_FILE"
echo "Finished"
Loading

0 comments on commit a1c3f7f

Please sign in to comment.