Upload Tizen:Base source
[toolchains/nspr.git] / mozilla / nsprpub / admin / repackage.sh
1 #! /bin/sh
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 #
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
9 #
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
14 #
15 # The Original Code is the Netscape Portable Runtime (NSPR).
16 #
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998-2001
20 # the Initial Developer. All Rights Reserved.
21 #
22 # Contributor(s):
23 #
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
35 #
36 # ***** END LICENSE BLOCK *****
37
38 # ------------------------------------------------------------------
39 # repackage.sh -- Repackage NSPR from /s/b/c to mozilla.org format
40 #
41 # syntax: repackage.sh
42 #
43 # Description:
44 # repackage.sh creates NSPR binary distributions for mozilla.org from
45 # the internal binary distributions in /share/builds/components/nspr20.
46 # There are reasons why we can't just push the internal binary distributions
47 # to mozilla.org. External developers prefer to use the common archive 
48 # file format for their platforms, rather than the jar files we use internally.
49 #
50 # On Unix, we create a tar.gz file.  On Windows, we create a zip file.
51 # For example: NSPR 4.1.1, these would be nspr-4.1.1.tar.gz and nspr-4.1.1.zip.
52 #
53 # When unpacked, nspr-4.1.1.tar.gz or nspr-4.1.1.zip should expand to a
54 # nspr-4.1.1 directory that contains three subdirectories: include, lib,
55 # and bin.  The header files, with the correct line endings for the
56 # platform, are in nspr-4.1.1/include.  The libraries are in nspr-4.1.1/lib.
57 # The executable programs are in nspr-4.1.1/bin.
58
59 # Note! Files written with Gnu tar are not readable by some non-Gnu
60 # versions. Sun, in particular.
61
62
63
64
65 # ------------------------------------------------------------------
66
67 FROMTOP=/share/builds/components/nspr20/v4.8.7
68 TOTOP=./v4.8.7
69 NSPRDIR=nspr-4.8.7
70 SOURCETAG=NSPR_4_8_7_RTM
71
72 #
73 # enumerate Unix object directories on /s/b/c
74 UNIX_OBJDIRS="
75 HP-UXB.11.11_64_DBG.OBJ
76 HP-UXB.11.11_64_OPT.OBJ
77 HP-UXB.11.11_DBG.OBJ
78 HP-UXB.11.11_OPT.OBJ
79 HP-UXB.11.23_ia64_32_DBG.OBJ
80 HP-UXB.11.23_ia64_32_OPT.OBJ
81 HP-UXB.11.23_ia64_64_DBG.OBJ
82 HP-UXB.11.23_ia64_64_OPT.OBJ
83 Linux2.4_x86_glibc_PTH_DBG.OBJ
84 Linux2.4_x86_glibc_PTH_OPT.OBJ
85 Linux2.6_x86_64_glibc_PTH_DBG.OBJ
86 Linux2.6_x86_64_glibc_PTH_OPT.OBJ
87 Linux2.6_x86_glibc_PTH_DBG.OBJ
88 Linux2.6_x86_glibc_PTH_OPT.OBJ
89 SunOS5.9_64_DBG.OBJ
90 SunOS5.9_64_OPT.OBJ
91 SunOS5.9_DBG.OBJ
92 SunOS5.9_OPT.OBJ
93 "
94 #
95 # enumerate Windows object directories on /s/b/c
96 WIN_OBJDIRS="
97 WIN954.0_DBG.OBJ
98 WIN954.0_DBG.OBJD
99 WIN954.0_OPT.OBJ
100 WINNT5.0_DBG.OBJ
101 WINNT5.0_DBG.OBJD
102 WINNT5.0_OPT.OBJ
103 "
104
105 #
106 # Create the destination directory.
107 #
108 echo "removing directory $TOTOP"
109 rm -rf $TOTOP
110 echo "creating directory $TOTOP"
111 mkdir -p $TOTOP
112
113 #
114 # Generate the tar.gz files for Unix platforms.
115 #
116 for OBJDIR in $UNIX_OBJDIRS; do
117     echo "removing directory $NSPRDIR"
118     rm -rf $NSPRDIR
119     echo "creating directory $NSPRDIR"
120     mkdir $NSPRDIR
121
122     echo "creating directory $NSPRDIR/include"
123     mkdir $NSPRDIR/include
124     echo "copying $FROMTOP/$OBJDIR/include"
125     cp -r $FROMTOP/$OBJDIR/include $NSPRDIR
126
127     echo "copying $FROMTOP/$OBJDIR/lib"
128     cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
129
130     echo "copying $FROMTOP/$OBJDIR/bin"
131     cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
132
133     echo "creating directory $TOTOP/$OBJDIR"
134     mkdir $TOTOP/$OBJDIR
135     echo "creating $TOTOP/$OBJDIR/$NSPRDIR.tar"
136     tar cvf $TOTOP/$OBJDIR/$NSPRDIR.tar $NSPRDIR
137     echo "gzipping $TOTOP/$OBJDIR/$NSPRDIR.tar"
138     gzip $TOTOP/$OBJDIR/$NSPRDIR.tar
139 done
140
141 #
142 # Generate the zip files for Windows platforms.
143 #
144 for OBJDIR in $WIN_OBJDIRS; do
145     echo "removing directory $NSPRDIR"
146     rm -rf $NSPRDIR
147     echo "creating directory $NSPRDIR"
148     mkdir $NSPRDIR
149
150     echo "creating directory $NSPRDIR/include"
151     mkdir $NSPRDIR/include
152     echo "creating directory $NSPRDIR/include/private"
153     mkdir $NSPRDIR/include/private
154     echo "creating directory $NSPRDIR/include/obsolete"
155     mkdir $NSPRDIR/include/obsolete
156
157     # copy headers and adjust unix line-end to Windows line-end
158     # Note: Watch out for the "sed" command line.
159     # when editing the command, take care to preserve the "^M" as the literal
160     # cntl-M character! in vi, use "cntl-v cntl-m" to enter it!
161     #
162     headers=`ls $FROMTOP/$OBJDIR/include/*.h`
163     for header in $headers; do
164         sed -e 's/$/\r/g' $header > $NSPRDIR/include/`basename $header`
165     done
166     headers=`ls $FROMTOP/$OBJDIR/include/obsolete/*.h`
167     for header in $headers; do
168         sed -e 's/$/\r/g' $header > $NSPRDIR/include/obsolete/`basename $header`
169     done
170     headers=`ls $FROMTOP/$OBJDIR/include/private/*.h`
171     for header in $headers; do
172         sed -e 's/$/\r/g' $header > $NSPRDIR/include/private/`basename $header`
173     done
174
175     echo "copying $FROMTOP/$OBJDIR/lib"
176     cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
177
178     echo "copying $FROMTOP/$OBJDIR/bin"
179     cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
180
181     echo "creating directory $TOTOP/$OBJDIR"
182     mkdir -p $TOTOP/$OBJDIR
183     echo "creating $TOTOP/$OBJDIR/$NSPRDIR.zip"
184     zip -r $TOTOP/$OBJDIR/$NSPRDIR.zip $NSPRDIR
185 done
186
187 #
188 # package the source from CVS
189 #
190 echo "Packaging source"
191 echo "removing directory $NSPRDIR"
192 rm -rf $NSPRDIR
193 echo "creating directory $NSPRDIR"
194 mkdir $NSPRDIR
195 myWD=`pwd`
196 cd $NSPRDIR
197 echo "Pulling source from CVS with tag $SOURCETAG"
198 cvs co -r $SOURCETAG mozilla/nsprpub
199 cd $myWD
200 mkdir $TOTOP/src
201 echo "Creating source tar file: $TOTOP/src/$NSPRDIR.tar"
202 tar cvf $TOTOP/src/$NSPRDIR.tar $NSPRDIR
203 echo "gzip $TOTOP/src/$NSPRDIR.tar"
204 gzip $TOTOP/src/$NSPRDIR.tar
205
206 #
207 # Remove the working directory.
208 #
209 echo "removing directory $NSPRDIR"
210 rm -rf $NSPRDIR
211 # --- end repackage.sh ---------------------------------------------