[Soot-list] Soot bootstrap helper shell script

Wei Peng pengw at umail.iu.edu
Sun Dec 28 23:13:00 EST 2014


I write this because I have not found similar instructions on Soot's page.

Motivation: Soot is released as a Java jar, which requires using "java -jar
soot-trunk.jar" or "java -cp soot-trunk.jar soot.Main" to launch. I write
the following small helper Bash script (attached at the end) to save some
bootstrap trouble.

installation:

* Automatic on Shell with "wget" to $HOME/soot
```sh
wget https://raw.githubusercontent.com/pw4ever/dev-env/master/bin/soot -O
$HOME/soot && chmod +x $HOME/soot
```

Then use "soot" to (optionally) download "soot-trunk.jar" and execute it.
Of course, "java" must be available on your exec path.

* Manual setup and details. Put the script in a "soot" file and "chmod +x
soot;" then drop "soot" somewhere on your $PATH where you have write
permission ($HOME/bin is a good place), and it will automatically fetch
"soot-trunk.jar" (if it is not available) and execute it, with default JVM
maximal heap (-Xmx) set to be half of your available RAM (JVM options can
be tuned with environment variable "JVM_OPTS").

NB I write and test this in a Linux environment; the script requires GNU
coreutils, procps-ng, bash, wget, and java to function properly. But it
should be adaptable to other environments.

Hope someone finds this useful.

Wei.

Wei Peng
Department of Computer and Information Science
Indiana University-Purdue University, Indianapolis (IUPUI)
pengw at iupui.edu  |  www.cs.iupui.edu/~pengw/

===== the script "soot"
#! /bin/bash
# Soot (https://sable.github.io/soot/) start-up script
# author: Wei Peng <4pengw at gmail.com>
# version: 20141228
# deps: bash, GNU coreutils, wget, procps-ng

WGET='wget'

# http://stackoverflow.com/a/246128
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

THE_URL='https://ssebuild.cased.de/nightly/soot/lib/soot-trunk.jar'
THE_JAR=${DIR}/'soot-trunk.jar'

# download the jar if it is missing
if ! [ -f "${THE_JAR}" ]; then
    ${WGET} "${THE_URL}" -O "${THE_JAR}"
fi

# by default, JVM maximal heap size (-Xmx) is set to be up to half of
available memory
[ -f ${THE_JAR} ] && java ${JVM_OPTS:$(free | awk '($7) {printf "-Xmx%d",
$7/2}')} -jar ${THE_JAR} "$@"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20141228/d906d9f8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: soot
Type: application/octet-stream
Size: 679 bytes
Desc: not available
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20141228/d906d9f8/attachment-0001.obj 


More information about the Soot-list mailing list