taskd.SlackBuild 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/bin/bash
  2. # Slackware build script for taskd
  3. # 2015 Robert Allen
  4. # All rights reserved, including Creator Endowed Unalienable Rights
  5. ################################################################
  6. # Statement of Origin and Principle:
  7. # This script was adapted from SBo template for taskd use
  8. # by Robert Allen slacker@engineer.com, Wed Jun 24 15:09:40 MDT 2015
  9. #
  10. # I respectfully request that you leave this statement of origin
  11. # and the following acknowledgment of right to use, modify and
  12. # distribute, intact in your own versions and those you may pass
  13. # to others. I encourage you to use this statement of origin for
  14. # your own work instead of a copy/paste license or copyright
  15. # which you neither understand nor could enforce on others.
  16. ################################################################
  17. # Acknowledgment of right to use, copy, modify and distribute:
  18. #
  19. # You already have the right to use, modify and distribute this
  20. # or any other thought or idea, and need no license or other
  21. # permission from anyone to do so!
  22. #
  23. # Exercise it freely and never concede it to anyone!
  24. #
  25. # To be first to think or publish an idea is only to be first
  26. # to demonstrate that it is a human possibility, and to provide
  27. # a single step in the path of human progress to help ourselves
  28. # and all others along our shared journey into the future.
  29. #
  30. # To claim ownership of an idea, a shared human possibility, by
  31. # contrived legal devices is an act of greed and arrogance that
  32. # attempts to rob every other human being of the same right to
  33. # think and benefit from that same shared human possibility.
  34. #
  35. # Acknowledge and respect the work of others. Enjoy the respect
  36. # earned by your own good works, and encourage and applaud those
  37. # who would build on it!
  38. #
  39. # Free your mind, and those around you!
  40. #
  41. # Abolish the pernicious impediment to human progress known as
  42. # intellectual property law which obstructs all our future paths
  43. # only for the immediate gain of a few.
  44. #
  45. ################################################################
  46. cd $(dirname $0) ; CWD=$(pwd)
  47. PRGNAM=taskd
  48. VERSION=${VERSION:-1.1.0}
  49. BUILD=${BUILD:-1}
  50. TAG=${TAG:-_SBo}
  51. PKGTYPE=${PKGTYPE:-tgz}
  52. if [ -z "$ARCH" ]; then
  53. case "$( uname -m )" in
  54. i?86) ARCH=i586 ;;
  55. arm*) ARCH=arm ;;
  56. *) ARCH=$( uname -m ) ;;
  57. esac
  58. fi
  59. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  60. # the name of the created package would be, and then exit. This information
  61. # could be useful to other scripts.
  62. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  63. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  64. exit 0
  65. fi
  66. TMP=${TMP:-/tmp/SBo}
  67. PKG=$TMP/package-$PRGNAM
  68. OUTPUT=${OUTPUT:-/tmp}
  69. if [ "$ARCH" = "i586" ]; then
  70. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  71. LIBDIRSUFFIX=""
  72. elif [ "$ARCH" = "i686" ]; then
  73. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  74. LIBDIRSUFFIX=""
  75. elif [ "$ARCH" = "x86_64" ]; then
  76. SLKCFLAGS="-O2 -fPIC"
  77. LIBDIRSUFFIX="64"
  78. else
  79. SLKCFLAGS="-O2"
  80. LIBDIRSUFFIX=""
  81. fi
  82. set -e
  83. rm -rf $PKG
  84. mkdir -p $TMP $PKG $OUTPUT
  85. cd $TMP
  86. rm -rf $PRGNAM-$VERSION
  87. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  88. cd $PRGNAM-$VERSION
  89. #Patch to use global path config and add startup comments for rc.taskd
  90. patch -p0 <$CWD/rc.taskd.diff
  91. chown -R root:root .
  92. find -L . \
  93. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  94. -o -perm 511 \) -exec chmod 755 {} \; -o \
  95. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  96. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  97. mkdir -p build
  98. cmake \
  99. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  100. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  101. -DCMAKE_INSTALL_PREFIX=/usr \
  102. -DTASKD_BINDIR=bin \
  103. -DTASKD_EXTDIR=libexec/taskd \
  104. -DTASKD_DOCDIR=doc/$PRGNAM-$VERSION \
  105. -DTASKD_MAN1DIR=man/man1 \
  106. -DTASKD_MAN5DIR=man/man5
  107. make
  108. make install DESTDIR=$PKG
  109. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  110. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  111. mkdir -p $PKG/etc/rc.d
  112. mv $PKG/usr/bin/taskdctl $PKG/etc/rc.d/rc.taskd.new
  113. chmod 644 $PKG/etc/rc.d/rc.taskd.new
  114. mkdir -p $PKG/etc/profile.d
  115. cat $CWD/profile/taskddata > $PKG/etc/taskddata.new
  116. cat $CWD/profile/taskddata.sh > $PKG/etc/profile.d/taskddata.sh.new
  117. cat $CWD/profile/taskddata.csh > $PKG/etc/profile.d/taskddata.csh.new
  118. chmod 755 $PKG/etc/profile.d/*new
  119. chmod 644 $PKG/etc/taskddata.new
  120. find $PKG/usr/man -type f -exec gzip -9 {} \;
  121. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  122. #Additional documents...
  123. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/doc
  124. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  125. cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
  126. cat $CWD/README_SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README_SLACKWARE
  127. #CA keys are required, pki provides tools for the task, and extra scripts
  128. mkdir -p $PKG/usr/share/$PRGNAM-$VERSION
  129. cp -ra pki $PKG/usr/share/$PRGNAM-$VERSION/.
  130. cp -ra scripts $PKG/usr/share/$PRGNAM-$VERSION/.
  131. cp -ra mon $PKG/usr/share/$PRGNAM-$VERSION/.
  132. mkdir -p $PKG/install
  133. cat $CWD/slack-desc > $PKG/install/slack-desc
  134. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  135. cd $PKG
  136. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE