Commit | Line | Data |
---|---|---|
01ad1437 | 1 | #!/bin/bash -v |
6a488035 TO |
2 | set -e |
3 | ||
4 | # This is distmaker script for CiviCRM | |
5 | # Author: michau | |
6 | # "Protected by an electric fence and copyright control." | |
7 | # Thanks to Kleptones for moral support when writing this. | |
8 | ||
9 | # Make sure that you have distmaker.conf file | |
10 | # in the same directory containing following lines: | |
11 | # | |
12 | # DM_SOURCEDIR=/home/user/svn/civicrm <- sources | |
13 | # DM_GENFILESDIR=/home/user/generated <- generated files | |
14 | # DM_TMPDIR=/tmp <- temporary files (will be deleted afterwards) | |
15 | # DM_TARGETDIR=/tmp/outdir <- target dir for tarballs | |
16 | # DM_PHP=/opt/php5/bin/php <- php5 binary | |
17 | # DM_RSYNC=/usr/bin/rsync <- rsync binary | |
18 | # DM_VERSION=trunk.r1234 <- what the version number should be | |
19 | # DM_ZIP=/usr/bin/zip <- zip binary | |
20 | # | |
21 | # | |
22 | # ======================================================== | |
23 | # DO NOT MODIFY BELOW | |
24 | # ======================================================== | |
25 | ||
26 | ||
27 | # Where are we called from? | |
28 | P=`dirname $0` | |
29 | # Current dir | |
30 | ORIGPWD=`pwd` | |
31 | ||
ee752347 | 32 | # List of files to exclude from all tarballs |
829de0c0 | 33 | DM_EXCLUDES=".git .svn packages/_ORIGINAL_ packages/SeleniumRC packages/PHPUnit packages/PhpDocumentor packages/SymfonyComponents packages/amavisd-new packages/git-footnote" |
ee752347 TO |
34 | for DM_EXCLUDE in $DM_EXCLUDES ; do |
35 | DM_EXCLUDES_RSYNC="--exclude=${DM_EXCLUDE} ${DM_EXCLUDES_RSYNC}" | |
36 | done | |
37 | ## Note: These small folders have items that previously were not published, | |
38 | ## but there's no real cost to including them, and excluding them seems | |
39 | ## likely to cause confusion as the codebase evolves: | |
40 | ## packages/Files packages/PHP packages/Text | |
41 | export DM_EXCLUDES DM_EXCLUDES_RSYNC | |
42 | ||
6a488035 TO |
43 | # Set no actions by default |
44 | D5PACK=0 | |
45 | D56PACK=0 | |
46 | J5PACK=0 | |
47 | WP5PACK=0 | |
48 | SK5PACK=0 | |
49 | L10NPACK=0 | |
50 | ||
51 | # Display usage | |
52 | display_usage() | |
53 | { | |
54 | echo | |
55 | echo "Usage: " | |
56 | echo " distmaker.sh OPTION" | |
57 | echo | |
58 | echo "Options available:" | |
59 | echo " all - generate all available tarballs" | |
60 | echo " l10n - generate internationalization data" | |
61 | echo " d5 - generate Drupal7 PHP5 module" | |
62 | echo " d5.6 - generate Drupal6 PHP5 module" | |
63 | echo " j5 - generate Joomla PHP5 module" | |
64 | echo " wp5 - generate Wordpress PHP5 module" | |
65 | echo " sk - generate Drupal StarterKit module" | |
66 | echo | |
67 | echo "You also need to have distmaker.conf file in place." | |
68 | echo "See distmaker.conf.dist for example contents." | |
69 | echo | |
70 | } | |
71 | ||
72 | ||
73 | # Check if config is ok. | |
74 | check_conf() | |
75 | { | |
76 | # Test for distmaker.conf file availability, cannot proceed without it anyway | |
77 | if [ ! -f $P/distmaker.conf ] ; then | |
78 | echo; echo "ERROR! No distmaker.conf file available!"; echo; | |
79 | display_usage | |
80 | exit 1 | |
81 | else | |
82 | source "$P/distmaker.conf" | |
83 | export DM_SOURCEDIR DM_GENFILESDIR DM_TMPDIR DM_TARGETDIR DM_PHP DM_RSYNC DM_ZIP DM_VERSION DM_REF_CORE DM_REF_DRUPAL DM_REF_DRUPAL6 DM_REF_JOOMLA DM_REF_WORDPRESS DM_REF_PACKAGES | |
84 | for k in "$DM_SOURCEDIR" "$DM_GENFILESDIR" "$DM_TARGETDIR" "$DM_TMPDIR"; do | |
85 | if [ ! -d "$k" ] ; then | |
86 | echo; echo "ERROR! " $k "directory not found!"; echo "(if you get empty directory name, it might mean that one of necessary variables is not set)"; echo; | |
87 | exit 1 | |
88 | fi | |
89 | done | |
90 | fi | |
91 | } | |
92 | ||
93 | # Check if PHP4 converstion happened | |
94 | check_php4() | |
95 | { | |
96 | if [ ! $PHP4GENERATED = 1 ]; then | |
97 | echo; echo "ERROR! Cannot package PHP4 version without running conversion!"; echo; | |
98 | exit 1 | |
99 | fi | |
100 | } | |
101 | ||
102 | # Let's go. | |
103 | ||
104 | check_conf | |
105 | ||
106 | # Figure out what to do | |
107 | case $1 in | |
108 | # L10N PHP5 | |
109 | l10n) | |
110 | echo; echo "Generating L10N module"; echo; | |
111 | L10NPACK=1 | |
112 | ;; | |
113 | ||
114 | # DRUPAL7 PHP5 | |
115 | d5) | |
116 | echo; echo "Generating Drupal7 PHP5 module"; echo; | |
117 | D5PACK=1 | |
118 | ;; | |
119 | ||
120 | # DRUPAL7 PHP5 StarterKit package | |
121 | sk) | |
122 | echo; echo "Generating Drupal7 PHP5 starter kit minimal module"; echo; | |
123 | SKPACK=1 | |
124 | ;; | |
125 | ||
126 | # DRUPAL6 PHP5 | |
127 | d5.6) | |
128 | echo; echo "Generating Drupal6 PHP5 module"; echo; | |
129 | D56PACK=1 | |
130 | ;; | |
131 | ||
132 | # JOOMLA PHP5 | |
133 | j5) | |
134 | echo; echo "Generating Joomla PHP5 module"; echo; | |
135 | J5PACK=1 | |
136 | ;; | |
137 | ||
138 | # WORDPRESS PHP5 | |
139 | wp5) | |
140 | echo; echo "Generating Wordpress PHP5 module"; echo; | |
141 | WP5PACK=1 | |
142 | ;; | |
143 | ||
144 | # ALL | |
145 | all) | |
146 | echo; echo "Generating all we've got."; echo; | |
147 | D5PACK=1 | |
148 | D56PACK=1 | |
149 | J5PACK=1 | |
150 | WP5PACK=1 | |
151 | SKPACK=1 | |
152 | L10NPACK=1 | |
153 | ;; | |
154 | ||
155 | # USAGE | |
156 | *) | |
157 | display_usage | |
158 | exit 0 | |
159 | ;; | |
160 | ||
161 | esac | |
162 | ||
bed96570 TO |
163 | ## Make sure we have the right branch or tag |
164 | pushd "$DM_SOURCEDIR" | |
165 | git checkout "$DM_REF_CORE" | |
166 | popd | |
167 | pushd "$DM_SOURCEDIR/packages" | |
168 | git checkout "$DM_REF_PACKAGES" | |
169 | popd | |
170 | ## in theory, this shouldn't matter, but GenCode is CMS-dependent, and we've been doing our past builds based on D7 | |
171 | pushd "$DM_SOURCEDIR/drupal" | |
172 | git checkout "$DM_REF_DRUPAL" | |
173 | popd | |
6a488035 TO |
174 | |
175 | # Before anything - regenerate DAOs | |
176 | ||
177 | cd $DM_SOURCEDIR/xml | |
178 | $DM_PHP GenCode.php schema/Schema.xml $DM_VERSION | |
179 | ||
180 | cd $ORIGPWD | |
181 | ||
182 | if [ "$L10NPACK" = 1 ]; then | |
183 | echo; echo "Packaging for L10N"; echo; | |
184 | bash $P/dists/l10n.sh | |
185 | fi | |
186 | ||
187 | if [ "$D56PACK" = 1 ]; then | |
188 | echo; echo "Packaging for Drupal6, PHP5 version"; echo; | |
189 | bash $P/dists/drupal6_php5.sh | |
190 | fi | |
191 | ||
192 | if [ "$D5PACK" = 1 ]; then | |
193 | echo; echo "Packaging for Drupal7, PHP5 version"; echo; | |
194 | bash $P/dists/drupal_php5.sh | |
195 | fi | |
196 | ||
197 | if [ "$SKPACK" = 1 ]; then | |
198 | echo; echo "Packaging for Drupal7, PHP5 StarterKit version"; echo; | |
199 | bash $P/dists/drupal_sk_php5.sh | |
200 | fi | |
201 | ||
202 | if [ "$J5PACK" = 1 ]; then | |
203 | echo; echo "Packaging for Joomla, PHP5 version"; echo; | |
204 | bash $P/dists/joomla_php5.sh | |
205 | fi | |
206 | ||
207 | if [ "$WP5PACK" = 1 ]; then | |
208 | echo; echo "Packaging for Wordpress, PHP5 version"; echo; | |
209 | bash $P/dists/wordpress_php5.sh | |
210 | fi | |
211 | ||
212 | unset DM_SOURCEDIR DM_GENFILESDIR DM_TARGETDIR DM_TMPDIR DM_PHP DM_RSYNC DM_VERSION DM_ZIP | |
213 | echo;echo "DISTMAKER Done.";echo; |