Cleanup of more packages
[termux-packages] / packages / ruby / build.sh
CommitLineData
59f0d218
FF
1TERMUX_PKG_HOMEPAGE=https://www.ruby-lang.org/
2TERMUX_PKG_DESCRIPTION="Dynamic programming language with a focus on simplicity and productivity"
98e0a8ee 3_MAJOR_VERSION=2.3
549acba1 4TERMUX_PKG_VERSION=${_MAJOR_VERSION}.1
a8dfe862 5TERMUX_PKG_BUILD_REVISION=5
59f0d218
FF
6TERMUX_PKG_SRCURL=http://cache.ruby-lang.org/pub/ruby/${_MAJOR_VERSION}/ruby-${TERMUX_PKG_VERSION}.tar.xz
7# libbffi is used by the fiddle extension module:
76d22fff 8TERMUX_PKG_DEPENDS="libandroid-support, libffi, libgmp, readline, openssl, libutil"
59f0d218
FF
9TERMUX_PKG_KEEP_HEADER_FILES="true"
10# Needed to fix compilation on android:
11TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_setgroups=no ac_cv_func_setresuid=no ac_cv_func_setreuid=no --enable-rubygems"
6352f1b9
FF
12# The gdbm module seems to be very little used:
13TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --without-gdbm"
14# Do not link in libcrypt.so if available (now in disabled-packages):
15TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_lib_crypt_crypt=no"
a8dfe862
FF
16# Fix DEPRECATED_TYPE macro clang compatibility:
17TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" rb_cv_type_deprecated=x"
7ce56385
FF
18# getresuid(2) does not work on ChromeOS - https://github.com/termux/termux-app/issues/147:
19# TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" ac_cv_func_getresuid=no"
59f0d218 20
7ce56385
FF
21termux_step_pre_configure() {
22 # Ruby does not use this directly, but specify for gem building C++-using extensions:
23 CXXFLAGS+=" -frtti -fexceptions"
59f0d218 24
59f0d218
FF
25 export GEM_HOME=$TERMUX_PREFIX/var/lib/gems
26 mkdir -p $GEM_HOME
27}
28
29termux_step_make_install () {
30 make install
31 make uninstall # remove possible remains to get fresh timestamps
32 make install
33
f34a276b
FF
34 # rbconfig.rb, used to build native gems, thinks that ${TERMUX_HOST_PLATFORM}-$TOOLNAME should
35 # be used, but we want the unprefixed $TOOLNAME:
3a663827 36 local RBCONFIG=$TERMUX_PREFIX/lib/ruby/${_MAJOR_VERSION}.0/${TERMUX_HOST_PLATFORM}/rbconfig.rb
59f0d218
FF
37 for tool in gcc "g\+\+" strip nm objdump ar ranlib ld cpp; do
38 perl -p -i -e "s/${TERMUX_HOST_PLATFORM}-$tool/$tool/g" $RBCONFIG
39 done
f34a276b
FF
40
41 # Fix absolute paths to executables:
a962e732
FF
42 perl -p -i -e 's/^.*CONFIG\["INSTALL"\].*$/ CONFIG["INSTALL"] = "install -c"/' $RBCONFIG
43 perl -p -i -e 's/^.*CONFIG\["PKG_CONFIG"\].*$/ CONFIG["PKG_CONFIG"] = "pkg-config"/' $RBCONFIG
44 perl -p -i -e 's/^.*CONFIG\["MAKEDIRS"\].*$/ CONFIG["MAKEDIRS"] = "mkdir -p"/' $RBCONFIG
45 perl -p -i -e 's/^.*CONFIG\["MKDIR_P"\].*$/ CONFIG["MKDIR_P"] = "mkdir -p"/' $RBCONFIG
46 perl -p -i -e 's/^.*CONFIG\["EGREP"\].*$/ CONFIG["EGREP"] = "grep -E"/' $RBCONFIG
47 perl -p -i -e 's/^.*CONFIG\["GREP"\].*$/ CONFIG["GREP"] = "grep"/' $RBCONFIG
f34a276b 48
0aa37fa2
FF
49 # Fix mention of $_SPECSFLAG in rbconfig:
50 perl -p -i -e "s|${_SPECSFLAG}||g" $RBCONFIG
59f0d218 51}
10f54605
FF
52
53termux_step_post_massage () {
54 if [ ! -f $TERMUX_PREFIX/lib/ruby/${_MAJOR_VERSION}.0/${TERMUX_HOST_PLATFORM}/readline.so ]; then
55 echo "Error: The readline extension was not built"
56 fi
57}