nted.SlackBuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #!/bin/bash
  2. # Slackware build script for nted
  3. # Copyright 2008 Corrado Franco (email removed)
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Modified by the SlackBuilds.org project
  23. # 20210910 bkw: fix build on -current (gcc11)
  24. # TODO: occasionally nted segfaults on exit, fix if possible. It's
  25. # difficult to reproduce, and when I compile with debugging symbols
  26. # I can't get it to happen at all.
  27. # 20180905 bkw: upstream has been dead a while, switch homepage to
  28. # debian's package page, and use their patches. VERSION now 1.10.18_12,
  29. # original version + debian patchlevel 12. The debian patches fix a few
  30. # segfaults, and compile issues with later gcc versions (like the one
  31. # in -current, and whatever will end up in 15.0).
  32. # 20170621 bkw: fix build on -current (gcc7's pickier, use -Wno-narrowing)
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=nted
  35. VERSION=${VERSION:-1.10.18_12}
  36. BUILD=${BUILD:-2}
  37. TAG=${TAG:-_SBo}
  38. PKGTYPE=${PKGTYPE:-tgz}
  39. if [ -z "$ARCH" ]; then
  40. case "$( uname -m )" in
  41. i?86) ARCH=i586 ;;
  42. arm*) ARCH=arm ;;
  43. *) ARCH=$( uname -m ) ;;
  44. esac
  45. fi
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. # 20210910 bkw: NEWS and ChangeLog are 0-byte placeholders, ignore
  54. DOCS="ABOUT* AUTHORS COPYING* FAQ INSTALL README"
  55. if [ "$ARCH" = "i586" ]; then
  56. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  57. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  58. elif [ "$ARCH" = "i686" ]; then
  59. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  60. SLKLDFLAGS=""; LIBDIRSUFFIX=""
  61. elif [ "$ARCH" = "x86_64" ]; then
  62. SLKCFLAGS="-O2 -fPIC"
  63. SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
  64. fi
  65. set -e
  66. MAINVER="$( echo $VERSION | cut -d_ -f1 )"
  67. DEBVER="$( echo $VERSION | cut -d_ -f2 )"
  68. rm -rf $PKG
  69. mkdir -p $TMP $PKG $OUTPUT
  70. cd $TMP
  71. rm -rf $PRGNAM-$MAINVER
  72. tar xvf $CWD/${PRGNAM}_$MAINVER.orig.tar.gz
  73. cd $PRGNAM-$MAINVER
  74. tar xvf $CWD/${PRGNAM}_$MAINVER-$DEBVER.debian.tar.xz
  75. chown -R root:root .
  76. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  77. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  78. patch -p1 < $CWD/compilefix.diff
  79. for i in $( cat debian/patches/series ); do
  80. patch -p1 < debian/patches/$i
  81. done
  82. # The -Wno-error causes automake to be run with --warnings=no-error,
  83. # but automake still says "warnings are being treated as errors". The
  84. # thing it's warning about is configure.in should be named configure.ac,
  85. # I have no idea how to turn off warnings as errors if the goddam
  86. # --warnings=no-error command line flag doesn't work, so just rename
  87. # the thing. I *really hate* this kinda pointless pedantry.
  88. mv configure.in configure.ac
  89. autoreconf -ivf -Wno-error
  90. LDFLAGS="$SLKLDFLAGS" \
  91. CFLAGS="$SLKCFLAGS" \
  92. CXXFLAGS="$SLKCFLAGS -fpermissive -Wno-narrowing" \
  93. ./configure \
  94. --prefix=/usr \
  95. --libdir=/usr/lib${LIBDIRSUFFIX} \
  96. --sysconfdir=/etc \
  97. --localstatedir=/var \
  98. --mandir=/usr/man \
  99. --infodir=/usr/info \
  100. --without-doc \
  101. --docdir=/usr/doc/$PRGNAM-$VERSION \
  102. --build=$ARCH-slackware-linux \
  103. make
  104. make install-strip DESTDIR=$PKG
  105. gzip -9 $PKG/usr/man/man?/*.*
  106. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  107. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  108. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  109. # Overwrite shipped .desktop file with fixed one that validates
  110. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  114. cd $PKG
  115. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE