aboutsummaryrefslogtreecommitdiff
path: root/patches/pine/pine.SlackBuild
blob: 56d0441d3889f893bf115939961a1a26ade6e17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
#
# got it from ftp://ftp.slackware.com/pub/slackware/slackware-10.2/patches/source/pine/pine.SlackBuild
# small changes by rhatto
#

# Set initial variables:

CWD="`pwd`"

if [ -f "/etc/slackbuildrc" ]; then
  source /etc/slackbuildrc
fi

if [ -f "~/.slackbuildrc" ]; then
  source ~/.slackbuildrc
fi

PACKAGE="pine"
VERSION=${VERSION:=4.64}
PINEPGP=${PINEPGP:=0.18.0}
ARCH=${ARCH:=i486}
PINEBUILD=${BUILD:=1rha}
IMAPDBUILD=${BUILD:=1rha}

TMP=${TMP:=/tmp}
SRC_DIR=${SRC:=$CWD}
REPOS=${REPOS:=$TMP}

TMP="$TMP/$PACKAGE"
rm -rf $TMP
mkdir -p $TMP

PKG1=$TMP/package-pine
PKG2=$TMP/package-imapd

RTOOL="wget"
SRC="pine$VERSION.tar.bz2"
URL="ftp://ftp.slackware.com/pub/slackware/slackware-10.2/patches/source/pine/$SRC"
PGP="pinepgp-$PINEPGP.tar.gz"
PGP_URL="ftp://ftp.slackware.com/pub/slackware/slackware-10.2/patches/source/pine/$PGP"

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ]; then

  if [ ! -f "$SRC_DIR/$SRC" ]; then
    wget "$URL" -O "$SRC_DIR/$SRC"
  fi

  if [ ! -f "$SRC_DIR/$PGP" ]; then
    wget "$PGP_URL" -O "$SRC_DIR/$PGP"
  fi

fi

if [ ! -d $TMP ]; then
  mkdir -p $TMP # location to build the source
fi
rm -rf $PKG1 $PKG2
mkdir -p $PKG1 $PKG2

# Explode the package framework:
cd $PKG1
explodepkg $CWD/_pine.tar.gz
cd $PKG2
explodepkg $CWD/_imapd.tar.gz

echo "+==========+"
echo "| pine$VERSION |"
echo "+==========+"
cd $TMP
rm -rf pine$VERSION
tar xjvf $SRC_DIR/$SRC
cd pine$VERSION

if [ "$ARCH" == "x86_64" ]; then
 ( cd imap/src/osdep/unix; zcat $CWD/fpic.diff.gz | patch -p0 --verbose -E || exit )
fi

zcat $CWD/pine-slackware.config.diff.gz | patch -p1 --backup --verbose -E || exit

# Set default debug level to 0:
zcat $CWD/pine.debug.diff.gz | patch -p1 --backup --verbose -E || exit
echo "#define PASSFILE        \".pine.pwd\"" >> pine/osdep/os-lnx.h
# Remove ~ files:
find . -name "*~" | xargs rm --verbose
mkdir $PKG1/usr/doc/pine$VERSION
cp -a README CPYRIGHT $PKG1/usr/doc/pine$VERSION
( cd doc ; cp -a * $PKG1/usr/doc/pine$VERSION )
( cd $PKG1/usr/doc/pine$VERSION ; rm *.1 tech-notes.txt )
( cd $PKG1/usr/doc/pine$VERSION ; chown -R root.root * )
mkdir -p $PKG2/usr/doc/pine$VERSION
cp -a README CPYRIGHT $PKG2/usr/doc/pine$VERSION
chown root.root $PKG2/usr/doc/pine$VERSION/*

if [ "$ARCH" == "x86_64" ]; then
  ./build slx SSLLIB=/usr/lib SSLDIR=/etc/ssl SSLCERTS=/etc/ssl/certs SSLINCLUDE=/usr/include/openssl SSLTYPE=unix OPTIMIZE="-O2" DEBUG=-O2 CC="gcc -fPIC"
else
  ./build slx SSLLIB=/usr/lib SSLDIR=/etc/ssl SSLCERTS=/etc/ssl/certs SSLINCLUDE=/usr/include/openssl SSLTYPE=unix OPTIMIZE=-O2 DEBUG=-O2
fi

#( cd imap ; make clean )
#( cd imap ; make slx )
for file in doc/pico.1 doc/pilot.1 doc/pine.1 ; do
  cat $file | gzip -9c > $PKG1/usr/man/man1/`basename $file`.gz
done
for file in imap/src/imapd/imapd.8 imap/src/ipopd/ipopd.8 ; do
  cat $file | gzip -9c > $PKG2/usr/man/man8/`basename $file`.gz
done
cd imap/imapd
strip imapd
cat imapd > $PKG2/usr/sbin/imapd
cd ../ipopd
strip ipop3d
cat ipop3d > $PKG2/usr/sbin/ipop3d
cd ../../bin
strip *
cat pico > $PKG1/usr/bin/pico
cat pilot > $PKG1/usr/bin/pilot
cat pine > $PKG1/usr/bin/pine
# Add a default system-wide config file:
$PKG1/usr/bin/pine -conf > $PKG1/etc/pine.conf

# Add slack-desc files:
mkdir -p $PKG1/install
cat $CWD/slack-desc.pine > $PKG1/install/slack-desc
mkdir -p $PKG2/install
cat $CWD/slack-desc.imapd > $PKG2/install/slack-desc

# Add pinepgp support:
cd $TMP
tar xzvf $SRC_DIR/pinepgp-$PINEPGP.tar.gz
cd pinepgp-$PINEPGP
chown -R root.root .
./configure --prefix=/usr
make || exit 32
make install DESTDIR=$PKG1
chown root.bin $PKG1/usr/bin/*
mkdir -p $PKG1/usr/doc/pinepgp-$PINEPGP
cp -a COPYING README $PKG1/usr/doc/pinepgp-$PINEPGP 
chmod 644 $PKG1/usr/doc/pinepgp-$PINEPGP/*

# Build the package:
cd $PKG1
makepkg -l y -c n $REPOS/pine-$VERSION-$ARCH-$PINEBUILD.tgz
cd $PKG2
makepkg -l y -c n $REPOS/imapd-$VERSION-$ARCH-$IMAPDBUILD.tgz

# Clean up the extra stuff:
if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi