termux-packages/packages/gn/build.sh

51 lines
1.5 KiB
Bash
Raw Normal View History

2021-09-03 19:46:03 +02:00
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
2021-12-05 16:49:02 +01:00
_COMMIT=e0afadf7a743d5b14737bd454df45d5f1caf0d23
TERMUX_PKG_VERSION=20211203
2021-09-03 19:46:03 +02:00
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_
2021-12-05 16:49:02 +01:00
#define LAST_COMMIT_POSITION_NUM 1953
#define LAST_COMMIT_POSITION "1953 ${_COMMIT:0:8}"
2021-09-03 19:46:03 +02:00
#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
}