| 1 | TERMUX_PKG_HOMEPAGE=https://www.ruby-lang.org/ |
| 2 | TERMUX_PKG_DESCRIPTION="Dynamic programming language with a focus on simplicity and productivity" |
| 3 | _MAJOR_VERSION=2.2 |
| 4 | TERMUX_PKG_VERSION=${_MAJOR_VERSION}.3 |
| 5 | TERMUX_PKG_SRCURL=http://cache.ruby-lang.org/pub/ruby/${_MAJOR_VERSION}/ruby-${TERMUX_PKG_VERSION}.tar.xz |
| 6 | # libbffi is used by the fiddle extension module: |
| 7 | TERMUX_PKG_DEPENDS="libffi, libgmp, readline, openssl" |
| 8 | TERMUX_PKG_KEEP_HEADER_FILES="true" |
| 9 | # Needed to fix compilation on android: |
| 10 | TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_setgroups=no ac_cv_func_setresuid=no ac_cv_func_setreuid=no --enable-rubygems" |
| 11 | |
| 12 | # Ruby does not use this directly, but specify for gem building C++-using extensions: |
| 13 | CXXFLAGS+=" -frtti -fexceptions" # -lgnustl_shared" |
| 14 | |
| 15 | termux_step_pre_configure () { |
| 16 | export GEM_HOME=$TERMUX_PREFIX/var/lib/gems |
| 17 | mkdir -p $GEM_HOME |
| 18 | } |
| 19 | |
| 20 | termux_step_make_install () { |
| 21 | make install |
| 22 | make uninstall # remove possible remains to get fresh timestamps |
| 23 | make install |
| 24 | |
| 25 | # rbconfig.rb, used to build native gems, thinks that ${TERMUX_HOST_PLATFORM}-gcc should |
| 26 | # be used, but we want normal gcc |
| 27 | local RBCONFIG=$TERMUX_PREFIX/lib/ruby/${_MAJOR_VERSION}.0/arm-linux-androideabi/rbconfig.rb |
| 28 | for tool in gcc "g\+\+" strip nm objdump ar ranlib ld cpp; do |
| 29 | perl -p -i -e "s/${TERMUX_HOST_PLATFORM}-$tool/$tool/g" $RBCONFIG |
| 30 | done |
| 31 | perl -p -i -e 's@"/bin/mkdir@"/system/bin/mkdir@' $RBCONFIG |
| 32 | perl -p -i -e "s@/usr/bin/install@$TERMUX_PREFIX/bin/applets/install@" $RBCONFIG |
| 33 | # Make C++-using gems link against libgnustl_shared instead of the limited system libstdc++: |
| 34 | perl -p -i -e 's/\(CXX\) -shared/\(CXX\) -shared -lgnustl_shared/' $RBCONFIG |
| 35 | } |
| 36 | |
| 37 | |
| 38 | # FIXME: |
| 39 | # ruby -e 'p Encoding::default_external' |
| 40 | # prints US-ASCII |