~drgeo-developers/drgeo/trunk

« back to all changes in this revision

Viewing changes to build/makeDrGeo.sh

  • Committer: Hilaire Fernandes
  • Date: 2022-08-07 09:13:17 UTC
  • Revision ID: hilaire.fernandes@gmail.com-20220807091317-opx63i09orzh0hze
Clean up and build

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# Release number
 
4
rel="19.09b"
 
5
 
 
6
# To build Dr. Geo we need:
 
7
# A virgin image, its source, the virtual machine, the Smalltalk
 
8
# installation script and the DrGeo source code repository
 
9
smalltalkImage="Pharo8.0-SNAPSHOT-64bit-278304f"
 
10
smalltalkSources="Pharo8.0-32bit-278304f.sources"
 
11
vmExec="`pwd`/VMs/gnulinux/DrGeo64bits/Contents/vm/pharo"
 
12
installScript="`pwd`/install-drgeo-workstation.st"
 
13
src="tonel:///home/hilaire/Travaux/Developpement/DrGeoII/trunk/src"
 
14
 
 
15
# Path
 
16
buildPath="`pwd`/images"
 
17
docPath="../doc"
 
18
installationPath="bundles"
 
19
 
 
20
buildImage () {
 
21
    # PRE-CLEAN UP because Pharo is confused with its own cache
 
22
    rm -rf $buildPath/pharo-local $buildPath/package-cache
 
23
 
 
24
    # INSTALL PACKAGE AND CLEAN UP IMAGE
 
25
    # prepare the drgeo image
 
26
    cp $buildPath/$smalltalkImage.image $buildPath/drgeo.image
 
27
    cp $buildPath/$smalltalkImage.changes $buildPath/drgeo.changes
 
28
    # install source code in the drgeo image
 
29
    $vmExec $buildPath/drgeo.image metacello install $src \
 
30
            BaselineOfDrGeo --groups=development
 
31
    # configure the drgeo image
 
32
    $vmExec $buildPath/drgeo.image $installScript
 
33
    ls -lh $buildPath/$smalltalkImage.image
 
34
    echo "--== DONE building DrGeo image ==--"    
 
35
}
 
36
 
 
37
makeBundle () {
 
38
    # $1 OS target (gnulinux windows mac)
 
39
    # Empty the bundle space
 
40
    bundlePath="$installationPath/$1"
 
41
    if [[ "$1" == "gnulinux" || "$1" == "windows" ]]
 
42
    then
 
43
        bundle="$bundlePath/DrGeo"
 
44
    else
 
45
        bundle="$bundlePath/DrGeo.app"
 
46
    fi
 
47
    bundleTemplate="`pwd`/VMs/$1"
 
48
    
 
49
    rm -rf $bundlePath
 
50
    # install template
 
51
    rsync -a --exclude '.bzr' --exclude '*~' $bundleTemplate $installationPath
 
52
    cp ../doc/ChangeLog $bundle
 
53
    # install Example files
 
54
    rsync -a --exclude '.bzr' "`pwd`/examples" $bundle
 
55
    rsync -a --exclude '.bzr' "`pwd`/examplesKids/"* $bundle/examples
 
56
    # install Smalltalk sketches files
 
57
    rsync -a --exclude '.bzr' "`pwd`/SmalltalkSketches" $bundle
 
58
    # user sketches and exports folder, splash
 
59
    mkdir $bundle/MySketches
 
60
    mkdir $bundle/MyExports
 
61
    mkdir $bundle/MyShares
 
62
    mkdir $bundle/MyScripts
 
63
    rsync -a graphics/splash.bmp $bundle
 
64
    # install Smalltalk Image
 
65
    rsync -a $buildPath/drgeo.image $bundle/Contents/Resources
 
66
    rsync -a $buildPath/drgeo.changes $bundle/Contents/Resources
 
67
    # install Smalltalk Source
 
68
    rsync -a $buildPath/$smalltalkSources $bundle/Contents/Resources
 
69
    # install fonts
 
70
    rsync -a fonts/*.tt? $bundle/Contents/Resources
 
71
    # install the locales
 
72
    rsync -a ../i18n/locale $bundle/Contents/Resources
 
73
    # install doc
 
74
    mkdir $bundle/doc
 
75
    cp $docPath/README.*.txt $docPath/README.txt $bundle/doc
 
76
    mkdir $bundle/doc/userGuide
 
77
    cp $docPath/userGuide/fr/drgeoText/*.txt $bundle/doc/userGuide
 
78
    
 
79
    # set exec flag
 
80
    if [[ "$1" == "gnulinux" ]]
 
81
    then
 
82
        chmod +x $bundle/DrGeo.sh
 
83
        chmod +x $bundle/Contents/vm/pharo
 
84
    elif [[ "$1" == "mac" ]]
 
85
    then
 
86
        chmod +x $bundle/Contents/MacOS/Pharo
 
87
    fi
 
88
 
 
89
    # Create an archive out of the bundle
 
90
    cd $bundlePath
 
91
    zip -r --symlinks -qdgds 5m DrGeo-$1-$rel.zip "`basename $bundle`" -x \*/.bzr/* \*~
 
92
    ls -sh DrGeo-$1-$rel.zip
 
93
    echo "--== DONE packaging DrGeo for $1 ==--"
 
94
    echo -n "Signing..."
 
95
    gpg --armor --sign --detach-sign DrGeo-$1-$rel.zip
 
96
    echo "...done."
 
97
    cd -
 
98
}
 
99
 
 
100
# Option
 
101
# Build image:
 
102
# $1 = --build
 
103
# Package from an already built image:
 
104
# $1 = --package , $2 = all | gnulinux | windows | mac
 
105
# Build image and package all bundles:
 
106
# $1 = --all
 
107
case "$1" in
 
108
    --build)
 
109
        buildImage
 
110
        ;;
 
111
    --package)
 
112
        case "$2" in
 
113
            all)
 
114
                makeBundle "gnulinux"
 
115
                makeBundle "windows"
 
116
                makeBundle "mac"
 
117
                ;;
 
118
            gnulinux)
 
119
                makeBundle "gnulinux"
 
120
                ;;
 
121
            windows)
 
122
                makeBundle "windows"
 
123
                ;;
 
124
            mac)
 
125
                makeBundle "mac"
 
126
                ;;
 
127
            *)
 
128
                echo -e "Unknow \"$2\" --package argument.\nValid arguments are gnulinux, windows, mac."
 
129
                ;;
 
130
        esac
 
131
        ;;
 
132
    --all)
 
133
        buildImage
 
134
        makeBundle "gnulinux"
 
135
        makeBundle "windows"
 
136
        makeBundle "mac"        
 
137
        ;;
 
138
    --help|*)
 
139
        echo "Usage: makeDrGeo [OPTION] [ARGUMENT]"
 
140
        echo
 
141
        echo -e "--build\t\t\t\t\tBuild Dr. Geo image"
 
142
        echo -e "--package all|gnulinux|windows|mac\tPackage Dr.Geo with an already built image"
 
143
        echo -e "--all\t\t\t\t\tBuild image and package for all OS"
 
144
        ;;
 
145
esac