Some SlackBuild scripts for Slackware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.9 KiB

  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2009-2020 Damien Goutte-Gattat
  4. #
  5. # Redistribution and use of this script, with or without modifications,
  6. # is permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
  12. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  15. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  17. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  18. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  19. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  20. # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  21. # POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. # Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
  24. #
  25. # Latest omero sourcecode is available at: <http://www.openmicroscopy.org/>.
  26. #
  27. # Depends: l/ice-py, l/omero-marshal, l/pytables
  28. # Source package infos
  29. NAMESRC=${NAMESRC:-OMERO.server}
  30. VERSION=${VERSION:-5.6.2}
  31. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION-ice36-b226.zip}
  32. WGET=${WGET:-https://downloads.openmicroscopy.org/omero/$VERSION/artifacts/$ARCHIVE}
  33. # Build infos
  34. NAMEPKG=${NAMEPKG:-omero-server}
  35. BUILD=${BUILD:-1GGD}
  36. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  37. JOBS=${JOBS:-1}
  38. EXT=${EXT:-txz}
  39. # Directories
  40. TMP=${TMP:-/tmp}
  41. OUT=${OUT:-$TMP/build}
  42. PKG=${PKG:-$OUT/$NAMEPKG}
  43. CWD=$(pwd)
  44. set -e # Quit if a command returns non-zero
  45. # Sanity checks
  46. if [ $UID -eq 0 ]; then
  47. echo "You should NOT run this script as ROOT!"
  48. exit 1
  49. fi
  50. if [ ! -d $TMP ]; then
  51. echo "$TMP does not exist or is not a directory!"
  52. exit 1
  53. fi
  54. # Get and verify the source archive
  55. if [ ! -r $ARCHIVE ]; then
  56. wget -c -O $ARCHIVE.part "$WGET"
  57. mv $ARCHIVE.part $ARCHIVE
  58. fi
  59. sha256sum -c $ARCHIVE.sha256
  60. # Get and verify OMERO.py
  61. if [ ! -r omero-py-5.7.1.tar.gz ]; then
  62. pip3 download --no-binary :all: --no-deps omero-py==5.7.1
  63. fi
  64. sha256sum -c omero-py-5.7.1.tar.gz.sha256
  65. # Extract and install
  66. mkdir -p $PKG/opt
  67. cd $PKG/opt
  68. unzip $CWD/$ARCHIVE
  69. mv OMERO.server-$VERSION-ice36-b226 omero
  70. rm omero/etc/env.bat
  71. # Install launch scripts
  72. install -D -m 755 $CWD/omero.sh $PKG/usr/bin/omero
  73. install -D -m 644 $CWD/rc.omero $PKG/etc/rc.d/rc.omero
  74. # Install configuration file
  75. install -D -m 644 $CWD/omero.conf $PKG/etc/omero.conf.new
  76. # Install documentation
  77. mkdir -p $PKG/usr/doc/$NAMEPKG-$VERSION
  78. install -m 644 $CWD/README $PKG/usr/doc/$NAMEPKG-$VERSION
  79. mv omero/LICENSE.txt $PKG/usr/doc/$NAMEPKG-$VERSION
  80. mv omero/history.rst $PKG/usr/doc/$NAMEPKG-$VERSION
  81. mv omero/share/licenses $PKG/usr/doc/$NAMEPKG-$VERSION/licenses
  82. # Install OMERO.py
  83. # This used to be provided along with OMERO.server, but is now
  84. # distributed on PyPI. However given that OMERO.py is necessary
  85. # to even start the server, I don't see the point of packaging
  86. # it separately.
  87. cd $TMP
  88. tar xf $CWD/omero-py-5.7.1.tar.gz
  89. cd omero-py-5.7.1
  90. python3 setup.py build
  91. python3 setup.py install \
  92. --install-lib=/opt/omero/lib/python \
  93. --install-scripts=/opt/omero/bin \
  94. --root=$PKG
  95. rm $PKG/opt/omero/bin/{omero,setpythonpath,winconfig}.bat
  96. # Copy slack-desc and doinst.sh files
  97. mkdir -p $PKG/install
  98. install -m 644 $CWD/slack-desc $PKG/install/slack-desc
  99. install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
  100. # Add dependency infos
  101. cat <<EOF > $PKG/install/slack-required
  102. ice-py
  103. omero-marshal
  104. pytables
  105. EOF
  106. # Package the tree
  107. cd $PKG
  108. mkdir -p $OUT
  109. PACKAGING="
  110. chown root:root . -R
  111. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  112. rm -rf $PKG
  113. rm -rf $TMP/omero-py-5.7.1
  114. "
  115. if type -p fakeroot ; then
  116. echo "$PACKAGING" | fakeroot
  117. else
  118. su -c "$PACKAGING"
  119. fi