Fix broken reference on ui subproject
[moonshot.git] / mac-client-installer / build-installer.sh
1 #!/bin/sh
2
3 #  build-installer.sh
4 #  
5 #  Copyright (c) 2012, JANET(UK)
6
7 cd ~/moonshot/mac-client-installer
8 pwd
9 echo "    *  Put the jhbuild config file in the correct place"
10 cp ./.jhbuildrc-custom ~/
11 echo "    *  Remove old files and directories"
12 rm *.dmg
13 rm *.pkg
14 rm -Rf moonshot
15 rm -Rf moonshot-ui
16 rm -Rf sasl
17 echo "Done"
18
19 echo "    *  Bootstrap jhbuild"
20 jhbuild bootstrap --ignore-system
21 pwd
22 echo "Done preparing"
23
24 echo "    *  build moonshot in jhbuild shell"
25 cd ../moonshot 
26 pwd
27 jhbuild run ./autogen.sh 
28 jhbuild run ./configure --enable-acceptor=no --with-krb5=$HOME//moonshot/mac-client-installer/krb/usr/local  
29 jhbuild run make && make install DESTDIR=$HOME/moonshot/mac-client-installer/moonshot
30 cd ~/moonshot/mac-client-installer
31 pwd
32 echo "Done"
33
34 echo "    *  The first time this script is run the following errors may be generated: "
35 echo "    *  ** Error during phase build of cyrus-sasl: ########## Error running make   *** [39/41]"
36 echo "    *  choose  [4] Start shell"
37 echo "      $ ./configure --prefix=/usr/local --with-gss_impl=mit"
38 echo "      $ exit "
39 echo "    *  choose [1] Rerun phase build"
40 echo
41 echo "    *  build cyrus-sasl using jhbuild"
42 jhbuild build cyrus-sasl
43 echo "Done"
44
45 echo "    *  Fix up the cyrus-sasl links"
46 mkdir -p sasl/usr/lib
47 cd sasl/usr/lib && ln -fs   ../local/lib/sasl2 
48 cd ~/moonshot/mac-client-installer
49 pwd
50 echo "Done"
51
52 echo "    *  The first time this script is run the following errors may be generated: "
53 echo "    *  *** Error during phase configure of gtk-mac-bundler: ########## Error running ./configure --prefix /Users/pete/gtk/inst --libdir '/Users/pete/gtk/inst/lib'    *** "
54 echo "    *  choose [2] Ignore error and continue"
55 echo "    *"
56 echo "    *  *** Error during phase build of perl-xml-parser: ########## Error running make LD_RUN_PATH= *** [6/37]"
57 echo "    *  choose  [4] Start shell"
58 echo "    *    $ git apply ~/moonshot/mac-client-installer/0001-Remove-arch-ppc-flags.patch "
59 echo "    *    $ make"
60 echo "    *    $ exit "
61 echo "    *  choose [2] Ignore error and continue"
62 echo "    *"
63 echo "    *  *** Error during phase configure of gtk-mac-bundler: ########## Error running ./configure --prefix /Users/pete/gtk/inst --libdir '/Users/pete/gtk/inst/lib'    *** [37/38]"
64 echo "    *  choose [2] Ignore error and continue"
65 echo "    *"
66 echo "    *  Now we can build moonshot-ui"
67 jhbuild build moonshot-ui
68 echo "Done"
69 echo
70
71 echo "    *  Make moonshot-ui app bundle in jhbuild shell"
72 cd ~/gtk/source/moonshot-ui/ &&  jhbuild run make app-bundle 
73 echo "Done"
74
75 echo "    *  Make the libmoonshot files in the correct directory for the installer"
76 jhbuild run ./configure && make && make install DESTDIR=$HOME/moonshot/mac-client-installer/moonshot-ui
77 cd ~/moonshot/mac-client-installer
78 pwd
79 echo "Done"
80
81 echo "    *  Ensure the permissions are correct for the files to be installed"
82 sudo chown -R root:admin sasl krb moonshot moonshot-ui
83 sudo chmod -R g+w sasl krb moonshot moonshot-ui
84 echo "Done"
85
86 echo "    *  Put the DBus Property list in the moonshot-ui tree for the installer with the correct permissions"
87 cp org.freedesktop.dbus-session.plist moonshot-ui/
88 sudo chown -R root:admin moonshot-ui/org.freedesktop.dbus-session.plist
89
90 echo "    *  Create the installer package"
91 /Developer/usr/bin/packagemaker --doc Moonshot\ Client\ Software.pmdoc \
92 --version 0.1 --filter "/.DS_Store"  --root-volume-only \
93 --domain system --verbose --no-relocate -l "/" --target 10.5 \
94 --id ja.net.moonshotClientSoftware  --out Moonshot\ Client\ Software.pkg
95
96 echo "    *  Create and mount a disk image"
97 hdiutil create -size 20m -fs HFS+ -volname "Moonshot Client Software" temp.dmg 
98 hdiutil attach temp.dmg 
99
100 echo "    *  Copy the package and the READMEs"
101 cp -R Moonshot\ Client\ Software.pkg /Volumes/Moonshot\ Client\ Software/ 
102 # TODO we need some readmes for the Mac instalatiom
103 #cp -R resources/*  /Volumes/Moonshot\ Client\ Software/ 
104
105 echo "    *  Get rid of hidden files and folders that we don't need"
106 sudo rm -rf /Volumes/Moonshot\ Client\ Software/.fseventsd/ 
107 sudo rm -rf /Volumes/Moonshot\ Client\ Software/.Trashes/ 
108 sudo find /Volumes/Moonshot\ Client\ Software -name '.*' -type f -delete
109
110 echo "    *  Unmount the image"
111 hdiutil detach /Volumes/Moonshot\ Client\ Software 
112
113 echo "    *  Convert the disk image to read-only"
114 hdiutil convert temp.dmg -format UDZO -o moonshotclientsoftware.dmg 
115 #rm temp.dmg
116 echo "All Done"