source: npl/fileserver/samba/samba.SlackBuild.orig @ 250d444

gcc484perl-5.22
Last change on this file since 250d444 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 6.7 KB
Line 
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2012, 2013, 2015, 2016  Patrick J. Volkerding, Sebeka, Minnesota, USA
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
23# Modified 2012 by Eric Hameleers <alien at slackware.com> for ARM port.
24
25
26VERSION=${VERSION:-$(echo samba-*.tar.gz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-3}
28
29if [ -e $CWD/machine.conf ]; then
30  . $CWD/machine.conf ]
31elif [ -e /etc/slackbuild/machine.conf ]; then
32  . /etc/slackbuild/machine.conf ]
33else
34  # Automatically determine the architecture we're building on:
35  if [ -z "$ARCH" ]; then
36    case "$( uname -m )" in
37      i?86) export ARCH=i586 ;;
38      arm*) export ARCH=arm ;;
39      # Unless $ARCH is already set, use uname -m for all other archs:
40         *) export ARCH=$( uname -m ) ;;
41    esac
42  fi
43  # Set CFLAGS/CXXFLAGS and LIBDIRSUFFIX:
44  if [ "$ARCH" = "i586" ]; then
45    SLKCFLAGS="-O2 -march=i586 -mtune=i686"
46    LIBDIRSUFFIX=""
47  elif [ "$ARCH" = "s390" ]; then
48    SLKCFLAGS="-O2"
49    LIBDIRSUFFIX=""
50  elif [ "$ARCH" = "x86_64" ]; then
51    SLKCFLAGS="-O2 -fPIC"
52    LIBDIRSUFFIX="64"
53  else
54    SLKCFLAGS="-O2"
55    LIBDIRSUFFIX=""
56  fi
57fi
58
59case "$ARCH" in
60    arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
61    *)    TARGET=$ARCH-slackware-linux ;;
62esac
63
64CWD=$(pwd)
65TMP=${TMP:-/tmp}
66PKG=$TMP/package-samba
67rm -rf $PKG
68mkdir -p $TMP $PKG
69
70if [ -r /usr/lib${LIBDIRSUFFIX}/libtalloc.so.? -a ! -r /var/log/packages/talloc* ]; then
71  echo "The Samba package needs to be removed before building to ensure that"
72  echo "talloc (and possibly other bundled libraries) are included in the build."
73  echo
74  echo "Removing the Samba package in 15 seconds, and then continuing with the build."
75  sleep 15
76  removepkg samba
77fi
78
79cd $TMP
80rm -rf samba-$VERSION
81tar xvf $CWD/samba-$VERSION.tar.gz || exit 1
82cd samba-$VERSION || exit 1
83
84# Patch to install talloc/tevent/tdb libraries and includes:
85zcat $CWD/samba.install.talloc.tevent.tdb.diff.gz | patch -p1 --verbose || exit 1
86
87if [ ! -d source3/lib/cmdline ]; then
88  ( cd source3/lib
89    mkdir cmdline
90    cd cmdline
91    ln -sf ../../../source3/include/popt_common.h . )
92fi
93
94chown -R root:root .
95find . \
96  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
97  -exec chmod 755 {} \; -o \
98  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
99  -exec chmod 644 {} \;
100
101# Some of these options could be auto-detected, but declaring them
102# here doesn't hurt and helps document what features we're trying to
103# build in.
104#
105# LDFLAGS are needed to avoid problems with missing symbols.
106LDFLAGS="-Wl,--no-as-needed" \
107CFLAGS="$SLKCFLAGS" \
108./configure \
109  --enable-fhs \
110  --prefix=/usr \
111  --libdir=/usr/lib${LIBDIRSUFFIX} \
112  --includedir=/usr/include \
113  --bindir=/usr/bin \
114  --sbindir=/usr/sbin \
115  --mandir=/usr/man \
116  --sysconfdir=/etc \
117  --with-configdir=/etc/samba \
118  --with-piddir=/var/run \
119  --with-privatedir=/var/lib/samba/private \
120  --with-privatelibdir=/usr/lib${LIBDIRSUFFIX} \
121  --with-modulesdir=/usr/lib${LIBDIRSUFFIX} \
122  --with-lockdir=/var/cache/samba \
123  --with-logfilebase=/var/log/samba \
124  --localstatedir=/var \
125  --enable-cups \
126  --with-acl-support \
127  --with-automount \
128  --with-quotas \
129  --with-syslog \
130  --with-utmp \
131  --with-winbind \
132  --with-ldap \
133  --with-ads \
134  --without-pam \
135  --build=$TARGET
136  # Gives errors:
137  #--builtin-libraries=replace,ccan \
138  #--bundled-libraries=heimdal \
139
140# -j options don't seem to work... [Yes they do!  At least try to use -j below...]
141JOBS=1
142MAXJOBS=20
143export JOBS MAXJOBS
144make -j $MAXJOBS || make || exit 1
145
146mkdir -p \
147         $PKG/usr/doc/samba-$VERSION \
148         $PKG/var/spool/samba \
149         $PKG/var/log/samba \
150         $PKG/var/lib/samba/private \
151         $PKG/var/cache/samba
152chmod 700 $PKG/var/lib/samba/private
153chmod 1777 $PKG/var/spool/samba
154
155make install DESTDIR=$PKG || exit 1
156
157# Install the smbprint script:
158install -m0744 packaging/printing/smbprint $PKG/usr/bin/smbprint
159
160# Add a sample config file:
161cat $CWD/smb.conf.default > $PKG/etc/samba/smb.conf-sample
162
163# Setup a default lmhosts file:
164echo "127.0.0.1 localhost" > $PKG/etc/samba/lmhosts.new
165
166if [ ! -r $PKG/usr/bin/smbget ]; then
167  rm -f $PKG/usr/share/man/man1/smbget.1
168fi
169
170# We'll add rc.samba to the init directory, but chmod 644 so that it doesn't
171# start by default:
172mkdir -p $PKG/etc/rc.d
173cat $CWD/rc.samba > $PKG/etc/rc.d/rc.samba.new
174chmod 644 $PKG/etc/rc.d/rc.samba.new
175
176#mv $PKG/usr/share/man $PKG/usr
177#gzip -9 $PKG/usr/man/man?/*.?
178
179find $PKG | xargs file | grep -e "executable" -e "shared object" \
180  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
181
182# PAM related stuff we don't use:
183#rm -r $PKG/usr/share/locale
184rm -f $PKG/usr/man/man8/pam*
185
186cp -a \
187  COPYING* PFIF.txt README* \
188  Roadmap WHATSNEW.txt docs examples \
189  $PKG/usr/doc/samba-$VERSION
190# These are installed elsewhere:
191rm -rf $PKG/usr/doc/samba-$VERSION/docs/htmldocs \
192       $PKG/usr/doc/samba-$VERSION/docs/manpages
193# Empty now?
194rmdir $PKG/usr/doc/samba-$VERSION/docs 2> /dev/null
195# I'm sorry, but when all this info is included in HTML, adding 7MB worth of
196# PDF files just to have extra artwork is more fluff than I'll agree to.
197rm -f $PKG/usr/doc/samba-$VERSION/docs/*.pdf
198# Also redundant also:
199rm -rf $PKG/usr/doc/samba-$VERSION/docs/docbook
200
201mkdir -p $PKG/install
202cat $CWD/slack-desc > $PKG/install/slack-desc
203zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
204
205cat << EOF
206
207*** Be sure the package contains:
208
209drwxr-xr-x   2 root     root         4096 May  3 15:46 /var/cache/samba/
210drwx------   2 root     root         1024 Mar 12 13:21 /var/lib/samba/private
211drwxr-xr-x   2 root     root           48 Aug 29 13:06 /var/log/samba/
212drwxrwxrwt   2 root     root         1024 Mar 12 13:21 /var/spool/samba/
213
214EOF
215
216cd $PKG
217/sbin/makepkg -l y -c n $TMP/samba-$VERSION-$ARCH-$BUILD.txz
218
Note: See TracBrowser for help on using the repository browser.