erlang: Cleanup and improve build script

- Add a src checksum
- Put host-built binaries first into PATH to avoid problems if
  and erlang is already available.
- Do not build a new host build on every build
This commit is contained in:
Fredrik Fornwall 2017-01-10 03:15:05 -05:00
parent 508fa73cb8
commit 11e97371db

View File

@ -2,33 +2,24 @@ TERMUX_PKG_HOMEPAGE="https://www.erlang.org/"
TERMUX_PKG_DESCRIPTION="General-purpose concurrent functional programming language developed by Ericsson"
TERMUX_PKG_VERSION="19.2"
TERMUX_PKG_DEPENDS="openssl, ncurses, libutil"
TERMUX_PKG_SRCURL="https://github.com/erlang/otp/archive/OTP-${TERMUX_PKG_VERSION}.tar.gz"
TERMUX_PKG_FOLDERNAME="otp-OTP-${TERMUX_PKG_VERSION}"
TERMUX_PKG_SRCURL="http://erlang.org/download/otp_src_${TERMUX_PKG_VERSION}.tar.gz"
TERMUX_PKG_SHA256=a016b3ef5dac1e532972617b2715ef187ecb616f7cd7ddcfe0f1d502f5d24870
TERMUX_PKG_FOLDERNAME="otp_src_$TERMUX_PKG_VERSION"
TERMUX_PKG_HOSTBUILD="yes"
TERMUX_PKG_BUILD_IN_SRC="yes"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--without-javac --with-ssl=${TERMUX_PREFIX} --with-termcap"
termux_step_post_extract_package () {
rm -Rf "$TERMUX_PKG_HOSTBUILD_DIR"
export ERL_TOP="$TERMUX_PKG_SRCDIR"
cd "$ERL_TOP"
./otp_build autoconf
}
TERMUX_PKG_EXTRA_MAKE_ARGS="noboot"
termux_step_host_build () {
cd $ERL_TOP
./configure --enable-bootstrap-only
make -j "$TERMUX_MAKE_PROCESSES"
cd $TERMUX_PKG_SRCDIR
./configure --enable-bootstrap-only
make -j "$TERMUX_MAKE_PROCESSES"
cp "${TERMUX_PKG_SRCDIR}"/bin/*/* "$TERMUX_PKG_HOSTBUILD_DIR"
}
termux_step_pre_configure () {
LDFLAGS+=" -llog"
}
termux_step_make () {
cp "${TERMUX_PKG_SRCDIR}/bin/x86_64-unknown-linux-gnu/"* "${TERMUX_PKG_SRCDIR}/bootstrap/bin"
PATH+=":${TERMUX_PKG_SRCDIR}/bootstrap/bin"
make -j $TERMUX_MAKE_PROCESSES noboot
# liblog is needed for syslog usage:
LDFLAGS+=" -llog"
# Put binaries built in termux_step_host_build at start of PATH:
export PATH="$TERMUX_PKG_HOSTBUILD_DIR:$PATH"
}