]> git.friedersdorff.com Git - max/slackbuilds.git/blob - office/neomutt/neomutt.SlackBuild
Move slackbuilds into categories
[max/slackbuilds.git] / office / neomutt / neomutt.SlackBuild
1 #!/bin/sh
2 # Copyright 2002-2015  Patrick J. Volkerding, Sebeka, Minnesota, USA
3 # All rights reserved.
4 #
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
22 PKGNAM=neomutt
23 VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
24 BUILD=${BUILD:-1}
25
26 # Automatically determine the architecture we're building on:
27 if [ -z "$ARCH" ]; then
28   case "$( uname -m )" in
29     i?86) export ARCH=i586 ;;
30     arm*) export ARCH=arm ;;
31     # Unless $ARCH is already set, use uname -m for all other archs:
32        *) export ARCH=$( uname -m ) ;;
33   esac
34 fi
35
36 TMP=${TMP:-/tmp}
37 CWD=`pwd` 
38 NUMJOBS=${NUMJOBS:-" -j7 "}
39
40 if [ "$ARCH" = "i486" ]; then
41   SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
42 elif [ "$ARCH" = "i586" ]; then
43   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
44 elif [ "$ARCH" = "s390" ]; then
45   SLKCFLAGS="-O2"
46 elif [ "$ARCH" = "x86_64" ]; then
47   SLKCFLAGS="-O2 -fPIC"
48 else
49   SLKCFLAGS="-O2"
50 fi
51
52 PKG=$TMP/package-neomutt
53 rm -rf $PKG
54 mkdir $PKG
55 cd $TMP
56 rm -rf neomutt-$VERSION
57 tar xvf $CWD/neomutt-$VERSION.tar.?z* || exit 1
58 cd neomutt-$VERSION || exit 1
59 chown -R root:root .
60
61 CFLAGS="$SLKCFLAGS" \
62 ./configure \
63   --prefix=/usr \
64   --mandir=/usr/man \
65   --docdir=/usr/doc/mutt-$VERSION \
66   --with-docdir=/usr/doc/mutt-$VERSION \
67   --sysconfdir=/etc/mutt \
68   --with-mailpath=/var/spool/mail \
69   --enable-pop \
70   --enable-imap \
71   --with-ssl \
72   --with-sasl \
73   --enable-smtp \
74   --enable-gpgme \
75   --enable-hcache \
76   --build=$ARCH-slackware-linux
77   --with-slang \
78   --enable-compressed \
79   --enable-debug
80
81 make $NUMJOBS || make || exit 1
82 make install DESTDIR=$PKG || exit 1
83
84 # Strip binaries:
85 ( cd $PKG
86   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
87   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
88 )
89
90 # Compress and link manpages, if any:
91 if [ -d $PKG/usr/man ]; then
92   ( cd $PKG/usr/man
93     for manpagedir in $(find . -type d -name "man*") ; do
94       ( cd $manpagedir
95         for eachpage in $( find . -type l -maxdepth 1) ; do
96           ln -s $( readlink $eachpage ).gz $eachpage.gz
97           rm $eachpage
98         done
99         gzip -9 *.?
100       )
101     done
102   )
103 fi
104
105 mkdir -p $PKG/install
106 cat $CWD/slack-desc > $PKG/install/slack-desc
107 zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
108
109 # This stuff is redundant or not useful to most people, IMHO.
110 # If you want it, use the source, Luke.
111 rm -f $PKG/usr/doc/mutt-$VERSION/*.html
112 rm -f $PKG/etc/mutt/*.dist
113
114 # This is an ancient artifact
115 rm -f $PKG/usr/doc/mutt-$VERSION/samples/ca-bundle.crt
116
117 # If there's a ChangeLog, installing at least part of the recent history
118 # is useful, but don't let it get totally out of control:
119 if [ -r ChangeLog ]; then
120   DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
121   cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
122   touch -r ChangeLog $DOCSDIR/ChangeLog
123 fi
124
125 mv $PKG/etc/mutt/Muttrc $PKG/etc/mutt/Muttrc.new
126
127 cd $PKG
128 /sbin/makepkg -l y -c n ../neomutt-$VERSION-$ARCH-$BUILD.txz
129