remind.SlackBuild 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. #!/bin/bash
  2. # Slackware build script for Remind
  3. # Copyright 2019 T3slider <t3slider@gmail.com>
  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. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=remind
  24. VERSION=${VERSION:-03.01.16}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  36. # the name of the created package would be, and then exit. This information
  37. # could be useful to other scripts.
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i586" ]; then
  46. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. fi
  58. # Valid options for LANG are one of the following:
  59. # ENGLISH, GERMAN, DUTCH, FINNISH, FRENCH, NORWEGIAN, DANISH, POLISH, BRAZPORT,
  60. # ITALIAN, ROMANIAN, SPANISH, ICELANDIC
  61. LANGUAGE=${LANGUAGE:-ENGLISH}
  62. # You can also pass your location via the following variables (this ensures that
  63. # sunrise, sunset, etc. work as expected for your location):
  64. # LAT_DEG, LAT_MIN, LAT_SEC, LON_DEG, LON_MIN, LON_SEC, LOCATION
  65. # By default these point to Ottawa, Ontario. From custom.h:
  66. # LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location
  67. # LON_DEG, LON_MIN and LON_SEC: Longitude of your location
  68. # LOCATION: A string identifying your location.
  69. # All latitude and longitude numbers should be positive for the
  70. # northern and western hemisphere. If you live in the southern
  71. # hemisphere, ALL latitude values should be negative. If you live
  72. # in the eastern hemisphere, ALL longitude values should be negative.
  73. # The default values are initially set to Ottawa, Ontario, Canada.
  74. LAT_DEG=${LAT_DEG:-45}
  75. LAT_MIN=${LAT_MIN:-24}
  76. LAT_SEC=${LAT_SEC:-0}
  77. LON_DEG=${LON_DEG:-75}
  78. LON_MIN=${LON_MIN:-39}
  79. LON_SEC=${LON_SEC:-0}
  80. LOCATION=${LOCATION:-Ottawa}
  81. # Default page size to use for Rem2PS. Options are Letter or A4.
  82. DEFAULT_PAGE=${DEFAULT_PAGE:-Letter}
  83. # Default date separator (this works for input only). Options are
  84. # - or /
  85. DATESEP=${DATESEP:--}
  86. # Default time separator. Options are : or .
  87. TIMESEP=${TIMESEP:-:}
  88. # Default datetime separator. Standard options are @ or / but some may
  89. # prefer T (any single character can be passed).
  90. DATETIMESEP=${DATETIMESEP:-@}
  91. # Character set to use. Options are ASCII, ISOLATIN1, ISOLATIN2,
  92. # IBMEXTENDED, or IBM852.
  93. CHARSET=${CHARSET:-ISOLATIN1}
  94. # If you do not want the -u option (which runs remind with the
  95. # uid and gid of the specified name), pass "no" (without quotes)
  96. # to this option.
  97. WANTU=${WANTU:-yes}
  98. set -e
  99. rm -rf $PKG
  100. mkdir -p $TMP $PKG $OUTPUT
  101. cd $TMP
  102. rm -rf $PRGNAM-$VERSION
  103. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  104. cd $PRGNAM-$VERSION
  105. chown -R root:root .
  106. find -L . \
  107. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  108. -o -perm 511 \) -exec chmod 755 {} \; -o \
  109. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  110. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  111. # You can also use Tcl/Tk's `wish` to configure and build remind graphically,
  112. # but this is untested. If you wish to try, uncomment the following line:
  113. #wish ./build.tk
  114. # Note that this would also require commenting out everything up to (but NOT
  115. # including) the "make install" line below, since that should (in theory) be
  116. # done by the build.tk script. I don't know how this would affect the package
  117. # directories. I would advise passing the options as variables without using
  118. # wish unless you want to have fun.
  119. # Set the proper options from the options passed to this script. Sorry for
  120. # the mess...
  121. sed -i "s/^\(#define LANG \).*/\1$LANGUAGE/" src/lang.h
  122. sed -i "s/^\(#define LAT_DEG \).*/\1$LAT_DEG/" src/custom.h
  123. sed -i "s/^\(#define LAT_MIN \).*/\1$LAT_MIN/" src/custom.h
  124. sed -i "s/^\(#define LAT_SEC \).*/\1$LAT_SEC/" src/custom.h
  125. sed -i "s/^\(#define LON_DEG \).*/\1$LON_DEG/" src/custom.h
  126. sed -i "s/^\(#define LON_MIN \).*/\1$LON_MIN/" src/custom.h
  127. sed -i "s/^\(#define LON_SEC \).*/\1$LON_SEC/" src/custom.h
  128. sed -i "s/^\(#define LOCATION \).*/\1\"$LOCATION\"/" src/custom.h
  129. if [ "$DEFAULT_PAGE" = "A4" ]; then
  130. sed -i 's|^#define DEFAULT_PAGE {"Letter", 612, 792}|/* & */|' src/custom.h
  131. sed -i 's|^\(/\* \)\(#define DEFAULT_PAGE {"A4", 595, 842}\)\( \*/\)|\2|' src/custom.h
  132. fi
  133. if [ "$DATESEP" = "/" ]; then
  134. sed -i "s|^#define DATESEP '-'|/* & */|" src/custom.h
  135. sed -i "s|^\(/\* \)\(#define DATESEP '/'\)\( \*/\)|\2|" src/custom.h
  136. fi
  137. if [ "$TIMESEP" = "." ]; then
  138. sed -i "s|^#define TIMESEP ':'|/* & */|" src/custom.h
  139. sed -i "s|^\(/\* \)\(#define TIMESEP '\.'\)\( \*/\)|\2|" src/custom.h
  140. fi
  141. if [ "$DATETIMESEP" = "/" ]; then
  142. sed -i "s|^#define DATETIMESEP '@'|/* & */|" src/custom.h
  143. sed -i "s|^\(/\* \)\(#define DATETIMESEP '/'\)\( \*/\)|\2|" src/custom.h
  144. elif [ "$DATETIMESEP" != "@" ]; then
  145. sed -i "s|^\(#define DATETIMESEP '\)\(@\)\('\)|\1${DATETIMESEP}\3|" src/custom.h
  146. fi
  147. sed -i "s/^\(#define ISOLATIN1 \).*/\1 0/" src/custom.h
  148. if [ "$CHARSET" != "ASCII" ]; then
  149. sed -i "s/^\(#define $CHARSET \).*/\1 1/" src/custom.h
  150. fi
  151. if [ "$WANTU" = "no" ]; then
  152. sed -i 's|^#define WANT_U_OPTION 1|/* & */|' src/custom.h
  153. fi
  154. CFLAGS="$SLKCFLAGS" \
  155. CXXFLAGS="$SLKCFLAGS" \
  156. ./configure \
  157. --prefix=/usr \
  158. --libdir=/usr/lib${LIBDIRSUFFIX} \
  159. --sysconfdir=/etc \
  160. --localstatedir=/var \
  161. --mandir=/usr/man \
  162. --docdir=/usr/doc/$PRGNAM-$VERSION \
  163. --build=$ARCH-slackware-linux
  164. make
  165. make install DESTDIR=$PKG
  166. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  167. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  168. find $PKG/usr/man -type f -exec gzip -9 {} \;
  169. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  170. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  171. cp -a COPYRIGHT MICROSOFT-AND-APPLE README $PKG/usr/doc/$PRGNAM-$VERSION
  172. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  173. mkdir -p $PKG/install
  174. cat $CWD/slack-desc > $PKG/install/slack-desc
  175. cd $PKG
  176. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE