]> git.friedersdorff.com Git - max/slackbuilds.git/blob - office/neomutt/neomutt.SlackBuild
Use the slackbuilds.org slackbuild template for neomutt
[max/slackbuilds.git] / office / neomutt / neomutt.SlackBuild
1 #!/bin/sh
2
3 # Slackware build script for neomutt
4
5 # Copyright 2016,2017 Maximilian Friedersdorff Aberystwyth, United Kingdom
6 # Copyright 2002-2015  Patrick J. Volkerding, Sebeka, Minnesota, USA
7 # All rights reserved.
8 #
9 # Redistribution and use of this script, with or without modification, is
10 # permitted provided that the following conditions are met:
11 #
12 # 1. Redistributions of this script must retain the above copyright
13 #    notice, this list of conditions and the following disclaimer.
14 #
15 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
16 #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
18 #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 PRGNAM=neomutt
27 VERSION=${VERSION:-$(echo $PRGNAM-*.tar.?z* | cut -f 2- -d - | cut -f 1 -d .)}
28 BUILD=${BUILD:-1}
29 TAG=${TAG:-_maf}
30
31 # Automatically determine the architecture we're building on:
32 if [ -z "$ARCH" ]; then
33   case "$( uname -m )" in
34     i?86) ARCH=i586 ;;
35     arm*) ARCH=arm ;;
36     # Unless $ARCH is already set, use uname -m for all other archs:
37        *) ARCH=$( uname -m ) ;;
38   esac
39 fi
40
41 CWD=$(pwd)
42 TMP=${TMP:-/tmp/SBo}
43 PKG=$TMP/package-$PRGNAM
44 OUTPUT=${OUTPUT:-/tmp}  # Drop the package in /tmp
45
46 if [ "$ARCH" = "i586" ]; then
47   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
48   LIBDIRSUFFIX=""
49 elif [ "$ARCH" = "i686" ]; then
50   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
51   LIBDIRSUFFIX=""
52 elif [ "$ARCH" = "x86_64" ]; then
53   SLKCFLAGS="-O2 -fPIC"
54   LIBDIRSUFFIX="64"
55 else
56   SLKCFLAGS="-O2"
57   LIBDIRSUFFIX=""
58 fi
59
60 set -e # Exit on most errors
61
62 rm -rf $PKG
63 mkdir -p $TMP $PKG $OUTPUT
64 cd $TMP
65 rm -rf $PRGNAM-$VERSION
66 tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
67 mv neomutt-neomutt-$VERSION neomutt-$VERSION
68 cd $PRGNAM-$VERSION
69 chown -R root:root .
70 find -L . \
71  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
72   -o -perm 511 \) -exec chmod 755 {} \; -o \
73  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
74   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
75
76
77 CFLAGS="$SLKCFLAGS" \
78 CXXFLAGS="$SLKCFLAGS" \
79 ./prepare \
80   --prefix=/usr \
81   --mandir=/usr/man \
82   --docdir=/usr/doc/neomutt-$VERSION \
83   --with-docdir=/usr/doc/neomutt-$VERSION \
84   --sysconfdir=/etc/mutt \
85   --with-mailpath=/var/spool/mail \
86   --enable-pop \
87   --enable-imap \
88   --with-ssl \
89   --with-sasl \
90   --enable-smtp \
91   --enable-gpgme \
92   --with-gdbm \
93   --enable-hcache \
94   --build=$ARCH-slackware-linux \
95   --with-slang \
96   --enable-compressed \
97   --enable-debug
98
99 CFLAGS="$SLKCFLAGS" \
100 CXXFLAGS="$SLKCFLAGS" \
101 ./configure \
102   --prefix=/usr \
103   --mandir=/usr/man \
104   --docdir=/usr/doc/neomutt-$VERSION \
105   --with-docdir=/usr/doc/neomutt-$VERSION \
106   --sysconfdir=/etc/mutt \
107   --with-mailpath=/var/spool/mail \
108   --enable-pop \
109   --enable-imap \
110   --with-ssl \
111   --with-sasl \
112   --enable-smtp \
113   --enable-gpgme \
114   --with-gdbm \
115   --enable-hcache \
116   --build=$ARCH-slackware-linux \
117   --with-slang \
118   --enable-compressed \
119   --enable-debug
120
121 make
122 make install DESTDIR=$PKG
123
124 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
125   | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
126
127 find $PKG/usr/man -type f -exec gzip -9 {} \;
128 for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
129
130 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
131
132 # This stuff is redundant or not useful to most people, IMHO.
133 # If you want it, use the source, Luke.
134 rm -f $PKG/usr/doc/mutt-$VERSION/*.html
135 rm -f $PKG/etc/mutt/*.dist
136
137 # This is an ancient artifact
138 rm -f $PKG/usr/doc/mutt-$VERSION/samples/ca-bundle.crt
139
140 # If there's a ChangeLog, installing at least part of the recent history
141 # is useful, but don't let it get totally out of control:
142 if [ -r ChangeLog ]; then
143   DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
144   cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
145   touch -r ChangeLog $DOCSDIR/ChangeLog
146 fi
147
148
149 # Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
150 mkdir -p $PKG/install
151 cat $CWD/slack-desc > $PKG/install/slack-desc
152 zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
153
154 cd $PKG
155 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}