1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-18 04:47:07 +00:00
termux-packages/packages/gnushogi/build.sh
Fredrik Fornwall 147c3125b1 Fix rpl_malloc when cross compiling
Work around rpl_malloc being used, see
http://wiki.buici.com/xwiki/bin/view/Programing+C+and+C%2B%2B/Autoconf+and+RPL_MALLOC
for more information:

"The AC_FUNC_MALLOC macro makes sure that the malloc function when passed a zero
argument returns a valid memory block instead of a NULL pointer. This behaviour
conforms to the GNU C library.  Normally, this is a reasonable test that autoconf
makes at build-time. In the case of cross-compilation, however, autoconf cannot
execute a program to verify proper behavior.  It makes the conservative assumption
that the target library will produce non-conforming code.

Failure of this test causes autconf to replace malloc() calls with rpl_malloc()
calls. At link time, if there is no rpl_malloc() function, the linker will fail
with an error describing the missing symbol. The autoconf documentation recommends
adding this harmless code to the application to implement the function."

In Termux the rpl_malloc() usage is useless at best, and may also prevent building
some packages as well as giving runtime crashes for libgc-using packages or others
expecting to intercept malloc.

Previously some packages specified worked around this themselves, but the configure
arguments are now moved into build-package.sh.
2021-11-27 13:00:40 +01:00

16 lines
730 B
Bash

TERMUX_PKG_HOMEPAGE=http://www.gnu.org/software/gnushogi/
TERMUX_PKG_DESCRIPTION="Program that plays the game of Shogi, also known as Japanese Chess"
TERMUX_PKG_VERSION=1.4.2
TERMUX_PKG_SRCURL=http://ftp.gnu.org/gnu/gnushogi/gnushogi-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_lib_curses_clrtoeol=yes --with-curses"
TERMUX_PKG_RM_AFTER_INSTALL="info/gnushogi.info"
TERMUX_PKG_DEPENDS="ncurses"
TERMUX_PKG_HOSTBUILD=yes
export CFLAGS="$CFLAGS $CPPFLAGS"
termux_step_post_configure () {
cp $TERMUX_PKG_HOSTBUILD_DIR/gnushogi/pat2inc $TERMUX_PKG_BUILDDIR/gnushogi/pat2inc
# Update timestamps so that the binaries does not get rebuilt:
$TERMUX_TOUCH -d "next hour" $TERMUX_PKG_BUILDDIR/gnushogi/pat2inc
}