You are not logged in.

#1 2012-12-13 21:53:20

carpenoctem
Member
Registered: 2012-10-10
Posts: 12

First PKGBUILD - MIPAV

Hi everyone.

I'm trying to create a package for MIPAV (http://mipav.cit.nih.gov/).

According to the homepage, the package should be installed by running a *big* shell script (installMIPAV.bin), which honestly is beyond my skills. On the other hand, I'd rather not run the script without knowing what changes will make to my installation (I don't want to bork my filesystem with files unknown to pacman).

I'd like to hear the opinion of more experienced archers on how should I proceed here. What options do I have? Suggestions?

Thank you.

Offline

#2 2012-12-17 12:56:25

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: First PKGBUILD - MIPAV

usually those installer scripts combine a script and binaries in 1 file, and have an extract only option.
Look for that option, extract all files and you'll prob find decent build/install instructions.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2012-12-28 14:32:50

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 440

Re: First PKGBUILD - MIPAV

Hi carpenoctem-

You sure picked a monster of a package to start with! This is what I've thrown together:
https://github.com/tdy/PKGBUILDs/tree/master/mipav

I've only "tested" on x86_64 so far, and I say it with quotations because I don't have real data to test. But at least on the surface, everything seems to run properly.
Q1TLJs.jpg

PKGBUILD
(FYI, don't make it a habit of sourcing/creating vars like this in general. I kinda took the lazier way out by porting a lot of the extraction almost verbatim from the installer.)

# installMIPAV.bin is NOT linked or bundled here!
#
# installMIPAV.bin is distributed by the NIH: http://mipav.cit.nih.gov/download.php
#  * accept the license
#  * give your name and email
#  * download the Linux Release version
#

pkgname=mipav
pkgver=6.0.1
pkgrel=1
pkgdesc="The Medical Imaging Processing, Imaging, and Visualization application from the CIT/NIH"
arch=('i686' 'x86_64')
url="http://mipav.cit.nih.gov/"
license=('custom')
depends=('alsa-lib' 'java-environment' 'libcl' 'libgl' 'libxt' 'libxtst' 'unixodbc')
options=('!emptydirs')
source=(installMIPAV.bin $pkgname.lax lax.jarfiles
        http://mipav.cit.nih.gov/license/CopyrightInfo.txt)
md5sums=('6fdf3e0a7020b9776628b4d07e203cc2'
         'c005a145fc7a5d411b5a1d4d212557e1'
         '241a9a0b4570a2350b80a1b5d74e3b2e'
         '1aaf2ef363e61990c6ef21ab0bc20906')
[[ $CARCH == i686 ]] && md5sums[0]='578eac8fd75760c3c8ebd1936e8439e1'

eval $(sed -n '3,21p' installMIPAV.bin)
RESOURCE_PATH="$srcdir/$RESOURCE_DIR/resource"
JRE_PADDED="$RESOURCE_PATH/jre_padded"
JRE_TARZ="$RESOURCE_PATH/vm.tar.Z"
JRE_TAR="$RESOURCE_PATH/vm.tar"
INSTALLER_DATA_DIR="$srcdir/InstallerData"
INSTALL_ZIP="$INSTALLER_DATA_DIR/installer.zip"
INSTALL_PADDED_ZIP="$INSTALLER_DATA_DIR/installer.padded"
DISK1_DIR="$INSTALLER_DATA_DIR/Disk1"
INSTDATA_DIR="$DISK1_DIR/InstData"
RESOURCE_ZIP="$INSTDATA_DIR/Resource1.zip"

build() {
  cd "$srcdir"

  # compute the number of jre blocks to extract
  JRE_BLOCKS=$(expr $JREREALSIZE / $BLOCKSIZE)
  JRE_REMAINDER=$(expr $JREREALSIZE % $BLOCKSIZE)
  [[ ${JRE_REMAINDER:-0} > 0 ]] && JRE_BLOCKS=$(expr $JRE_BLOCKS + 1)

  # extract the jre archive
  install -dm755 "$RESOURCE_PATH"
  dd if=installMIPAV.bin of="$JRE_PADDED" \
    bs=$BLOCKSIZE skip=$JRESTART count=$JRE_BLOCKS
  dd if="$JRE_PADDED" of="$JRE_TARZ" bs=$JREREALSIZE count=1
  gzip -d "$JRE_TARZ"

  # compute the number of installer blocks to extract
  INSTALLER_BLOCKS=$(expr $ARCHREALSIZE / $BLOCKSIZE)
  INSTALLER_REMAINDER=$(expr $ARCHREALSIZE % $BLOCKSIZE)
  [[ ${INSTALLER_REMAINDER:-0} > 0 ]] && INSTALLER_BLOCKS=$(expr $INSTALLER_BLOCKS + 1)

  # extract install.zip
  cd "$srcdir"
  install -dm755 "$INSTALLER_DATA_DIR"
  dd if=installMIPAV.bin of="$INSTALL_PADDED_ZIP" \
    bs=$BLOCKSIZE skip=$(expr $JRESTART + $JRE_BLOCKS) count=$INSTALLER_BLOCKS
  dd if="$INSTALL_PADDED_ZIP" of="$INSTALL_ZIP" \
    bs=$ARCHREALSIZE count=1

  # extract resource1.zip
  install -dm755 "$INSTDATA_DIR"
  dd if=installMIPAV.bin of="$RESOURCE_ZIP" \
    skip=$(expr $JRESTART + $JRE_BLOCKS + $INSTALLER_BLOCKS) \
    bs=$BLOCKSIZE count=$RESSIZE

  # extract the launcher
  sed -n '842,3330p' installMIPAV.bin > $pkgname.sh
}

check() {
  # verify the extractions
  INSTALL_ZIP_SIZE=$(cksum "$INSTALL_ZIP" | awk '{ print $2 }')
  RESOURCE_ZIP_SIZE=$(cksum "$RESOURCE_ZIP" | awk '{ print $2 }')
  if [[ ${ARCHREALSIZE:=0} != ${INSTALL_ZIP_SIZE:=1} || \
        ${RESREALSIZE:=0} != ${RESOURCE_ZIP_SIZE:=1} ]]; then
    echo "The extracted files are corrupted. Please download the installer again"
    echo "and make sure to download using 'binary' mode. Please do not attempt"
    echo "to install this currently downloaded copy."
    return 1
  fi
}

package() {
  cd "$srcdir"
  install -Dm0755 $pkgname.sh "$pkgdir/usr/share/java/$pkgname/$pkgname"
  install -Dm0644 $pkgname.lax "$pkgdir/usr/share/java/$pkgname/$pkgname.lax"

  # jre
  install -dm755 "$pkgdir/usr/lib/$pkgname/"
  bsdtar -xf "$JRE_TAR" -C "$pkgdir/usr/lib/$pkgname/"
  find "$pkgdir/usr/lib/$pkgname/" -type d -exec chmod 0755 '{}' \;
  find "$pkgdir/usr/lib/$pkgname/" -type f -exec chmod 0644 '{}' \;
  chown -R root:root "$pkgdir/usr/lib/$pkgname/"

  # resources
  cd "$INSTDATA_DIR"
  bsdtar -xf "$RESOURCE_ZIP" --strip-components 1
  bsdtar -xf projects/$pkgname/classes_14584678b1b4_zg_ia_sf.jar \
    -C "$pkgdir/usr/share/java/$pkgname/"
  find "$pkgdir/usr/share/java/$pkgname/" -type d -exec chmod 0755 '{}' \;
  find "$pkgdir/usr/share/java/$pkgname/" -type f -exec chmod 0644 '{}' \;
  chown -R root:root "$pkgdir/usr/share/java/$pkgname/"

  # libs
  install -dm0755 "$pkgdir/usr/share/java/$pkgname/lib/jaxp"
  install -m0644 projects/$pkgname/{classes,src}/lib/*.jar \
    "$pkgdir/usr/share/java/$pkgname/lib/"
  install -m0644 projects/$pkgname/classes/lib/jaxp/* \
    "$pkgdir/usr/share/java/$pkgname/lib/jaxp/"
  install -m0644 projects/$pkgname/classes/MipavMain.class \
    "$pkgdir/usr/share/java/$pkgname/"
  install -Dm0644 projects/$pkgname/src/InsightToolkit/lib/InsightToolkit/InsightToolkit.jar \
    "$pkgdir/usr/share/java/$pkgname/InsightToolkit/libs/InsightToolkit.jar"

  # lax.jar
  cd "$INSTALLER_DATA_DIR"
  bsdtar -xf installer.zip
  jar -cf lax.jar $(cat "$srcdir/lax.jarfiles")
  install -m0644 lax.jar "$pkgdir/usr/share/java/$pkgname/lax.jar"

  # licenses
  install -Dm0644 licenses/ICU-License.htm \
    "$pkgdir/usr/share/licenses/$pkgname/license.htm"
  install -Dm0644 "$srcdir/CopyrightInfo.txt" \
    "$pkgdir/usr/share/licenses/$pkgname/license.txt"

  # bins
  install -dm0755 "$pkgdir/usr/bin"
  ln -sf /usr/share/java/$pkgname/$pkgname "$pkgdir/usr/bin/$pkgname"
  chmod 0755 "$pkgdir/usr/share/java/$pkgname/$pkgname"
  find "$pkgdir/usr/lib/$pkgname/jre/bin" -type f -exec chmod 0755 '{}' \;
}

# vim:set ts=2 sw=2 et:

lax.jarfiles

com/zerog/lax/LAX.class
com/zerog/lax/LAX$1.class
com/zerog/lax/LAXQuotedStreamTokenizer.class
com/zerog/common/io/NullInputStream.class
com/zerog/common/io/NullOutputStream.class
com/zerog/common/java/util/PropertiesUtil.class
Flexeraauj.class
Flexeraaol$1.class
Flexeraaol$2.class
Flexeraaol$aaa.class
Flexeraaol.class
Flexeraart.class
Flexeraaru.class
com/zerog/ui/gui/iStandardDialog.class
Flexeraabi.class
Flexeraabj.class
com/zerog/awt/ZGStandardDialog$1.class
com/zerog/awt/ZGStandardDialog$2$1.class
com/zerog/awt/ZGStandardDialog$2$2.class
com/zerog/awt/ZGStandardDialog$2.class
com/zerog/awt/ZGStandardDialog$3.class
com/zerog/awt/ZGStandardDialog$aaa.class
com/zerog/awt/ZGStandardDialog.class
Flexeraatu.class
Flexeraatu$1.class
Flexeraatu$2.class
Flexeraatu$3.class
Flexeraatu$4.class
Flexeraatu$aaa.class
Flexeraavl.class
Flexeraavp.class
com/zerog/util/jvm/Validator.class
com/zerog/util/jvm/ValidatorUtils.class
com/zerog/util/jvm/ValidatorTimeoutException.class
com/zerog/util/jvm/Introspector.class
com/zerog/util/jvm/RunningVMIntrospector.class
com/zerog/util/jvm/Filter.class
com/zerog/util/jvm/Version.class
com/zerog/util/jvm/JVMInformationRetriever.class
com/zerog/util/jvm/JVMInformationRetriever$1.class
com/zerog/util/jvm/JVMInformationRetrieverServer.class
com/zerog/util/DebugOutputConfig.class
com/zerog/util/images/Error.gif
com/zerog/util/images/Info.gif
com/zerog/util/images/Query.gif
com/zerog/util/images/Warn.gif

mipav.lax

#   LaunchAnywhere (tm) Executable Properties File - Flexera Software LLC

#   LAX.APPLICATION.NAME
#   --------------------
#   the default name of this executable -- do not edit

lax.application.name=mipav


#   LAX.CLASS.PATH
#   --------------
#   the Java classpath necessary to run this application
#   Can be separated by colons (Mac OS/Unix) or semicolons (Windows)

lax.class.path=.:InsightToolkit/lib/InsightToolkit/InsightToolkit.jar:lib/JimiProClasses.jar:lib/jaxp/dom.jar:lib/jaxp/sax.jar:lib/jaxp/xalan.jar:lib/jaxp/xercesImpl.jar:lib/tar.jar:lib/jdom.jar:lib/junit-4.4.jar:lib/WildMagic.jar:lib/jj2kpack.jar:lib/jhall.jar:lib/ACCESSION_client_VTool.jar:lib/bcprov-jdk15-136.jar:lib/jax-qname.jar:lib/pdfbox-1.2.0.jar:lib/jempbox-1.2.0.jar:lib/fontbox-1.2.0.jar:lib/jTEM.jar:lib/hyperapplet.jar:lib/javac.jar:lib/ij.jar:lib/dataDictionaryClient-4.1.1.8.jar:lib/core_dictionary-4.1.1.8.jar:lib/camino.jar:lib/streambuffer.jar:lib/stax-ex.jar:lib/saaj-impl.jar:lib/policy.jar:lib/log4j-1.2.16.jar:lib/jaxws-rt.jar:lib/jaxb-impl.jar:lib/jaxb-api.jar:lib/javax.persistence.jar:lib/fitbir-web-service.jar:lib/gmbal-api-only.jar:lib/fitbir-model.jar:lib/mail.jar:lib/activation.jar:/usr/share/java/mipav/plugins:/usr/share/java/mipav/plugins/plugins.jar:lax.jar


#   LAX.COMMAND.LINE.ARGS
#   ---------------------
#   what will be passed to the main method -- be sure to quote arguments with spaces in them

lax.command.line.args=$CMD_LINE_ARGUMENTS$


#   LAX.DIR
#   -------
#   path to directory holding LaunchAnywhere's native launcher

lax.dir=/usr/share/java/mipav/


#   LAX.MAIN.CLASS
#   --------------
#   the class that contains the main method for the application

lax.main.class=MipavMain


#   LAX.MAIN.METHOD
#   ---------------
#   the method in the main class that will be invoked

lax.main.method=main


#   LAX.NL.CURRENT.VM
#   -----------------
#   the VM to use for the next launch

lax.nl.current.vm=../mipav/jre/bin/java


#   LAX.NL.JAVA.LAUNCHER.MAIN.CLASS
#   -------------------------------
#   main class of LaunchAnywhere's java launcher -- do not adjust

lax.nl.java.launcher.main.class=com.zerog.lax.LAX


#   LAX.NL.JAVA.LAUNCHER.MAIN.METHOD
#   --------------------------------
#   main method of LaunchAnywhere's java launcher -- do not adjust

lax.nl.java.launcher.main.method=main


#   LAX.NL.JAVA.OPTION.ADDITIONAL
#   -----------------------------
#   Runtime server switch to force java to run as:
#   java -server MipavMain  etc, etc, etc

lax.nl.java.option.additional=-server


#   LAX.NL.JAVA.OPTION.JAVA.HEAP.SIZE.INITIAL
#   -----------------------------------------
#   Java start up heap size - 300MB

lax.nl.java.option.java.heap.size.initial=300M


#   LAX.NL.JAVA.OPTION.JAVA.HEAP.SIZE.MAX
#   -------------------------------------
#   Java maximum heap size

lax.nl.java.option.java.heap.size.max=1000M


#   LAX.NL.VALID.VM.LIST
#   --------------------
#   a string containing one or more of [ ALL JDK JRE J1 J2 JRE_J1 JDK_J1 JRE_J2 JDK_J2 MSJ MRJ ]
#    delimited by spaces or commas.  If the native launcher cannot find the current vm,
#   it will search for ones in this list

lax.nl.valid.vm.list=J2 J1


#   LAX.NL.WIN32.MICROSOFTVM.MIN.VERSION
#   ------------------------------------
#   The minimum version of Microsoft's VM this application will run against

lax.nl.win32.microsoftvm.min.version=2750


#   LAX.ROOT.INSTALL.DIR
#   --------------------
#   path to the installdir magic folder

lax.root.install.dir=/usr/share/java/mipav


#   LAX.STDERR.REDIRECT
#   -------------------
#   leave blank for no output, "console" to send to a console window,
#   and any path to a file to save to the file

lax.stderr.redirect=console


#   LAX.STDIN.REDIRECT
#   ------------------
#   leave blank for no input, "console" to read from the console window,
#   and any path to a file to read from that file

lax.stdin.redirect=


#   LAX.STDOUT.REDIRECT
#   -------------------
#   leave blank for no output, "console" to send to a console window,
#   and any path to a file to save to the file

lax.stdout.redirect=console


#   LAX.USER.DIR
#   ------------
#   left blank, this property will cause the native launcher to not
#   alter the platform default behavior for setting the user dir.
#   To override this you may set this property to a relative or absolute path.
#   Relative paths are relative to the launcher.

lax.user.dir=.


#   LAX.VERSION
#   -----------
#   version of LaunchAnywhere that created this properties file

lax.version=14.0

Last edited by tdy (2012-12-29 02:45:36)

Offline

#4 2013-04-02 19:55:01

mccreedy
Member
Registered: 2013-04-02
Posts: 1

Re: First PKGBUILD - MIPAV

Hi carpenoctem -

I came across your posting while searching for something else and thought you might like to know that we've released MIPAV under a new, more open license (http://mipav.cit.nih.gov/license/license.html) and now have a public, read-only SVN repository at https://citdcbmipav.cit.nih.gov/repos-pub/mipav/.  I know that the folks at NeuroDebian are also planning to bundle MIPAV for inclusion in their package repository, so you might want to get in touch with them.

- Evan

Offline

Board footer

Powered by FluxBB