summaryrefslogtreecommitdiff
path: root/bin/make-win32-iso
blob: 87e62e8217ce8b67581d9707252f8d0648d4669a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash

# Create two ISOs for Win32:
#	-multilingual installer and additional language pack installers
#	-source code

# Requires mkisofs, from cdrtools. Compiling that from source is a
# pain, thanks to the author's insistence that his configuration and
# make system is better than everybody's elses. One cdrtools
# distribution of binaries for Cygwin known to work is at
# http://www.sbox.tugraz.at/home/t/tplank/cdrtools-2.01-win32-bin.zip
# and tucked away for safety also in go-oo.org:~ooo .

# NOTE: very much a work in progress...

set -o errexit

. ./setup

ISOTEMPLATE=$SRCDIR/win32-iso-template-$DISTRO.zip
COUNTERFILE=win32-iso-counter

MULTILANGS=''
RESTLANGS=''

for i in $OOO_LANGS; do
    case $i in
    # This are the languages for which there exists localisations
    ar|cs|da|de|el|es|fi|fr|he|hu|it|nb|nl|pl|pt-BR|pt|ru|sv|tr)
	MULTILANGS="$MULTILANGS,$i";;
    en-US)
	;;
    *)
	RESTLANGS="$RESTLANGS $i";;
    esac
done

case "$MULTILANGS" in
*,*,*,*)
    ;;
*)
    echo "This doesn't seem like a multilingual build. To make ISOs"
    echo "you should have configured a real production build, that is"
    echo "with lots of languages. For the Novell Edition,"
    echo "use --with-distro=NovellWin32ISO"
    exit 1;;
esac

cd $OOBUILDDIR

. ./winenv.set.sh

COUNTER=0
[ -f $COUNTERFILE ] && COUNTER=`cat $COUNTERFILE`
COUNTER=`expr $COUNTER + 1`

cd instsetoo_native

ZIPNAMEPREFIX=OOo-$OOO_PACKAGEVERSION-$COUNTER

if [ -z "$DONTBUILD" ]; then
    # Build the installers.

    # Edit the relevant target line in instsetoo_native/util/makefile.mk
    # to build the multilingual installer for those languages for which
    # there exists XP localisations, and language pack installers for the
    # rest.
    gawk '/^ALLTAR :/ { n++;
			if (n==3) {
			  printf "ALLTAR : openoffice_en-US openoffice_en-US'"$MULTILANGS"'";
			  split ("'"$RESTLANGS"'", restlangs);
			  for (i in restlangs) {
			    printf " ooolanguagepack_%s", restlangs[i];
			  }
			  printf "\n";
			  next;
			}
		      }
	  { print; }
    ' <util/makefile.mk >util/makefile.mk.new

    if cmp util/makefile.mk util/makefile.mk.new; then
	:
    else
	echo Edited instsetoo_native/util/makefile.mk:
	diff -u0 util/makefile.mk util/makefile.mk.new || true
	mv util/makefile.mk.new util/makefile.mk
    fi

    # For some reason one cannot use the "build" alias in this script.
    perl $SOLARENV/bin/build.pl
fi

OUTDIR=`mktemp -d`

ISOROOT=`mktemp -d`
SRCISOROOT=$TOOLSDIR/ooo-build-$OOO_BUILDVERSION

# Construct the installer CD contents

cp -pR wntmsci10.pro/OpenOffice/msi/install/en-US`echo $MULTILANGS | sed -e 's/,/_/g'`/. $ISOROOT

mkdir $ISOROOT/langpacks
for i in $RESTLANGS; do
    (
    ii=$i
    [ -d wntmsci10.pro/OpenOffice_languagepack/msi/install/en-US_$i ] && ii=en-US_$i
    cd wntmsci10.pro/OpenOffice_languagepack/msi/install/$ii
    zip -q -r $ISOROOT/langpacks/$ZIPNAMEPREFIX-$i.zip .
    )
done

cd $ISOROOT
if [ -f $ISOTEMPLATE ]; then
    unzip $ISOTEMPLATE
else
    echo "No template with contents for the installer ISO ($ISOTEMPLATE) found."
fi

cp $OOBUILDDIR/readlicense_oo/html/THIRDPARTYLICENSEREADME.html .

echo "[autorun]" > autorun.inf
echo "open=setup.exe" >> autorun.inf

# Build the installer ISO

mkisofs -quiet -J -r -V OOO-$OOO_PACKAGEVERSION-$COUNTER -o $OUTDIR/OOo-$OOO_PACKAGEVERSION-$COUNTER.iso .

# Construct the source code CD contents

cd $TOOLSDIR
make distdir >/dev/null
if [ -f download.list ]; then
    while read FILENAME; do
	case "$FILENAME" in
	*.exe|*.EXE)
	    # Ignore presumably non-redistributable files
	    ;;
	*)
	    mkdir -p $SRCISOROOT/src
	    cp -p src/$FILENAME $SRCISOROOT/src
	    ;;
	esac
    done <download.list
else
    echo "Missing download.list, did you remove it?"
    exit 1
fi

cd $SRCISOROOT

# Build the source code ISO

mkisofs -quiet -J -r -V OOO-src-$OOO_PACKAGEVERSION-$COUNTER -o $OUTDIR/OOo-$OOO_PACKAGEVERSION-src.iso .

cd $TOOLSDIR

echo Installer ISO in $OUTDIR/OOo-$OOO_PACKAGEVERSION-$COUNTER.iso
echo Source code ISO in $OUTDIR/OOo-src-$OOO_PACKAGEVERSION-$COUNTER.iso

# All done. Increment counter, remove temporary folders

rm -rf $ISOROOT
rm -rf $SRCISOROOT

# Store incremented counter
cd $OOBUILDDIR
echo $COUNTER >$COUNTERFILE