termux-packages/packages/gn/build.sh
2021-09-03 20:46:03 +03:00

51 lines
1.5 KiB
Bash
Executable File

TERMUX_PKG_HOMEPAGE=https://gn.googlesource.com/gn
TERMUX_PKG_DESCRIPTION="Meta-build system that generates build files for Ninja"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="Yaksh Bariya <yakshbari4@gmail.com>"
# While updating commit hash here also update it in
# termux_setup_gn
_COMMIT=69ec4fca1fa69ddadae13f9e6b7507efa0675263
TERMUX_PKG_VERSION=0.1
TERMUX_PKG_RECOMMENDS="ninja"
TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_get_source() {
TERMUX_PKG_SRCURL=https://gn.googlesource.com/gn/+archive/$_COMMIT.tar.gz
# Prevent caching of builds
rm -rf $TERMUX_PKG_SRCDIR
# FIXME: We would like to enable checksums when downloading
# tar files, but they change each time as the tar metadata
# differs: https://github.com/google/gitiles/issues/84
GN_TARFILE=$TERMUX_PKG_CACHEDIR/gn_$_COMMIT.tar.gz
test ! -f $GN_TARFILE && termux_download \
$TERMUX_PKG_SRCURL \
$GN_TARFILE \
SKIP_CHECKSUM
mkdir -p $TERMUX_PKG_SRCDIR
tar xf $GN_TARFILE -C $TERMUX_PKG_SRCDIR
}
termux_step_configure() {
./build/gen.py \
--no-last-commit-position \
--no-static-libstdc++
cat <<- EOF > ./out/last_commit_position.h
#ifndef OUT_LAST_COMMIT_POSITION_H_
#define OUT_LAST_COMMIT_POSITION_H_
#define LAST_COMMIT_POSITION_NUM ${TERMUX_PKG_VERSION##0.}
#define LAST_COMMIT_POSITION "${TERMUX_PKG_VERSION}"
#endif // OUT_LAST_COMMIT_POSITION_H_
EOF
}
termux_step_make() {
termux_setup_ninja
ninja -C out/
}
termux_step_make_install() {
install -Dm755 -t $TERMUX_PREFIX/bin out/gn
}