source: npl/fileserver/samba/samba.SlackBuild.orig @ 80c0fb9

gcc484perl-5.22
Last change on this file since 80c0fb9 was 80c0fb9, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

samba upgrade to 4.7.6

  • Property mode set to 100755
File size: 6.2 KB
Line 
1#!/bin/sh
2
3# Copyright 2008, 2009, 2010, 2012, 2013, 2015, 2016, 2017  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.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-1}
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
70cd $TMP
71rm -rf samba-$VERSION
72tar xvf $CWD/samba-$VERSION.tar.?z || exit 1
73cd samba-$VERSION || exit 1
74
75if [ ! -d source3/lib/cmdline ]; then
76  ( cd source3/lib
77    mkdir cmdline
78    cd cmdline
79    ln -sf ../../../source3/include/popt_common.h . )
80fi
81
82chown -R root:root .
83find . \
84  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
85  -exec chmod 755 {} \; -o \
86  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
87  -exec chmod 644 {} \;
88
89# Some of these options could be auto-detected, but declaring them
90# here doesn't hurt and helps document what features we're trying to
91# build in.
92#
93# LDFLAGS are needed to avoid problems with missing symbols.
94LDFLAGS="-Wl,--no-as-needed" \
95CFLAGS="$SLKCFLAGS" \
96./configure \
97  --enable-fhs \
98  --prefix=/usr \
99  --libdir=/usr/lib${LIBDIRSUFFIX} \
100  --includedir=/usr/include \
101  --bindir=/usr/bin \
102  --sbindir=/usr/sbin \
103  --mandir=/usr/man \
104  --sysconfdir=/etc \
105  --with-configdir=/etc/samba \
106  --with-piddir=/var/run \
107  --with-privatedir=/var/lib/samba/private \
108  --with-privatelibdir=/usr/lib${LIBDIRSUFFIX} \
109  --with-modulesdir=/usr/lib${LIBDIRSUFFIX} \
110  --with-lockdir=/var/cache/samba \
111  --with-logfilebase=/var/log/samba \
112  --localstatedir=/var \
113  --enable-cups \
114  --with-acl-support \
115  --with-automount \
116  --with-quotas \
117  --with-syslog \
118  --with-utmp \
119  --with-winbind \
120  --with-ldap \
121  --with-ads \
122  --without-pam \
123  --build=$TARGET || exit 1
124  # Gives errors:
125  #--builtin-libraries=replace,ccan \
126  #--bundled-libraries=heimdal \
127
128# -j options don't seem to work... [Yes they do!  At least try to use -j below...]
129JOBS=6
130MAXJOBS=6
131export JOBS MAXJOBS
132make -j $MAXJOBS || make || exit 1
133
134mkdir -p \
135         $PKG/usr/doc/samba-$VERSION \
136         $PKG/var/spool/samba \
137         $PKG/var/log/samba \
138         $PKG/var/lib/samba/private \
139         $PKG/var/cache/samba
140chmod 700 $PKG/var/lib/samba/private
141chmod 1777 $PKG/var/spool/samba
142
143make install DESTDIR=$PKG || exit 1
144
145# Install the smbprint script:
146install -m0744 packaging/printing/smbprint $PKG/usr/bin/smbprint
147
148# Add a sample config file:
149cat $CWD/smb.conf.default > $PKG/etc/samba/smb.conf-sample
150
151# Setup a default lmhosts file:
152echo "127.0.0.1 localhost" > $PKG/etc/samba/lmhosts.new
153
154if [ ! -r $PKG/usr/bin/smbget ]; then
155  rm -f $PKG/usr/share/man/man1/smbget.1
156fi
157
158# We'll add rc.samba to the init directory, but chmod 644 so that it doesn't
159# start by default:
160mkdir -p $PKG/etc/rc.d
161cat $CWD/rc.samba > $PKG/etc/rc.d/rc.samba.new
162chmod 644 $PKG/etc/rc.d/rc.samba.new
163
164# mv $PKG/usr/share/man $PKG/usr
165# gzip -9 $PKG/usr/man/man?/*.?
166
167find $PKG | xargs file | grep -e "executable" -e "shared object" \
168  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
169
170# PAM related stuff we don't use:
171# rm -r $PKG/usr/share/locale
172rm -f $PKG/usr/man/man8/pam*
173
174cp -a \
175  COPYING* MAINTAINERS Manifest PFIF.txt README* \
176  Read-Manifest-Now Roadmap WHATSNEW.txt docs examples \
177  $PKG/usr/doc/samba-$VERSION || true
178# These are installed elsewhere:
179rm -rf $PKG/usr/doc/samba-$VERSION/docs/htmldocs \
180       $PKG/usr/doc/samba-$VERSION/docs/manpages
181# Empty now?
182rmdir $PKG/usr/doc/samba-$VERSION/docs 2> /dev/null
183# I'm sorry, but when all this info is included in HTML, adding 7MB worth of
184# PDF files just to have extra artwork is more fluff than I'll agree to.
185rm -f $PKG/usr/doc/samba-$VERSION/docs/*.pdf
186# Also redundant also:
187rm -rf $PKG/usr/doc/samba-$VERSION/docs/docbook
188
189mkdir -p $PKG/install
190cat $CWD/slack-desc > $PKG/install/slack-desc
191zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
192
193cat << EOF
194
195*** Be sure the package contains:
196
197drwxr-xr-x   2 root     root         4096 May  3 15:46 /var/cache/samba/
198drwx------   2 root     root         1024 Mar 12 13:21 /var/lib/samba/private
199drwxr-xr-x   2 root     root           48 Aug 29 13:06 /var/log/samba/
200drwxrwxrwt   2 root     root         1024 Mar 12 13:21 /var/spool/samba/
201
202EOF
203
204cd $PKG
205/sbin/makepkg -l y -c n $TMP/samba-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.