Skip to content

Commit

Permalink
igv: add version 2.17.1
Browse files Browse the repository at this point in the history
See  https://openjdk.org/jeps/261 for the '--add-exports' fix
in igv.args
  • Loading branch information
thomas committed Feb 7, 2024
1 parent 160c6a9 commit 8064543
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions igv-2.17.1-0.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#! /bin/bash

# http://software.broadinstitute.org/software/igv/

## https://data.broadinstitute.org/igv/projects/downloads/2.17/IGV_2.17.1.zip

set -xe

PKG=igv
VERSION=2.17.1
BUILD=0

PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$USER/$PKG-$VERSION-$BUILD ; fi

mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
. /pkg/openjdk-21.0.0.35-0/profile
PATH=$PREFIX:\$PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi
EOF
. $PREFIX/profile

BUILDDIR=$PREFIX/build

mkdir -p $BUILDDIR
cd $BUILDDIR

BEEHIVE=https://beehive.molgen.mpg.de/03ac0b25031175a2a6c3f01a7990c3ce/IGV_2.17.1.zip
test -e IGV_$VERSION.zip || wget -nv $BEEHIVE
test -d IGV_$VERSION || bsdtar -xf IGV_$VERSION.zip

mv IGV_$VERSION/* $PREFIX
# intentionally fail if not empty
rmdir IGV_$VERSION

cd $PREFIX
cat >igv <<-'EOF'
#!/bin/sh
die() { echo $1; exit 1; }
parse_mem() {
case $1 in
[1-9]g | [1-9][0-9]g | [1-2][0-9][0-9]g)
IGVXMX=$1 ;;
*)
die "# Error: need a proper value for memory to use, eg. 8g" ;;
esac
}
script=`basename $0`
IGVXMX=${IGVXMX:-8g}
export IGVXMX
case "$script" in
igvxmem_hidpi)
parse_mem $1; shift
exec igv_hidpi.sh "$@" ;;
igvxmem)
parse_mem $1; shift
exec igv.sh "$@" ;;
esac
MEM_KB=$(grep -m1 'MemTotal:' /proc/meminfo | rev | cut -d' ' -f2 | rev)
MEM_GB=$(( $MEM_KB/1024/1024 ))
CONSIDER="# Consider using 'igvxmem XYZg' to start igv with proper memory setup."
if test $MEM_GB -lt 7; then
MSG="# This is fairly below the suitable amount of 8 GB.\n$CONSIDER"
elif test $MEM_GB -gt 17 ; then
MSG="$CONSIDER\n# To gain better performance you may increase the memory in sane steps."
fi
if test -n "$MSG"; then
echo '# NOTE:'
echo "# found approx. $MEM_GB GB of Memory on your host."
echo '#'
echo -e "$MSG"
echo '#'
echo '# igv with default settings will start in 3 seconds ...'
sleep 3
fi
case "$script" in
igv_hidpi)
exec igv_hidpi.sh "$@" ;;
*)
exec igv.sh "$@" ;;
esac
EOF

chmod 755 igv

ln -s igv igvxmem
ln -s igv igv_hidpi
ln -s igv igvxmem_hidpi


# delivered igv.args are not up to date, yielding several disturbing warnings like
# WARNING: Unknown module: jide.common specified to --add-exports, fix it ...

cat >igv.args <<- EOF
# from https://openjdk.org/jeps/261
# The --add-exports and --add-opens options must be used with great care.
# You can use them to gain access to an internal API of a library module
--add-exports java.desktop/javax.swing.plaf.synth=ALL-UNNAMED
--add-exports java.desktop/sun.swing=ALL-UNNAMED
--add-exports java.desktop/sun.awt=ALL-UNNAMED
--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
--add-exports java.desktop/sun.awt.shell=ALL-UNNAMED
--add-exports java.desktop/sun.awt.dnd=ALL-UNNAMED
--add-exports java.base/sun.security.action=ALL-UNNAMED
EOF


exit

0 comments on commit 8064543

Please sign in to comment.