File buildroundcubemailtarball.sh of Package roundcubemail-selfcontained (Revision 86)

Currently displaying revision 86 , Show latest

430
 
1
#!/bin/bash
2
3
set -e
4
set -x
5
6
VERSION=1.6
7
GIT_REF=dev/kolab-$VERSION
8
PLUGINS_GIT_REF=master
9
NAME=roundcubemail-$VERSION
10
source buildroundcubemailtarball.config
11
12
ROOT_DIR=$(pwd)
13
14
rm -Rf /tmp/$NAME
15
mkdir /tmp/$NAME
16
cd /tmp/$NAME
17
18
cat << EOF > ./composer.json
19
{
20
    "name": "roundcube/roundcubemail",
21
    "description": "The Roundcube Webmail suite",
22
    "license": "GPL-3.0+",
23
    "config": {
24
        "platform": {
25
            "php": "7.2.24"
26
        },
27
        "allow-plugins": {
28
            "roundcube/plugin-installer": true
29
        }
30
    },
31
    "repositories": [
32
        {
33
            "type": "path",
34
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_activesync",
35
            "options": {
36
                "symlink": false
37
            }
38
        },
39
        {
40
            "type": "path",
41
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_addressbook",
42
            "options": {
43
                "symlink": false
44
            }
45
        },
46
        {
47
            "type": "path",
48
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_auth",
49
            "options": {
50
                "symlink": false
51
            }
52
        },
53
        {
54
            "type": "path",
55
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_config",
56
            "options": {
57
                "symlink": false
58
            }
59
        },
60
        {
61
            "type": "path",
62
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_delegation",
63
            "options": {
64
                "symlink": false
65
            }
66
        },
67
        {
68
            "type": "path",
69
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_files",
70
            "options": {
71
                "symlink": false
72
            }
73
        },
74
        {
75
            "type": "path",
76
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_folders",
77
            "options": {
78
                "symlink": false
79
            }
80
        },
81
        {
82
            "type": "path",
83
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_notes",
84
            "options": {
85
                "symlink": false
86
            }
87
        },
88
        {
89
            "type": "path",
90
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_tags",
91
            "options": {
92
                "symlink": false
93
            }
94
        },
95
        {
96
            "type": "path",
97
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_chat",
98
            "options": {
99
                "symlink": false
100
            }
101
        },
102
        {
103
            "type": "path",
104
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/odfviewer",
105
            "options": {
106
                "symlink": false
107
            }
108
        },
109
        {
110
            "type": "path",
111
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/pdfviewer",
112
            "options": {
113
                "symlink": false
114
            }
115
        },
116
        {
117
            "type": "path",
118
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/tasklist",
119
            "options": {
120
                "symlink": false
121
            }
122
        },
123
        {
124
            "type": "path",
125
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/calendar",
126
            "options": {
127
                "symlink": false
128
            }
129
        },
130
        {
131
            "type": "path",
132
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libcalendaring",
133
            "options": {
134
                "symlink": false
135
            }
136
        },
137
        {
138
            "type": "path",
139
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libkolab",
140
            "options": {
141
                "symlink": false
142
            }
143
        },
144
        {
145
            "type": "path",
146
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_2fa",
147
            "options": {
148
                "symlink": false
149
            }
150
        },
151
        {
152
            "type": "path",
153
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/logon_page",
154
            "options": {
155
                "symlink": false
156
            }
157
        },
158
        {
159
            "type": "path",
160
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/nextcloud_link",
161
            "options": {
162
                "symlink": false
163
            }
164
        },
165
        {
166
            "type": "path",
167
            "url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_sso",
168
            "options": {
169
                "symlink": false
170
            }
171
        },
172
        {
173
            "type": "vcs",
174
            "url": "https://git.kolab.org/diffusion/PNL/php-net_ldap.git"
175
        },
176
        {
177
            "type": "composer",
178
            "url": "https://plugins.roundcube.net"
179
        }
180
    ],
181
    "require": {
182
        "php": ">=7.2.0",
183
        "caxy/php-htmldiff": "0.1.9",
184
        "pear/pear-core-minimal": "~1.10.1",
185
        "pear/auth_sasl": "~1.1.0",
186
        "pear/mail_mime": "~1.10.0",
187
        "pear/http_request2": "~2.5.0",
188
        "pear/net_smtp": "~1.10.0",
189
        "pear/crypt_gpg": "~1.6.3",
190
        "pear/net_sieve": "~1.4.5",
191
        "roundcube/plugin-installer": "~0.2.0",
192
        "roundcube/rtf-html-php": "~2.1",
193
        "masterminds/html5": "~2.7.0",
194
        "endroid/qr-code": "~1.6.5",
195
        "guzzlehttp/guzzle": "^6.5.5",
196
        "kolab/calendar": "~3.5.11",
197
        "kolab/kolab_activesync": "~3.5.6",
198
        "kolab/kolab_addressbook": "~3.5.6",
199
        "kolab/kolab_auth": "~3.5.6",
200
        "kolab/kolab_chat": "~3.5.2",
201
        "kolab/kolab_config": "~3.4.0",
202
        "kolab/kolab_delegation": "~3.5.11",
203
        "kolab/kolab_files": "~3.5.2",
204
        "kolab/kolab_folders": "~3.5.2",
205
        "kolab/kolab_notes": "~3.5.5",
206
        "kolab/kolab_tags": "~3.5.2",
207
        "kolab/net_ldap3": "dev-master",
208
        "kolab/odfviewer": "~3.4.0",
209
        "kolab/pdfviewer": "~3.4.0",
210
        "kolab/tasklist": "~3.5.10",
211
        "kolab/kolab_2fa": "~3.5.11",
212
        "kolab/kolab_sso": "~3.5.4",
213
        "kolab/logon_page": "~3.4.2",
214
        "kolab/nextcloud_link": "~1.0",
215
        "johndoh/contextmenu": "~3.2.1",
216
        "zf1/zend-json": "~1.12.11",
217
        "zf1/zend-log": "~1.12.11",
218
        "zf1/zend-controller": "~1.12.11",
219
        "sabre/vobject" : "~4.5.1",
220
        "sabre/dav" : "~4.0",
221
        "sabre/http" : "~5.0",
222
        "smarty/smarty" : "~3.1.7",
223
        "monolog/monolog": "1.2.*",
224
        "desarrolla2/cache":  "dev-master"
225
    },
226
    "require-dev": {
227
        "phpunit/phpunit": "^4.8.36 || ^5.7.21",
228
        "phpstan/phpstan": "^1.4",
229
        "squizlabs/php_codesniffer": "^3.6",
230
        "phpcompatibility/php-compatibility": "^9.3"
231
    },
232
    "suggest": {
233
        "mkopinsky/zxcvbn-php": "^4.4.2 required for Zxcvbn password strength driver"
234
    }
235
}
236
EOF
237
238
rm -f $NAME.tar.gz
239
[ -d "$NAME" ] && rm -rf "$NAME"
240
git clone --branch $GIT_REF https://git.kolab.org/source/roundcubemail.git $NAME
241
pushd $NAME
242
git reset --hard $GIT_REF
243
popd
244
245
[ -d roundcubemail-skin-elastic ] && rm -rf roundcubemail-skin-elastic
246
git clone --branch master ssh://git@git.kolab.org/source/roundcubemail-skin-elastic.git roundcubemail-skin-elastic
247
248
[ -d roundcubemail-skin-chameleon ] && rm -rf roundcubemail-skin-chameleon
249
git clone ssh://git.kolab.org/diffusion/RSC/roundcubemail-skin-chameleon.git roundcubemail-skin-chameleon
250
[ -d roundcubemail-skin-chameleon-assets ] && rm -rf roundcubemail-skin-chameleon-assets
251
git clone ssh://git@git.kolab.org/diffusion/RSCA/roundcubemail-skin-chameleon-assets.git roundcubemail-skin-chameleon-assets
252
253
[ -d roundcubemail-plugins-kolab-latest ] && rm -rf roundcubemail-plugins-kolab-latest
254
git clone --branch master ssh://git@git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git roundcubemail-plugins-kolab-latest
255
pushd roundcubemail-plugins-kolab-latest
256
git reset --hard $PLUGINS_GIT_REF
257
popd
258
259
# Run composer and other install processes
260
mv composer.json $NAME/composer.json
261
pushd $NAME
262
# Avoid running the roundcubemail plugin installer (we're not installing on this system)
263
composer install
264
bin/install-jsdeps.sh
265
266
# Install build deps
267
npm install less less-plugin-clean-css --save-dev
268
LESSC="$(pwd)/node_modules/less/bin/lessc"
269
270
# May require an "npm install less" and "npm install less-plugin-clean-css"
271
pushd skins/elastic
272
$LESSC -x styles/styles.less > styles/styles.css
273
$LESSC -x styles/print.less > styles/print.css
274
$LESSC -x styles/embed.less > styles/embed.css
275
popd
276
277
$LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/elastic/libkolab.less > plugins/libkolab/skins/elastic/libkolab.min.css
278
279
bin/updatecss.sh --dir skins/elastic
280
281
popd
282
283
# Install skins
284
for skin in "${SKINS[@]}"; do
285
    if [ -d "roundcubemail-skin-elastic/$skin" ]; then
286
        cp -r "roundcubemail-skin-elastic/$skin" $NAME/skins/
287
    fi
288
    if [ -d "roundcubemail-skin-chameleon-assets/skins/$skin" ]; then
289
        cp -r "roundcubemail-skin-chameleon/skins/chameleon" "$NAME/skins/$skin"
290
        cp -r "roundcubemail-skin-chameleon-assets/skins/$skin/." "$NAME/skins/$skin"
291
    fi
292
done
293
294
pushd $NAME
295
296
# This is for chameleon skins (just now-larry atm)
297
for skin in $(ls -1d skins/* | grep -E '(now-larry)'); do
298
    skin=$(basename $skin)
299
300
    pushd skins/$skin
301
    $LESSC -x styles.less > styles.css
302
    $LESSC -x colors.less > colors.css
303
    popd
304
    bin/updatecss.sh --dir skins/$skin
305
done
306
307
# This is for all elastic skins
308
for skin in $(ls -1d skins/* | grep -vE '(classic|elastic|larry|now-larry)'); do
309
    skin=$(basename $skin)
310
311
    # Copy elastic skin over $skin (but don't overwrite what already existis)
312
    find \
313
        ./skins/elastic/ \
314
        ./plugins/libkolab/skins/elastic/ \
315
        -type f | sort | while read file; do
316
        target_dir=$(dirname ${file} | sed -e 's|%{datadir}|.|g' -e 's|./public_html/assets/|./|g' -e 's|./public_html/assets/plugins/libkolab/|./|g' -e "s/elastic/$skin/g")
317
        file_name=$(basename ${file})
318
        echo "Target: $target_dir, file $file_name"
319
        if [ ! -d ${target_dir} ]; then
320
            mkdir -p ${target_dir}
321
        fi
322
        if [ ! -f "${target_dir}/${file_name}" ]; then
323
            cp -av "${file}" "${target_dir}"
324
        fi
325
    done
326
327
    # Replace elastic references, but don't change the depends value in meta.json
328
    sed -i -e "s/\"elastic\"/\"$skin\"/g" \
329
        $(find skins/$skin/ plugins/libkolab/skins/$skin/ -type f -not -name "meta.json")
330
331
    pushd skins/$skin
332
    $LESSC -x styles/styles.less > styles/styles.css
333
    $LESSC -x styles/print.less > styles/print.css
334
    $LESSC -x styles/embed.less > styles/embed.css
335
    popd
336
    $LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/$skin/libkolab.less > plugins/libkolab/skins/$skin/libkolab.min.css
337
338
    #find . | sort
339
340
    # Compile and compress the CSS
341
    #for file in `find . -type f -name "styles.less" -o -name "print.less" -o -name "embed.less" -o -name "libkolab.less"`; do
342
    #    %{_bindir}/lessc --relative-urls ${file} > $(dirname ${file})/$(basename ${file} .less).css
343
    #
344
    #    sed -i \
345
    #        -e "s|../../../skins/plesk/images/contactpic.png|../../../../skins/plesk/images/contactpic.png|" \
346
    #        -e "s|../../../skins/plesk/images/watermark.jpg|../../../../skins/plesk/images/watermark.jpg|" \
347
    #        $(dirname ${file})/$(basename ${file} .less).css
348
    #
349
    #    cat $(dirname ${file})/$(basename ${file} .less).css
350
    #done
351
352
    bin/updatecss.sh --dir skins/$skin
353
done
354
355
# Cleanup
356
npm uninstall --save-dev less less-plugin-clean-css
357
358
popd
359
360
# Uncomment to run phpstan
361
# pushd $NAME
362
363
# cat << EOF > ./phpstan.neon
364
# includes:
365
# parameters:
366
#     level: 0
367
#     parallel:
368
#         processTimeout: 300.0
369
#     ignoreErrors:
370
#         - '#Access to an undefined property#'
371
#     excludePaths:
372
#         analyse:
373
#             - program/
374
#             - skins/
375
#     paths:
376
#         - program/include/
377
#         - program/lib/
378
#         - program/lib/Roundcube/
379
#         - plugins/libkolab
380
# EOF
381
382
# php -dmemory_limit=500M vendor/bin/phpstan analyse
383
384
# popd
385
386
# [ -d chwala ] && rm -rf chwala
387
# git clone --branch master ssh://git@git.kolab.org/diffusion/C/chwala.git chwala
388
# pushd chwala
389
# mkdir -p lib/ext
390
# ln -s ../../../$NAME/program/lib/Roundcube lib/ext/Roundcube
391
# ln -s ../../../../$NAME/plugins lib/drivers/kolab/plugins
392
# ln -s ../$NAME/vendor vendor
393
# php -dmemory_limit=500M vendor/bin/phpstan analyse
394
# popd
395
396
# [ -d irony ] && rm -rf irony
397
# git clone --branch master ssh://git@git.kolab.org/diffusion/rI/iRony.git irony
398
# pushd irony
399
# ln -s ../chwala/lib FileAPI
400
# ln -s ../$NAME/program/lib/Roundcube Roundcube
401
# ln -s ../$NAME/plugins plugins
402
# ln -s ../$NAME/vendor vendor
403
# php -dmemory_limit=500M vendor/bin/phpstan analyse
404
# popd
405
406
# [ -d syncroton ] && rm -rf syncroton
407
# git clone --branch master ssh://git@git.kolab.org/diffusion/S/syncroton.git syncroton
408
# pushd syncroton
409
# mkdir -p lib/ext
410
# ln -s ../../../$NAME/program/lib/Roundcube lib/ext/Roundcube
411
# ln -s ../../$NAME/plugins lib/plugins
412
# ln -s ../$NAME/vendor vendor
413
# cat << EOF > ./phpstan.neon
414
# includes:
415
# parameters:
416
#     level: 0
417
#     parallel:
418
#         processTimeout: 300.0
419
#     ignoreErrors:
420
#         - '#Function console not found#'
421
#     paths:
422
#         - lib/
423
# EOF
424
# php -dmemory_limit=500M vendor/bin/phpstan analyse
425
# popd
426
427
tar --exclude="$NAME/.git" -czf "$ROOT_DIR/$NAME.tar.gz" $NAME
428
429
cd "$PWD"
430