File buildroundcubemailtarball.sh of Package roundcubemail-selfcontained
#!/bin/bash
set -e
set -x
VERSION=1.5
GIT_REF=dev/kolab-$VERSION
PLUGINS_GIT_REF=master
NAME=roundcubemail-$VERSION
source buildroundcubemailtarball.config
ROOT_DIR=$(pwd)
rm -Rf /tmp/$NAME
mkdir /tmp/$NAME
cd /tmp/$NAME
cat << EOF > ./composer.json
{
"name": "roundcube/roundcubemail",
"description": "The Roundcube Webmail suite",
"license": "GPL-3.0+",
"config": {
"platform": {
"php": "7.2.24"
},
"allow-plugins": {
"roundcube/plugin-installer": true
}
},
"repositories": [
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_activesync",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_addressbook",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_auth",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_config",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_delegation",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_files",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_folders",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_notes",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_tags",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_chat",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/odfviewer",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/pdfviewer",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/tasklist",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/calendar",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libcalendaring",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/libkolab",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_2fa",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/logon_page",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/nextcloud_link",
"options": {
"symlink": false
}
},
{
"type": "path",
"url": "$PWD/roundcubemail-plugins-kolab-latest/plugins/kolab_sso",
"options": {
"symlink": false
}
},
{
"type": "vcs",
"url": "https://git.kolab.org/diffusion/PNL/php-net_ldap.git"
},
{
"type": "composer",
"url": "https://plugins.roundcube.net"
}
],
"require": {
"php": ">=7.2.0",
"caxy/php-htmldiff": "0.1.9",
"pear/pear-core-minimal": "~1.10.1",
"pear/auth_sasl": "~1.1.0",
"pear/mail_mime": "~1.10.0",
"pear/http_request2": "~2.5.0",
"pear/net_smtp": "~1.10.0",
"pear/crypt_gpg": "~1.6.3",
"pear/net_sieve": "~1.4.5",
"roundcube/plugin-installer": "~0.2.0",
"roundcube/rtf-html-php": "~2.1",
"masterminds/html5": "~2.7.0",
"endroid/qr-code": "~1.6.5",
"guzzlehttp/guzzle": "^6.5.5",
"kolab/calendar": "~3.5.11",
"kolab/kolab_activesync": "~3.5.6",
"kolab/kolab_addressbook": "~3.5.6",
"kolab/kolab_auth": "~3.5.6",
"kolab/kolab_chat": "~3.5.2",
"kolab/kolab_config": "~3.4.0",
"kolab/kolab_delegation": "~3.5.11",
"kolab/kolab_files": "~3.5.2",
"kolab/kolab_folders": "~3.5.2",
"kolab/kolab_notes": "~3.5.5",
"kolab/kolab_tags": "~3.5.2",
"kolab/net_ldap3": "dev-master",
"kolab/odfviewer": "~3.4.0",
"kolab/pdfviewer": "~3.4.0",
"kolab/tasklist": "~3.5.10",
"kolab/kolab_2fa": "~3.5.11",
"kolab/kolab_sso": "~3.5.4",
"kolab/logon_page": "~3.4.2",
"kolab/nextcloud_link": "~1.0",
"johndoh/contextmenu": "~3.2.1",
"zf1/zend-json": "~1.12.11",
"zf1/zend-log": "~1.12.11",
"zf1/zend-controller": "~1.12.11",
"sabre/vobject" : "~4.5.1",
"sabre/dav" : "~4.0",
"sabre/http" : "~5.0",
"smarty/smarty" : "~3.1.7",
"monolog/monolog": "1.2.*",
"desarrolla2/cache": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^5.7.21",
"phpstan/phpstan": "^1.4",
"squizlabs/php_codesniffer": "^3.6",
"phpcompatibility/php-compatibility": "^9.3"
},
"suggest": {
"mkopinsky/zxcvbn-php": "^4.4.2 required for Zxcvbn password strength driver"
}
}
EOF
rm -f $NAME.tar.gz
[ -d "$NAME" ] && rm -rf "$NAME"
git clone --branch dev/kolab-1.5 https://git.kolab.org/source/roundcubemail.git $NAME
pushd $NAME
git reset --hard $GIT_REF
popd
[ -d roundcubemail-skin-elastic ] && rm -rf roundcubemail-skin-elastic
git clone --branch master ssh://git@git.kolab.org/source/roundcubemail-skin-elastic.git roundcubemail-skin-elastic
[ -d roundcubemail-skin-chameleon ] && rm -rf roundcubemail-skin-chameleon
git clone ssh://git.kolab.org/diffusion/RSC/roundcubemail-skin-chameleon.git roundcubemail-skin-chameleon
[ -d roundcubemail-skin-chameleon-assets ] && rm -rf roundcubemail-skin-chameleon-assets
git clone ssh://git@git.kolab.org/diffusion/RSCA/roundcubemail-skin-chameleon-assets.git roundcubemail-skin-chameleon-assets
[ -d roundcubemail-plugins-kolab-latest ] && rm -rf roundcubemail-plugins-kolab-latest
git clone --branch master ssh://git@git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git roundcubemail-plugins-kolab-latest
pushd roundcubemail-plugins-kolab-latest
git reset --hard $PLUGINS_GIT_REF
popd
# Run composer and other install processes
mv composer.json $NAME/composer.json
pushd $NAME
# Avoid running the roundcubemail plugin installer (we're not installing on this system)
composer install
bin/install-jsdeps.sh
# Install build deps
npm install less less-plugin-clean-css --save-dev
LESSC="$(pwd)/node_modules/less/bin/lessc"
# May require an "npm install less" and "npm install less-plugin-clean-css"
pushd skins/elastic
$LESSC -x styles/styles.less > styles/styles.css
$LESSC -x styles/print.less > styles/print.css
$LESSC -x styles/embed.less > styles/embed.css
popd
$LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/elastic/libkolab.less > plugins/libkolab/skins/elastic/libkolab.min.css
bin/updatecss.sh --dir skins/elastic
popd
# Install skins
for skin in "${SKINS[@]}"; do
if [ -d "roundcubemail-skin-elastic/$skin" ]; then
cp -r "roundcubemail-skin-elastic/$skin" $NAME/skins/
fi
if [ -d "roundcubemail-skin-chameleon-assets/skins/$skin" ]; then
cp -r "roundcubemail-skin-chameleon/skins/chameleon" "$NAME/skins/$skin"
cp -r "roundcubemail-skin-chameleon-assets/skins/$skin/." "$NAME/skins/$skin"
fi
done
pushd $NAME
# This is for chameleon skins (just now-larry atm)
for skin in $(ls -1d skins/* | grep -E '(now-larry)'); do
skin=$(basename $skin)
pushd skins/$skin
$LESSC -x styles.less > styles.css
$LESSC -x colors.less > colors.css
popd
bin/updatecss.sh --dir skins/$skin
done
# This is for all elastic skins
for skin in $(ls -1d skins/* | grep -vE '(classic|elastic|larry|now-larry)'); do
skin=$(basename $skin)
# Copy elastic skin over $skin (but don't overwrite what already existis)
find \
./skins/elastic/ \
./plugins/libkolab/skins/elastic/ \
-type f | sort | while read file; do
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")
file_name=$(basename ${file})
echo "Target: $target_dir, file $file_name"
if [ ! -d ${target_dir} ]; then
mkdir -p ${target_dir}
fi
if [ ! -f "${target_dir}/${file_name}" ]; then
cp -av "${file}" "${target_dir}"
fi
done
# Replace elastic references, but don't change the depends value in meta.json
sed -i -e "s/\"elastic\"/\"$skin\"/g" \
$(find skins/$skin/ plugins/libkolab/skins/$skin/ -type f -not -name "meta.json")
pushd skins/$skin
$LESSC -x styles/styles.less > styles/styles.css
$LESSC -x styles/print.less > styles/print.css
$LESSC -x styles/embed.less > styles/embed.css
popd
$LESSC --clean-css="--s1 --advanced" --rewrite-urls=all plugins/libkolab/skins/$skin/libkolab.less > plugins/libkolab/skins/$skin/libkolab.min.css
#find . | sort
# Compile and compress the CSS
#for file in `find . -type f -name "styles.less" -o -name "print.less" -o -name "embed.less" -o -name "libkolab.less"`; do
# %{_bindir}/lessc --relative-urls ${file} > $(dirname ${file})/$(basename ${file} .less).css
#
# sed -i \
# -e "s|../../../skins/plesk/images/contactpic.png|../../../../skins/plesk/images/contactpic.png|" \
# -e "s|../../../skins/plesk/images/watermark.jpg|../../../../skins/plesk/images/watermark.jpg|" \
# $(dirname ${file})/$(basename ${file} .less).css
#
# cat $(dirname ${file})/$(basename ${file} .less).css
#done
bin/updatecss.sh --dir skins/$skin
done
# Cleanup
npm uninstall --save-dev less less-plugin-clean-css
popd
# Uncomment to run phpstan
# pushd $NAME
# cat << EOF > ./phpstan.neon
# includes:
# parameters:
# level: 0
# parallel:
# processTimeout: 300.0
# ignoreErrors:
# - '#Access to an undefined property#'
# excludePaths:
# analyse:
# - program/
# - skins/
# paths:
# - program/include/
# - program/lib/
# - program/lib/Roundcube/
# - plugins/libkolab
# EOF
# php -dmemory_limit=500M vendor/bin/phpstan analyse
# popd
# [ -d chwala ] && rm -rf chwala
# git clone --branch master ssh://git@git.kolab.org/diffusion/C/chwala.git chwala
# pushd chwala
# mkdir -p lib/ext
# ln -s ../../../$NAME/program/lib/Roundcube lib/ext/Roundcube
# ln -s ../../../../$NAME/plugins lib/drivers/kolab/plugins
# ln -s ../$NAME/vendor vendor
# php -dmemory_limit=500M vendor/bin/phpstan analyse
# popd
# [ -d irony ] && rm -rf irony
# git clone --branch master ssh://git@git.kolab.org/diffusion/rI/iRony.git irony
# pushd irony
# ln -s ../chwala/lib FileAPI
# ln -s ../$NAME/program/lib/Roundcube Roundcube
# ln -s ../$NAME/plugins plugins
# ln -s ../$NAME/vendor vendor
# php -dmemory_limit=500M vendor/bin/phpstan analyse
# popd
# [ -d syncroton ] && rm -rf syncroton
# git clone --branch master ssh://git@git.kolab.org/diffusion/S/syncroton.git syncroton
# pushd syncroton
# mkdir -p lib/ext
# ln -s ../../../$NAME/program/lib/Roundcube lib/ext/Roundcube
# ln -s ../../$NAME/plugins lib/plugins
# ln -s ../$NAME/vendor vendor
# cat << EOF > ./phpstan.neon
# includes:
# parameters:
# level: 0
# parallel:
# processTimeout: 300.0
# ignoreErrors:
# - '#Function console not found#'
# paths:
# - lib/
# EOF
# php -dmemory_limit=500M vendor/bin/phpstan analyse
# popd
tar --exclude="$NAME/.git" -czf "$ROOT_DIR/$NAME.tar.gz" $NAME
cd "$PWD"