first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[bbaumbach/samba-autobuild/.git] / packaging / SGI / mkrelease.sh
1 #!/bin/sh
2
3 # This file goes through all the necessary steps to build a release package.
4 # syntax:
5 #     mkrelease.sh [5] [clean] [targets ....]
6 #
7 # You may specify 5 to build for IRIX 5.3
8 #
9 # You can specify clean to do a make clean before building. Make clean
10 # will also run configure and generate the required Makefile.
11 #
12 # You can specify which targets to build. If targets are specified, the
13 # specified targets will be built but inst packages will not be generated.
14
15 doclean=""
16 SGI_ABI=-n32
17 ISA=-mips3
18 CC=cc
19
20 if [ ! -f ../../source/Makefile ]; then
21   doclean="clean"
22 fi
23
24 if [ "$1" = "clean" ]; then
25   doclean=$1
26   shift
27 elif [ "$1" = "5" ]; then
28   SGI_ABI=-32
29   ISA=""
30   shift
31 fi
32
33 # check again in case they put the args in the wrong order
34
35 if [ "$1" = "clean" ]; then
36   doclean=$1
37   shift
38 elif [ "$1" = "5" ]; then
39   SGI_ABI=-32
40   ISA=""
41   shift
42 fi
43
44 export SGI_ABI ISA CC
45
46 if [ "$doclean" = "clean" ]; then
47   cd ../../source
48   if [ -f Makefile ]; then
49     make distclean
50   fi
51   cd ../packaging/SGI
52   rm -rf bins catman html codepages swat samba.idb samba.spec
53 fi
54
55 # create the catman versions of the manual pages
56 #
57 if [ "$doclean" = "clean" ]; then
58   echo Making manual pages
59   ./mkman
60   errstat=$?
61   if [ $errstat -ne 0 ]; then
62     echo "Error $errstat making manual pages\n";
63     exit $errstat;
64   fi
65 fi
66
67 cd ../../source
68 if [ "$doclean" = "clean" ]; then
69   echo Create SGI specific Makefile
70   ./configure --prefix=/usr/samba --mandir=/usr/share/catman --with-smbwrapper
71   errstat=$?
72   if [ $errstat -ne 0 ]; then
73     echo "Error $errstat creating Makefile\n";
74     exit $errstat;
75   fi
76 fi
77
78
79 # build the sources
80 #
81 echo Making binaries
82
83 make "CFLAGS=-O -g3" $*
84 errstat=$?
85 if [ $errstat -ne 0 ]; then
86   echo "Error $errstat building sources\n";
87   exit $errstat;
88 fi
89
90 cd ../packaging/SGI
91
92 #
93 # Don't generate packages if targets were specified
94 #
95 if [ "$1" != "" ]; then
96   exit 0;
97 fi
98
99 # generate the packages
100 #
101 echo Generating Inst Packages
102 ./spec.pl                       # create the samba.spec file
103 errstat=$?
104 if [ $errstat -ne 0 ]; then
105   echo "Error $errstat creating samba.spec\n";
106   exit $errstat;
107 fi
108
109 ./idb.pl                        # create the samba.idb file
110 errstat=$?
111 if [ $errstat -ne 0 ]; then
112   echo "Error $errstat creating samba.idb\n";
113   exit $errstat;
114 fi
115
116 if [ ! -d bins ]; then
117    mkdir bins
118 fi
119
120 # do the packaging
121 /usr/sbin/gendist -rbase / -sbase ../.. -idb samba.idb -spec samba.spec -dist ./bins -all
122