lazarus.SlackBuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #!/bin/bash
  2. # Slackware build script for Lazarus IDE
  3. # Written by Andre Barboza <email removed>
  4. # Now maintained by B. Watson <yalhcru@gmail.com>
  5. # Redistribution and use of this script, with or without modification, is
  6. # 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 IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. # 20220414 bkw: BUILD=2
  22. # - fix PRINT_PACKAGE_NAME when ARCH not set in environment.
  23. # - add gtk-update-icon-cache to doinst.sh.
  24. # - remove empty files from doc dir.
  25. # - fix broken symlink.
  26. # 20210905 bkw:
  27. # - take over maintenance
  28. # - update for v2.0.12
  29. # - get rid of fpc-source dep; include the source in this package
  30. cd $(dirname $0) ; CWD=$(pwd)
  31. PRGNAM=lazarus
  32. VERSION=${VERSION:-2.0.12}
  33. BUILD=${BUILD:-2}
  34. TAG=${TAG:-_SBo}
  35. PKGTYPE=${PKGTYPE:-tgz}
  36. FPCVER=${FPCVER:-3.2.2}
  37. LCL=${LCL:-gtk2}
  38. if [ -z "$ARCH" ]; then
  39. case "$( uname -m )" in
  40. i?86) ARCH=i586 ;;
  41. *) ARCH=$( uname -m ) ;;
  42. esac
  43. fi
  44. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  45. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  46. exit 0
  47. fi
  48. TMP=${TMP:-/tmp/SBo}
  49. PKG=$TMP/package-$PRGNAM
  50. OUTPUT=${OUTPUT:-/tmp}
  51. if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "i586" ] && [ "$ARCH" != "i686" ]; then
  52. printf "\nThis won't build on $ARCH.\n\n"
  53. exit 1
  54. fi
  55. set -e
  56. fixperms() {
  57. chown -R root:root .
  58. find -L . -type l -o \
  59. -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  60. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  61. }
  62. rm -rf $PKG
  63. mkdir -p $TMP $PKG $OUTPUT
  64. cd $TMP
  65. rm -rf $PRGNAM
  66. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  67. cd $PRGNAM
  68. fixperms
  69. sed -i -e 's:share/man:man:' install/man/Makefile
  70. # Compilation doesn't need ./configure
  71. make clean
  72. make -j1 all \
  73. PREFIX=/usr \
  74. LCL_PLATFORM=${LCL} \
  75. OPT=${OPT}
  76. make install \
  77. INSTALL_PREFIX=$PKG/usr \
  78. INSTALL_MAN_DIR=$PKG/usr/man
  79. # fix links at /usr/bin
  80. ( cd $PKG/usr/bin
  81. ln -sf ../share/lazarus/lazarus
  82. ln -sf ../share/lazarus/lazbuild
  83. ln -sf ../share/lazarus/startlazarus
  84. )
  85. find $PKG -print0 -type f -a -perm /111 | \
  86. xargs -0 file -m /etc/file/magic/elf | \
  87. grep -e "executable" -e "shared object" | \
  88. grep ELF | \
  89. cut -f 1 -d : | \
  90. xargs strip --strip-unneeded 2> /dev/null || true
  91. # 20210905 bkw: Nothing used fpc-source but lazarus, so just include
  92. # the source here.
  93. mkdir -p $PKG/usr/src
  94. ( cd $PKG/usr/src
  95. tar xvf $CWD/fpc-$FPCVER.source.tar.gz
  96. fixperms
  97. ln -s fpc-$FPCVER fpc
  98. )
  99. # Install desktop file, icon, and mime entry
  100. mkdir -p $PKG/usr/share/{applications,pixmaps,mime/packages}
  101. cat install/lazarus.desktop > $PKG/usr/share/applications/lazarus.desktop
  102. cat images/ide_icon48x48.png > $PKG/usr/share/pixmaps/lazarus.png
  103. cat install/lazarus-mime.xml > $PKG/usr/share/mime/packages/lazarus-mime.xml
  104. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  105. mkdir -p $PKGDOC
  106. cp -ra COPYING* README.txt docs/* examples/ $PKGDOC
  107. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  108. rm -f $PKGDOC/INSTALL.txt
  109. find $PKGDOC -depth -type d -empty -delete
  110. # 20220414 bkw: this symlink is mistargeted... fixed, and don't freak out
  111. # if sbopkglint complains about a filesystem loop (there really is one).
  112. rm -f $PKG/usr/share/lazarus/components/chmhelp/lhelp/lhelp.app/Contents/MacOS/lhelp
  113. ln -s ../../../../lhelp $PKG/usr/share/lazarus/components/chmhelp/lhelp/lhelp.app/Contents/MacOS/lhelp
  114. mkdir -p $PKG/install
  115. cat $CWD/slack-desc > $PKG/install/slack-desc
  116. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  117. cd $PKG
  118. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE