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