diff --git a/CellProfiler-2.2.0-0.build.sh b/CellProfiler-2.2.0-0.build.sh new file mode 100755 index 0000000..060f996 --- /dev/null +++ b/CellProfiler-2.2.0-0.build.sh @@ -0,0 +1,291 @@ +#! /bin/bash + +PKG=CellProfiler +VERSION=2.2.0 +BUILD=0 +SRC=https://github.com/CellProfiler/CellProfiler/archive/$VERSION.tar.gz + +PREFIX=/pkg/$PKG-$VERSION-$BUILD +# PREFIX=/dev/shm/pkg/$PKG-$VERSION-$BUILD + +# we need /usr/local/package/bin for pip +PATH=/bin:/usr/bin:/usr/sbin:/usr/local/package/bin:/usr/local/bin +export PATH + +set -xe +umask 022 + +BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp +test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR +mkdir -p $BUILD_TMPDIR/home +export TMPDIR=$BUILD_TMPDIR +export HOME=$BUILD_TMPDIR/home + +exec $PREFIX/profile <<-EOF + PATH=$PREFIX/bin:\$PATH + PYTHONPATH=$PREFIX/lib/python2.7/site-packages + LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} + PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig\${PKG_CONFIG_PATH:+:\$PKG_CONFIG_PATH} + export PKG_CONFIG_PATH LD_LIBRARY_PATH PYTHONPATH +EOF +. $PREFIX/profile + +BUILDDIR=$PREFIX/build + +mkdir -p $BUILDDIR +cd $BUILDDIR + +function at_plaininstall() { + local dir=$1 + local tar=$2 + local url=$3 + ( + cd $BUILDDIR + test -e $tar || wget $url + test -n 'XWIPE' && rm -rf ./$dir + test -d $dir || tar xvf $tar + cd $dir + ./configure --prefix=$PREFIX + make -j $(nproc) + make install + ) +} + +function cm_plaininstall() { + local dir=$1 + local tar=$2 + local url=$3 + local extra=$4 + ( + cd $BUILDDIR + test -e $tar || wget $url + test -n 'XWIPE' && rm -rf ./$dir + test -d $dir || tar xvf $tar + mkdir -p $dir/build + cd $dir/build + echo "# extra args: '$extra'" + cmake .. \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_COLOR_MAKEFILE=OFF \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + $extra + make -j $(nproc) + make install + ) +} + +# start with PyQt4, sip +( + # version 4.19.13 is not working with pyqt-version 4.11.4, version 4.18.1 wasn't tested + SIP_VERSION=4.16.9 + SIP_SRC=https://sourceforge.net/projects/pyqt/files/sip/sip-$SIP_VERSION/sip-$SIP_VERSION.tar.gz + + test -e sip-$SIP_VERSION.tar.gz || wget $SIP_SRC + test -n 'XWIPE' && rm -rf sip-$SIP_VERSION + test -d sip-$SIP_VERSION || tar -xf sip-$SIP_VERSION.tar.gz + + cd sip-$SIP_VERSION + + python configure.py \ + -b $PREFIX/bin \ + -d $PYTHONPATH \ + -e $PREFIX/include/python2.7 \ + -v $PREFIX/share/sip + + mkdir -p $PREFIX/share/sip + make; make install +) + +( + # version 4.12.3 fails + # PYQT_SRC=http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-$PYQT_VERSION/PyQt4_gpl_x11-$PYQT_VERSION.tar.gz + + PYQT_VERSION=4.11.4 + PYQT_SRC=http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-$PYQT_VERSION/PyQt-x11-gpl-$PYQT_VERSION.tar.gz + + test -e PyQt-x11-gpl-$PYQT_VERSION.tar.gz || wget $PYQT_SRC + test -n 'XWIPE' && rm -rf PyQt-x11-gpl-$PYQT_VERSION + test -d PyQt-x11-gpl-$PYQT_VERSION || tar -xf PyQt-x11-gpl-$PYQT_VERSION.tar.gz + + cd PyQt-x11-gpl-$PYQT_VERSION + + export QTDIR=/usr/local/qt4 + + python configure.py \ + -b $PREFIX/bin \ + -d $PYTHONPATH \ + -q /usr/local/qt4/bin/qmake \ + -v $PREFIX/share/sip \ + --confirm-license \ + --no-designer-plugin \ + --verbose + + # missing include path for *our* phonon + sed -i -e '/^CPPFLAGS/ s,/usr/X11R6/include,/usr/include/phonon,' phonon/Makefile + + make -j $(( 2 * $(nproc) - 1 )) + make install +) + + +at_plaininstall \ + zeromq-4.2.2 \ + zeromq-4.2.2.tar.gz \ + https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz + +cm_plaininstall \ + vigra-1.11.1 \ + vigra-1.11.1-src.tar.gz \ + https://github.com/ukoethe/vigra/releases/download/Version-1-11-1/vigra-1.11.1-src.tar.gz \ + "-DVIGRANUMPY_INSTALL_DIR=$PYTHONPATH" + +at_plaininstall \ + wxPython-src-3.0.2.0 \ + wxPython-src-3.0.2.0.tar.bz2 \ + https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/wxPython-src-3.0.2.0.tar.bz2 + +( + cd $BUILDDIR/wxPython-src-3.0.2.0/wxPython + python2.7 setup.py build + python2.7 setup.py install --prefix $PREFIX + # build leaves 2gig rubbish + cd .. + make clean +) + + +# NOTE: I'm going to install downgraded versions of matplotlib and +# h5py, thus PYTHONPATH has to be exported, when using parts +# from this package interactively. And/or sys.path has to be +# adjusted in the main app (see MANGLE_SYS_PATH_PATCH) + +# yields to matplotlib-1.5.3 +pip install --ignore-installed --prefix $PREFIX 'matplotlib<1.9' + +# try 2.0.2, resume don't use ! +# pip install --prefix $PREFIX 'matplotlib<2.1' + +pip install --ignore-installed --prefix $PREFIX 'h5py<2.8' + +# needed by ilastik +pip install --prefix $PREFIX 'yapsy' + +# 'the' CellProfiler +( + test -e $VERSION.tar.gz || wget $SRC + test -d CellProfiler-$VERSION || tar -xf $VERSION.tar.gz + + cd CellProfiler-$VERSION + python2.7 setup.py build + python2.7 setup.py install --prefix $PREFIX + + # Message: Plugin directory doesn't point to valid folder: /dev/shm/pkg/CellProfiler-2.2.0-0/plugins + # create it, it will be r/o ... + mkdir $PREFIX/plugins +) + + +# now an ancient ilastik +( + test -e v0.5.12.tar.gz || wget https://github.com/ilastik/ilastik-0.5/archive/v0.5.12.tar.gz + test -d ilastik-0.5-0.5.12 || tar -xf v0.5.12.tar.gz + cd ilastik-0.5-0.5.12 + python2.7 setup.py build + python2.7 setup.py install --prefix $PREFIX +) + + +# and a more recent ilastik + +# this brings trouble with the lazyflow and volumina modules +# ( +# test -e 1.1.5.tar.gz || https://github.com/ilastik/ilastik/archive/1.1.5.tar.gz +# test -d ilastik-1.1.5 || tar -xf 1.1.5.tar.gz +# ) + +# ... thus slaughter an older linux release, caus this one contains also an usable source tree +( + ILASTIKVERSION=1.1.5 + test -e ilastik-$ILASTIKVERSION-Linux.tar.gz || wget http://files.ilastik.org/ilastik-$ILASTIKVERSION-Linux.tar.gz + test -d ilastik-$ILASTIKVERSION-Linux || tar -xf ilastik-$ILASTIKVERSION-Linux.tar.gz --exclude='*.pyc' ilastik-$ILASTIKVERSION-Linux/src + cd ilastik-$ILASTIKVERSION-Linux/src/ilastik + for MODULE in ilastik lazyflow volumina; do + echo "# -- -- -- -- -- -- -- ILASTIK: $MODULE -- -- -- -- -- -- --" + cd $MODULE + python setup.py build + python setup.py install --prefix $PREFIX + cd .. + done + # 'install' this one, 'caus cellprofiler references it + cp ilastik/ilastik_main.py $PYTHONPATH + + # mingle the old version with the newer, caus that's obviously the + # setup as of ver 2.2.0, what to say ... + ( + cd $PYTHONPATH/ilastik-$ILASTIKVERSION-py2.7.egg/ilastik + for DIR in core gui modules; do + ln -vs ../../ilastik-0.5-py2.7.egg/ilastik/$DIR + done + ) +) + +# Time to patch ... +# Note, we should be still in $BUILDDIR. +cd $PREFIX + +NAVTOOLBAR_MIN_HEIGHT_PATCH=' +--- CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/gui/cpfigure.py.dist 2018-10-22 16:24:35.161104708 +0200 ++++ CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/gui/cpfigure.py 2018-10-23 13:26:01.855642371 +0200 +@@ -474,4 +474,6 @@ + available_width, available_height = self.GetClientSize() + nbheight = self.navtoolbar.GetSize()[1] ++ if nbheight < 40: ++ nbheight = 40 + self.navtoolbar.SetPosition((0, 0)) + self.navtoolbar.SetSize((available_width, nbheight)) +' + +NO_CHECK_NEW_VERSION_PATCH=" +--- CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/cellprofilerapp.py.dist 2018-10-22 16:24:35.146104724 +0200 ++++ CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/cellprofilerapp.py 2018-10-23 08:41:53.601299559 +0200 +@@ -20,2 +20,3 @@ + self.check_for_new_version = kwargs.pop('check_for_new_version', False) ++ self.check_for_new_version = False + self.workspace_path = kwargs.pop('workspace_path', None) +" + +MANGLE_SYS_PATH_PATCH=" +--- CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/__main__.py.dist 2018-10-23 13:15:18.843495001 +0200 ++++ CellProfiler-2.2.0-0/lib/python2.7/site-packages/CellProfiler-2.2.0-py2.7.egg/cellprofiler/__main__.py 2018-10-23 13:23:04.150877887 +0200 +@@ -1,7 +1,12 @@ ++import sys ++# put our site-packages *before* the ones from /pkg/python-2.7.15-1, otherwise ++# we'll get the bad h5py v2.8 again ++if sys.path.count('$PREFIX/lib/python2.7/site-packages'): ++ sys.path.remove('$PREFIX/lib/python2.7/site-packages') ++sys.path.insert(1,'$PREFIX/lib/python2.7/site-packages') + import h5py + import logging + import logging.config + import re +-import sys + import os + import numpy as np +" + +# apply PR https://github.com/CellProfiler/CellProfiler/pull/3445 +# or with less fuzz https://github.com/CellProfiler/CellProfiler/issues/2679#issuecomment-355004994 +echo "$NAVTOOLBAR_MIN_HEIGHT_PATCH" | patch -p1 --verbose --read-only=ignore + +# slap the update check +# "Exception fetching new version information from http://cellprofiler.org/CPupdate.html: HTTP Error 404: Not Found" +echo "$NO_CHECK_NEW_VERSION_PATCH" | patch -p1 --verbose --read-only=ignore + +# not shure, why PYTHONPATH isn't preferred. +echo "$MANGLE_SYS_PATH_PATCH" | patch -p1 --verbose --read-only=ignore + +# exit 1 # don't close ... +exit