#!/bin/bash set +o posix # samba.SlackBuild # Heavily based on the original Slackware build scripts, # Modified by Stuart Winter # 06-Aug-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: #case $ARCH in # arm) export SLKCFLAGS="-march=armv5te -O2 -g" # export LIBDIRSUFFIX="" ;; # *) export SLKCFLAGS="-O2" ;; #esac # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.xz cd $PKGNAM-$VERSION || exit 1 slackhousekeeping # Patch to install talloc/tevent/tdb libraries and includes: zcat $CWD/samba.install.talloc.tevent.tdb.diff.gz | patch -p1 --verbose || exit 1 if [ ! -d source3/lib/cmdline ]; then ( cd source3/lib mkdir cmdline cd cmdline ln -sf ../../../source3/include/popt_common.h . ) fi # Apply patches: #tar xvvf $PORTCWD/sources/sam*debian* #while read i ; do # auto_apply_patch debian/patches/$i || exit 1 #done< <(cat debian/patches/series) # Some of these options could be auto-detected, but declaring them # here doesn't hurt and helps document what features we're trying to # build in. #LDFLAGS="-Wl,--no-as-needed" \ CFLAGS="$SLKCFLAGS -fstack-protector --param=ssp-buffer-size=4" \ CPPFLAGS="-D_FORTIFY_SOURCE=2" \ CXXFLAGS="$SLKCFLAGS -fstack-protector --param=ssp-buffer-size=4" \ FFLAGS="$SLKCFLAGS" \ LDFLAGS="-Wl,-z,relro -Wl,--no-as-needed" \ ./configure \ --enable-fhs \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --includedir=/usr/include \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --mandir=/usr/man \ --sysconfdir=/etc \ --with-configdir=/etc/samba \ --with-privatelibdir=/usr/lib${LIBDIRSUFFIX} \ --with-modulesdir=/usr/lib${LIBDIRSUFFIX} \ --with-piddir=/var/run \ --with-privatedir=/etc/samba/private \ --with-lockdir=/var/cache/samba \ --with-logfilebase=/var/log/samba \ --localstatedir=/var \ --enable-cups \ --with-automount \ --with-quotas \ --with-syslog \ --with-utmp \ --with-winbind \ --with-ldap \ --without-pam \ --with-acl-support \ --with-ads \ --build=$ARCH-slackware-linux-gnueabi || failconfig # Build: # -j options don't seem to work... JOBS=6 MAXJOBS=6 export JOBS MAXJOBS make || failmake mkdir -p \ $PKG/usr/doc/samba-$VERSION \ $PKG/var/spool/samba \ $PKG/var/log/samba \ $PKG/etc/samba/private \ $PKG/var/cache/samba chmod 700 $PKG/etc/samba/private chmod 1777 $PKG/var/spool/samba # Install: make install DESTDIR=$PKG || exit 1 # Install the smbprint script: install -m0744 packaging/printing/smbprint $PKG/usr/bin/smbprint # Add a sample config file: cat $CWD/smb.conf.default > $PKG/etc/samba/smb.conf-sample # Setup a default lmhosts file: echo "127.0.0.1 localhost" > $PKG/etc/samba/lmhosts.new if [ ! -r $PKG/usr/bin/smbget ]; then rm -f $PKG/usr/share/man/man1/smbget.1 fi # We'll add rc.samba to the init directory, but chmod 644 so that it doesn't # start by default: mkdir -p $PKG/etc/rc.d cat $CWD/rc.samba > $PKG/etc/rc.d/rc.samba.new chmod 644 $PKG/etc/rc.d/rc.samba.new mv $PKG/usr/share/man $PKG/usr gzip -9 $PKG/usr/man/man?/*.? find $PKG | xargs file | grep -e "executable" -e "shared object" \ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null # PAM related stuff we don't use: rm -r $PKG/usr/share/locale rm -f $PKG/usr/man/man8/pam* cp -a \ COPYING* MAINTAINERS Manifest PFIF.txt README* \ Read-Manifest-Now Roadmap WHATSNEW.txt docs examples \ $PKG/usr/doc/samba-$VERSION # These are installed elsewhere: rm -rf $PKG/usr/doc/samba-$VERSION/docs/htmldocs \ $PKG/usr/doc/samba-$VERSION/docs/manpages # Empty now? rmdir $PKG/usr/doc/samba-$VERSION/docs 2> /dev/null # I'm sorry, but when all this info is included in HTML, adding 7MB worth of # PDF files just to have extra artwork is more fluff than I'll agree to. rm -f $PKG/usr/doc/samba-$VERSION/docs/*.pdf # Also redundant also: rm -rf $PKG/usr/doc/samba-$VERSION/docs/docbook # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh # Finally ensure permissions, which may have got broken by the 'slackslack' # above: chmod 700 etc/samba/private chmod 755 var/cache/samba/ chmod 755 var/log/samba/ chmod 1777 var/spool/samba/ slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links