aboutsummaryrefslogtreecommitdiffstats
path: root/community/jruby
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-08-17 17:43:15 +0200
committerJakub Jirutka <jakub@jirutka.cz>2016-08-17 17:44:37 +0200
commit73f1c44d18ceebd6e5a58b430adca41bb5e3fefb (patch)
tree7a2e0f5f45c26958e422394af8fb5ee3aefbdd0e /community/jruby
parent5eb15b8927fc8bed20344fa52c43d50cb1051ce6 (diff)
downloadaports-73f1c44d18ceebd6e5a58b430adca41bb5e3fefb.tar.bz2
aports-73f1c44d18ceebd6e5a58b430adca41bb5e3fefb.tar.xz
community/jruby: move from testing
Diffstat (limited to 'community/jruby')
-rw-r--r--community/jruby/APKBUILD153
-rw-r--r--community/jruby/jruby231
2 files changed, 384 insertions, 0 deletions
diff --git a/community/jruby/APKBUILD b/community/jruby/APKBUILD
new file mode 100644
index 0000000000..59bd570fa1
--- /dev/null
+++ b/community/jruby/APKBUILD
@@ -0,0 +1,153 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+# Note: This abuild excludes Truffle, because it's still experimental,
+# so it's probably not much usable for regular users.
+pkgname=jruby
+pkgver=9.1.2.0
+pkgrel=0
+pkgdesc="An implementation of Ruby on the JVM"
+url="http://jruby.org"
+# openjdk8 is currently built only for x86*
+arch="x86 x86_64"
+license="EPL GPL-2 LGPL-2.1 custom"
+# libc6-compat: https://github.com/jnr/jnr-posix/issues/73
+depends="$pkgname-libs java-jffi-native>=1.2 libc6-compat>=1.1.12-r5 openjdk8-jre-base"
+makedepends="openjdk8 zip"
+subpackages="$pkgname-irb $pkgname-minitest $pkgname-rake $pkgname-rdoc
+ $pkgname-readline $pkgname-testunit $pkgname-libs"
+# jruby (launch script): https://github.com/jruby/jruby/pull/1860
+source="https://s3.amazonaws.com/jruby.org/downloads/$pkgver/$pkgname-bin-$pkgver.tar.gz
+ jruby"
+builddir="$srcdir/$pkgname-$pkgver"
+
+_destdir="/usr/share/$pkgname"
+_bindir="$_destdir/bin"
+_rubydir="$_destdir/lib/ruby"
+_gemdir="$_rubydir/gems/shared"
+_stdlibdir="$_rubydir/stdlib"
+
+case "$CARCH" in
+arm*) _arch=arm;;
+x86) _arch=i386;;
+*) _arch="$CARCH";;
+esac
+
+prepare() {
+ cd "$builddir/bin"
+ rm *.bat *.dll *.exe
+ rm jirb_swing jruby jruby+truffle jruby200.sh jruby.*
+
+ cd "$builddir/lib/ruby/stdlib"
+ rm -r win32 Win32API.rb
+ find ./ffi/platform -type d -mindepth 1 ! -name "$_arch-linux" -exec rm -r {} +
+
+ # Remove useless native binaries from JARs.
+ zip -qd jline/jline/*/jline-*.jar META-INF/native/*
+ zip -qd "$builddir"/lib/jruby.jar jni/*
+}
+
+package() {
+ cd "$builddir"
+
+ install -m644 -D "$builddir"/lib/jruby.jar \
+ "$pkgdir"$_destdir/lib/jruby.jar || return 1
+
+ install -m755 -D "$srcdir"/jruby "$pkgdir"$_bindir/jruby || return 1
+
+ # Some of the below copied files will be moved to subpackages by split functions.
+
+ install -dm755 "$pkgdir"$_rubydir
+ cp -r lib/ruby/gems lib/ruby/stdlib "$pkgdir"$_destdir/lib/ruby/ || return 1
+
+ cp bin/* "$pkgdir"$_bindir/ || return 1
+
+ install -dm755 "$pkgdir"/usr/bin
+ local file; for file in jgem jirb jruby jrubyc; do
+ ln -sf $_bindir/$file "$pkgdir"/usr/bin/$file || return 1
+ done
+
+ install -m644 -D COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
+}
+
+irb() {
+ pkgdesc="Interactive Ruby console"
+ depends="$pkgname $pkgname-readline"
+
+ _mvgem irb
+ _mv $_bindir/irb usr/bin/jirb
+}
+
+minitest() {
+ pkgdesc="Ruby testing tool supporting TDD, BDD, mocking, and benchmarking"
+ depends="$pkgname"
+
+ _mvgem minitest
+}
+
+rake() {
+ pkgdesc="Ruby based make-like utility."
+ depends="$pkgname"
+
+ _mvgem rake || return 1
+ _mv $_bindir/rake
+}
+
+rdoc() {
+ pkgdesc="Ruby documentation tool"
+ depends="$pkgname $pkgname-irb"
+
+ _mvgem rdoc || return 1
+ _mv $_bindir/rdoc $_bindir/ri
+}
+
+readline() {
+ pkgdesc="Readline support for JRuby"
+ depends="$pkgname java-jansi-native"
+
+ _mv $_stdlibdir/jline || return 1
+ mv "$pkgdir"$_stdlibdir/readline* "$subpkgdir"$_stdlibdir/
+}
+
+testunit() {
+ pkgdesc="Legacy xUnit family unit testing framework for Ruby."
+ depends="$pkgname"
+
+ _mvgem test-unit || return 1
+ _mv $_stdlibdir/test $_bindir/testrb
+}
+
+libs() {
+ pkgdesc="JRuby's standard libraries"
+ depends=""
+
+ _mv $_rubydir/gems $_rubydir/stdlib
+}
+
+
+_mv() {
+ local path; for path in "$@"; do
+ mkdir -p "$subpkgdir"/${path%/*}
+ mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/ || return 1
+ done
+}
+
+_mvgem() {
+ local name="$1"
+ local file
+
+ cd "$pkgdir"
+ for file in ./$_stdlibdir/$name.rb \
+ ./$_stdlibdir/$name \
+ ./$_gemdir/gems/$name-* \
+ ./$_gemdir/specifications/default/$name-*; do
+ [ -e "$pkgdir"/$file ] || continue
+ _mv "$file" || return 1
+ done
+}
+
+md5sums="749bb917dde9666e365e12bbe776a5c2 jruby-bin-9.1.2.0.tar.gz
+7e6d8f6168f4a69109ea9d14e3e9f874 jruby"
+sha256sums="60598a465883ab4c933f805de4a7f280052bddc793b95735465619c03ca43f35 jruby-bin-9.1.2.0.tar.gz
+51794ecefb0d8fd3084ffb10867e2feffc9ccfadb45021af68520cf75fe58590 jruby"
+sha512sums="cc6b1e1a2907c128dd04edf9da11933a54bbed5e861ab6f0208505bca5aa2aa9d9acdd04bfde65824346fbb435584081fc8ec2e2e9a3aeea1bef8047915e0c61 jruby-bin-9.1.2.0.tar.gz
+d0f19f791274f00f5b35a5e9a5dfe885d58330ebd3fd959f7325e545357497609403b5646988651265d08ac7a08cfec8b88ec260da558bcb0db623d9b8ce5a20 jruby"
diff --git a/community/jruby/jruby b/community/jruby/jruby
new file mode 100644
index 0000000000..4b7fd77571
--- /dev/null
+++ b/community/jruby/jruby
@@ -0,0 +1,231 @@
+#!/bin/sh
+# vim: set ts=4:
+#
+# This jruby start script is rewrite of (poor) upstream's jruby.bash.
+# It's POSIX compatible, more clean, with sensible defaults for Alpine Linux
+# and without Windows, OS X and Truffle stuff. Beside that it should support
+# all the options of jruby.bash (hopefully) with the same behaviour.
+#
+# -----BEGIN HELP-----
+#
+# Environment variables:
+# CLASSPATH Additional paths to be added to the end of the Java classpath.
+# This may be overwritten by CLI argument -J-classpath or -J-cp.
+# JAVA_HOME Path to directory where is JRE/JVM installed to use specific java/jdb binary,
+# not the one on the PATH.
+# JAVA_OPTS Default options to be passed to JVM.
+# JRUBY_HOME Path to directory where JRuby is installed (default is /usr/share/java/jruby).
+# JRUBY_OPTS Default JRuby command line arguments.
+# JRUBY_SHELL Path to the system shell executable (default is /bin/sh).
+# PROFILE_ARGS Arguments for the instrumented profiler.
+#
+# Deprecated environment variables (for compatibility):
+# JAVA_MEM The -Xmx (maximum memory allocation) parameter for JVM (e.g. -Xmx128M).
+# This may be overwritten by CLI argument -J-Xmx.
+# JAVA_STACK The -Xss (stack size) parameter for JVM (default is -Xss2048k).
+# This may be overwritten by CLI argument -J-Xss.
+# JAVA_VM What JIT mode to use; -client, or -server (default is -server).
+# This may be overwritten by CLI arguments --server, --client, and --dev.
+# JRUBY_PARENT_CLASSPATH Classpath propagated from the parent JRuby process.
+#
+# All the environment variables are optional.
+# -----END HELP-----
+#
+set -eu
+
+readonly MAIN_CLASS_JRUBY='org.jruby.Main'
+readonly MAIN_CLASS_NGCLIENT='org.jruby.util.NailMain'
+readonly MAIN_CLASS_NGSERVER='org.jruby.main.NailServerMain'
+
+readonly JRUBY_HOME="${JRUBY_HOME:-"/usr/share/jruby"}"
+readonly JRUBY_CP="$JRUBY_HOME/lib/jruby.jar"
+readonly JRUBY_SHELL="${JRUBY_SHELL:-"/bin/sh"}"
+readonly NAILGUN_CMD="$JRUBY_HOME/tool/nailgun/ng"
+readonly PROFILE_ARGS="${PROFILE_ARGS:-}"
+
+
+java_stack="${JAVA_STACK:-"-Xss2048k"}"
+java_cmd="${JAVA_HOME:+"$JAVA_HOME/bin/"}java"
+
+java_opts="${JAVA_OPTS:-} ${JAVA_MEM:-} $java_stack
+ -Dorg.xerial.snappy.use.systemlib=true"
+
+# Use the same classpath propagated from parent jruby, if provided.
+classpath="${JRUBY_PARENT_CLASSPATH:-}"
+if [ -z "$classpath" ]; then
+ _excluded='jruby.jar jruby-truffle.jar jruby-complete.jar'
+
+ # Add all JARs from $JRUBY_HOME/lib to the classpath, except $_excluded.
+ classpath=$(find "$JRUBY_HOME/lib" -maxdepth 1 \
+ -name '*.jar' $(printf '! -name %s ' $_excluded) -print0 \
+ | xargs -0 printf '%s:')
+ classpath="${classpath%?}" # %? removes leading ":"
+fi
+
+extra_cp="${CLASSPATH:-}"
+java_vm="${JAVA_VM:-"-server"}"
+main_class="$MAIN_CLASS_JRUBY"
+nailgun_client='no'
+ruby_args=''
+verify_jruby='no'
+
+
+# Split out any -J argument for passing to the JVM.
+# Scanning for args is aborted by '--'.
+set -- ${JRUBY_OPTS:-} $@
+while [ $# -gt 0 ]; do
+ case "$1" in
+ # Stuff after "-J" goes to JVM.
+ -J | -J-X)
+ "$java_cmd" -help
+ printf '\n(Prepend -J in front of these options when using "jruby" command)\n'
+ exit 1
+ ;;
+ -J-classpath | -J-cp)
+ extra_cp="$2"
+ shift
+ ;;
+ -J-ea)
+ verify_jruby='yes'
+ java_opts="$java_opts ${1:2}"
+ ;;
+ -J*)
+ java_opts="$java_opts ${1:2}"
+ ;;
+ # Pass -X... and -X? search options through.
+ -X*\.\.\.|-X*\?)
+ ruby_args="$ruby_args $1"
+ ;;
+ # Match -Xa.b.c=d to translate to -Da.b.c=d as a Java option.
+ -X*)
+ val=${1:2}
+ if expr "$val" : '.*[.]' > /dev/null; then
+ java_opts="$java_opts -Djruby.$val"
+ else
+ ruby_args="$ruby_args -X$val"
+ fi
+ ;;
+ # Match switches that take an argument.
+ -C | -e | -I | -S)
+ ruby_args="$ruby_args $1 $2"
+ shift
+ ;;
+ # Match same switches with argument stuck together.
+ -e* | -I* | -S*)
+ ruby_args="$ruby_args $1"
+ ;;
+ # Run with JMX management enabled.
+ --manage)
+ java_opts="$java_opts -Dcom.sun.management.jmxremote \
+ -Djruby.management.enabled=true"
+ ;;
+ # Don't launch a GUI window, no matter what.
+ --headless)
+ java_opts="$java_opts -Djava.awt.headless=true"
+ ;;
+ # Run under JDB (debug mode).
+ --jdb)
+ java_cmd="${JAVA_HOME:+"$JAVA_HOME/bin/"}jdb"
+ java_opts="$java_opts -sourcepath $JRUBY_HOME/lib/ruby/1.9:."
+ ruby_args="$ruby_args -X+C"
+ ;;
+ --client | --server)
+ java_vm="${1#?}" # #? removes leading "-"
+ ;;
+ --dev)
+ java_vm='-client'
+ java_opts="$java_opts -XX:+TieredCompilation -XX:TieredStopAtLevel=1 \
+ -Djruby.compile.mode=OFF -Djruby.compile.invokedynamic=false"
+ ;;
+ --sample)
+ java_opts="$java_opts -Xprof"
+ ;;
+ # Start up as Nailgun server.
+ --ng-server)
+ main_class="$MAIN_CLASS_NGSERVER"
+ verify_jruby='yes'
+ ;;
+ # Use native Nailgun client to toss commands to server.
+ --ng-client | --ng)
+ nailgun_client='yes'
+ ;;
+ # Warn but ignore.
+ --1.8 | --1.9 | --2.0)
+ echo "WARNING: $1 is ignored"
+ ;;
+ -h | -help | --help)
+ "$java_cmd" -help
+ # Print help from the top of this script.
+ sed -En '/-{5}BEGIN HELP-{5}/,/-{5}END HELP-{5}/p' "$0" \
+ | sed -E "s/^# ?//; 1d;\$d;"
+ exit 0
+ ;;
+ # Abort processing on the double dash.
+ --)
+ break
+ ;;
+ # Other opts go to ruby.
+ -*)
+ ruby_args="$ruby_args $1"
+ ;;
+ # Abort processing on first non-opt arg.
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+# Remove possible duplications of some common JVM options.
+for opt in -Xmx -Xms -Xss; do
+ val=$(expr "$java_opts" : ".*$opt\([^ \t]*\).*" ||:) # gets the later one
+ if [ -n "$val" ]; then
+ # Remove all occurrences of $opt and append the last one to the end.
+ java_opts=$(echo "$java_opts" | sed "s/$opt[^ \t]*//g")
+ java_opts="$java_opts ${opt}${val}"
+ fi
+done
+
+classpath="$classpath${extra_cp:+":$extra_cp"}"
+java_opts="$java_opts $java_vm
+ -Djruby.home=$JRUBY_HOME
+ -Djruby.lib=$JRUBY_HOME/lib
+ -Djruby.script=jruby
+ -Djruby.shell=$JRUBY_SHELL"
+
+# Append the rest of the arguments.
+ruby_args="$ruby_args $@"
+
+# Put $ruby_args back into the position arguments $1, $2, ...
+set -- $ruby_args
+
+
+if [ "$nailgun_client" = 'yes' ]; then
+ if [ ! -f "$NAILGUN_CMD" ]; then
+ echo 'ERROR: ng executable not found' 1>&2
+ exit 1
+ fi
+ exec "$NAILGUN_CMD" $MAIN_CLASS_NGCLIENT $@
+
+elif [ "$verify_jruby" = 'yes' ]; then
+ [ -n "$PROFILE_ARGS" ] && echo 'Running with instrumented profiler'
+
+ set +e
+ "$java_cmd" $PROFILE_ARGS $java_opts \
+ -classpath "$JRUBY_CP:$classpath" $main_class $@
+ exit_code=$?
+ set -e
+
+ if [ -n "$PROFILE_ARGS" ]; then
+ echo 'Profiling results:'
+ cat profile.txt
+ rm profile.txt
+ fi
+
+ exit $exit_code
+
+else
+ exec "$java_cmd" $java_opts -Xbootclasspath/a:"$JRUBY_CP" \
+ ${classpath:+"-classpath $classpath"} \
+ $main_class $@
+fi