build all in docker

php
Marc Wäckerlin 9 years ago
parent af88fdd4fd
commit b3ea67b7d8
  1. 2
      COPYING
  2. 48
      ChangeLog
  3. 2
      INSTALL
  4. 25
      build-in-docker.conf
  5. 56
      build-in-docker.sh
  6. 4
      cordova/makefile.am
  7. 3
      cordova/platforms/android/AndroidManifest.xml
  8. 22
      cordova/platforms/android/assets/www/cordova_plugins.js
  9. 9
      cordova/platforms/android/res/xml/config.xml
  10. 9
      cordova/plugins/android.json
  11. 17
      cordova/plugins/fetch.json
  12. 46
      html/index.html.in

@ -1 +1 @@
/usr/share/automake-1.14/COPYING /usr/share/automake-1.15/COPYING

@ -1,3 +1,51 @@
2015-12-02 15:58 marc
* build-in-docker.conf, build-in-docker.sh,
resolve-debbuilddeps.sh: enhanced build in docker
2015-12-02 07:17 marc
* build-in-docker.conf: build requires universe for npm
2015-12-01 14:50 marc
* build-in-docker.conf, build-in-docker.sh, debian/control.in:
improved dependencies for more ubuntu support
2015-12-01 13:10 marc
* build-in-docker.conf: build everything in docker now, 2nd try
2015-12-01 12:17 marc
* bootstrap.sh, build-in-docker.conf, build-in-docker.sh,
configure.ac, makefile.am: build everithing in docker now
2015-11-25 15:25 marc
* build-in-docker.sh: allow add repositories (for cordova-cli)
2015-11-25 12:45 marc
* configure.ac, debian/control.in: install cordova from ubuntu ppa
2015-11-25 10:05 marc
* configure.ac, cordova/makefile.am, debian/control.in: fixes for
cordova
2015-11-25 08:57 marc
* ax_init_standard_project.m4, bootstrap.sh, configure.ac,
debian/control.in, sql-to-dot.sed: check for android and cordova
separately; depend on npm and nodejs for cordova
2015-11-20 14:05 marc
* ChangeLog, cordova/config.xml.in, cordova/makefile.am,
html/safechat.js, safechat.desktop.in: try to allow background
process
2015-11-09 22:34 marc 2015-11-09 22:34 marc
* html/documentation.dox, html/makefile.am: added missing doc * html/documentation.dox, html/makefile.am: added missing doc

@ -1 +1 @@
/usr/share/automake-1.14/INSTALL /usr/share/automake-1.15/INSTALL

@ -1,11 +1,22 @@
packages+=("wheezy:::curl:::npm") # if you have android, we need cordova plus more dependencies
packages+=("nodejs") # so we can build an android app
repos+=("Ubuntu:::universe")
repos+=("wheezy:::'deb http://ftp.is.debian.org/debian wheezy-backports main'")
commands+=("wheezy:::update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100")
commands+=("wheezy:::curl https://www.npmjs.com/install.sh | sh")
commands+=("npm install -g cordova")
if test -n "${ANDROID_HOME}"; then if test -n "${ANDROID_HOME}"; then
# all this is needed for android through cordova (phonegap) only
packages+=("wheezy:::curl:::npm")
packages+=("git nodejs default-jdk libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1")
repos+=("Ubuntu-precise:::'deb http://archive.ubuntu.com precise universe'")
repos+=("Debian|Ubuntu-precise::::::universe")
repos+=("wheezy:::'deb http://ftp.is.debian.org/debian wheezy-backports main'")
commands+=("update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100")
commands+=("wheezy:::curl https://www.npmjs.com/install.sh | sh")
commands+=("npm install -g cordova")
commands+=("chown $(id -u) ${HOME}")
commands+=("chown -R $(id -u) ${HOME}/.npm")
commands+=("useradd -d ${HOME} -u $(id -u) $(id -un)")
envs+=("-e ANDROID_HOME=${ANDROID_HOME}") envs+=("-e ANDROID_HOME=${ANDROID_HOME}")
envs+=("-e HOME=${HOME}")
envs+=("-e TERM=xterm")
dirs+=("-v ${ANDROID_HOME}:${ANDROID_HOME}:ro") dirs+=("-v ${ANDROID_HOME}:${ANDROID_HOME}:ro")
dirs+=("-v ${HOME}/.gnupg:${HOME}/.gnupg:ro")
dirs+=("-v ${HOME}/.android:${HOME}/.android:ro")
fi fi

@ -1,4 +1,5 @@
#! /bin/bash -e #! /bin/bash -e
set -o errtrace
# build and test everything in a fresh docker installation # build and test everything in a fresh docker installation
img="ubuntu:latest" img="ubuntu:latest"
@ -39,10 +40,10 @@ while test $# -gt 0; do
echo " <os>:::<A>" echo " <os>:::<A>"
echo " Read as: On linux type <os> use <A> else use <B>" echo " Read as: On linux type <os> use <A> else use <B>"
echo " That means: If the distributer ID or codename in lsb_release" echo " That means: If the distributer ID or codename in lsb_release"
echo " matches <os>, then <A> is replaced, else <B> is replaced." echo " matches regular expression <os>, then <A> is replaced, else <B> is replaced."
echo " The three colons are for splitting <os> from <A> and <B> part." echo " The three colons are for splitting <os> from <A> and <B> part."
echo " E.g.: Install package curl on wheezy and npm on olter systems:" echo " E.g.: Install package curl on wheezy and npm on olter systems:"
echo " $0 -p wheezy:::curl:::npm" echo " $0 -p Debian|precise:::curl:::npm"
echo echo
echo "EXAMPLE:" echo "EXAMPLE:"
echo echo
@ -93,6 +94,38 @@ while test $# -gt 0; do
shift shift
done done
function traperror() {
set +x
local DOCKER_ID="$1"
local err=($2) # error status
local line="$3" # LINENO
local linecallfunc="$4"
local command="$5"
local funcstack="$6"
for e in ${err[@]}; do
if test -n "$e" -a "$e" != "0"; then
echo "<---"
echo "ERROR: line $line - command '$command' exited with status: $e (${err[@]})"
if [ "${funcstack}" != "main" -o "$linecallfunc" != "0" ]; then
echo -n " ... Error at ${funcstack} "
if [ "$linecallfunc" != "" ]; then
echo -n "called at line $linecallfunc"
fi
echo
fi
echo "**** Entering docker container ${DOCKER_ID}, exit with Ctrl-D"
echo -n " ... cleanup docker: "
docker rm -f "${DOCKER_ID}"
echo "returning status: $e"
echo "--->"
exit $e
fi
done
echo -n " SUCCESS ... cleanup docker: "
docker rm -f "${DOCKER_ID}"
exit 0
}
function ifthenelse() { function ifthenelse() {
arg="$1" arg="$1"
shift shift
@ -103,24 +136,29 @@ function ifthenelse() {
os="${arg%%:::*}" os="${arg%%:::*}"
thenpart="${arg#*:::}" thenpart="${arg#*:::}"
if test "${thenpart/:::/}" = "${thenpart}"; then if test "${thenpart/:::/}" = "${thenpart}"; then
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if test "${os//$(lsb_release -is)/}${os//$(lsb_release -cs)/}" != "${os}${os}"; then '"${cmd//ARG/${thenpart}}"'; fi' docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi'
else else
elsepart="${thenpart##*:::}" elsepart="${thenpart##*:::}"
thenpart="${thenpart%:::*}" thenpart="${thenpart%:::*}"
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if test "${os//$(lsb_release -is)/}${os//$(lsb_release -cs)/}" != "${os}${os}"; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' if test -n "${thenpart}"; then
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi'
else
docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi'
fi
fi fi
fi fi
} }
set -x set -x
docker pull $img
DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity) DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity)
trap "docker rm -f ${DOCKER_ID}" INT TERM EXIT trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT
docker exec ${DOCKER_ID} apt-get update docker exec ${DOCKER_ID} apt-get update
docker exec ${DOCKER_ID} apt-get upgrade -y --force-yes docker exec ${DOCKER_ID} apt-get upgrade -y
if ! docker exec ${DOCKER_ID} apt-get install -y --force-yes python-software-properties apt-transport-https dpkg-dev lsb-release; then docker exec ${DOCKER_ID} apt-get install -y python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release || \
docker exec ${DOCKER_ID} apt-get install -y --force-yes software-properties-common apt-transport-https dpkg-dev lsb-release docker exec ${DOCKER_ID} apt-get install -y software-properties-common apt-transport-https dpkg-dev lsb-release || \
fi docker exec ${DOCKER_ID} apt-get install -y python-software-properties apt-transport-https dpkg-dev lsb-release;
for repo in "${repos[@]}"; do for repo in "${repos[@]}"; do
ifthenelse "${repo}" "apt-add-repository ARG" ifthenelse "${repo}" "apt-add-repository ARG"
done done

@ -19,13 +19,13 @@ ${ANDROID_SRC}:
( cp -r "@srcdir@/$${file}" "$${file}" && \ ( cp -r "@srcdir@/$${file}" "$${file}" && \
chmod -R u+w "$${file}" ); \ chmod -R u+w "$${file}" ); \
done done
if [ "$$(whoami)" != "root" ]; then \ if [ "$$(whoami 2> /dev/null)" != "root" ]; then \
${CORDOVA} plugin add https://github.com/katzer/cordova-plugin-background-mode.git; \ ${CORDOVA} plugin add https://github.com/katzer/cordova-plugin-background-mode.git; \
${CORDOVA} build --debug || ${CORDOVA} build --debug; \ ${CORDOVA} build --debug || ${CORDOVA} build --debug; \
fi fi
${ANDROID}: ${ANDROID_SRC} ${ANDROID}: ${ANDROID_SRC}
if [ "$$(whoami)" != "root" ]; then \ if [ "$$(whoami 2> /dev/null)" != "root" ]; then \
cp $< $@; \ cp $< $@; \
fi fi

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="346" android:versionName="0.3.46" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android"> <manifest android:hardwareAccelerated="true" android:versionCode="359" android:versionName="0.3.59" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@ -11,6 +11,7 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name="de.appplant.cordova.plugin.background.ForegroundService" />
</application> </application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" /> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
</manifest> </manifest>

@ -3,13 +3,33 @@ module.exports = [
{ {
"file": "plugins/cordova-plugin-whitelist/whitelist.js", "file": "plugins/cordova-plugin-whitelist/whitelist.js",
"id": "cordova-plugin-whitelist.whitelist", "id": "cordova-plugin-whitelist.whitelist",
"pluginId": "cordova-plugin-whitelist",
"runs": true "runs": true
},
{
"file": "plugins/cordova-plugin-device/www/device.js",
"id": "cordova-plugin-device.device",
"pluginId": "cordova-plugin-device",
"clobbers": [
"device"
]
},
{
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
"pluginId": "de.appplant.cordova.plugin.background-mode",
"clobbers": [
"cordova.plugins.backgroundMode",
"plugin.backgroundMode"
]
} }
]; ];
module.exports.metadata = module.exports.metadata =
// TOP OF METADATA // TOP OF METADATA
{ {
"cordova-plugin-whitelist": "1.0.0" "cordova-plugin-whitelist": "1.0.0",
"cordova-plugin-device": "1.1.0",
"de.appplant.cordova.plugin.background-mode": "0.6.4"
} }
// BOTTOM OF METADATA // BOTTOM OF METADATA
}); });

@ -1,10 +1,17 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="ch.safechat" version="0.3.46" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="ch.safechat" version="0.3.59" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="loglevel" value="DEBUG" /> <preference name="loglevel" value="DEBUG" />
<feature name="Whitelist"> <feature name="Whitelist">
<param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" /> <param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="BackgroundMode">
<param name="android-package" value="de.appplant.cordova.plugin.background.BackgroundMode" />
</feature>
<preference name="KeepRunning" value="true" />
<allow-intent href="market:*" /> <allow-intent href="market:*" />
<name>SafeChat</name> <name>SafeChat</name>
<description> <description>

@ -20,7 +20,14 @@
"installed_plugins": { "installed_plugins": {
"cordova-plugin-whitelist": { "cordova-plugin-whitelist": {
"PACKAGE_NAME": "ch.safechat" "PACKAGE_NAME": "ch.safechat"
},
"de.appplant.cordova.plugin.background-mode": {
"PACKAGE_NAME": "ch.safechat"
} }
}, },
"dependent_plugins": {} "dependent_plugins": {
"cordova-plugin-device": {
"PACKAGE_NAME": "ch.safechat"
}
}
} }

@ -6,5 +6,22 @@
}, },
"is_top_level": true, "is_top_level": true,
"variables": {} "variables": {}
},
"de.appplant.cordova.plugin.background-mode": {
"source": {
"type": "git",
"url": "https://github.com/katzer/cordova-plugin-background-mode.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-device": {
"source": {
"type": "registry",
"id": "cordova-plugin-device"
},
"is_top_level": false,
"variables": {}
} }
} }

@ -1,49 +1,49 @@
<!DOCTYPE HTML"> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width initial-scale=1" /> <meta name="viewport" content="width=device-width initial-scale=1" />
<link href="safechat.css" rel="stylesheet" type="text/css" /> <link href="safechat.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="openpgp.js"></script> <script type="text/javascript" src="openpgp.js"></script>
<script type="text/javascript" src="safechat.js"></script> <script type="text/javascript" src="safechat.js"></script>
<link href="jquery.cssemoticons.css" media="screen" rel="stylesheet" type="text/css" /> <link href="jquery.cssemoticons.css" media="screen" rel="stylesheet" type="text/css" />
<script src="jquery.cssemoticons.js" type="text/javascript"></script> <script src="jquery.cssemoticons.js" type="text/javascript"></script>
<title>Safe Chat</title> <title>Safe Chat</title>
</head> </head>
<body> <body>
<div id="header" class="header"> <div id="header" class="header">
<h1>Safe Chat @PACKAGE_VERSION@</h1> <h1>Safe Chat @PACKAGE_VERSION@</h1>
<div id="togglemenu"> <div id="togglemenu">
<span id="username">[unknown]</span> <span id="username">[unknown]</span>
<img id="menuicon" onclick="togglemenu()" src="menu.svg" /> <img id="menuicon" onclick="togglemenu()" src="menu.svg" />
</div> </div>
</div> </div>
<ul id="menu" style="display: none"> <ul id="menu" style="display: none">
<li onclick="backup()">Download Backup</li> <li onclick="backup()">Download Backup</li>
<li class="toolbutton"><label for="restore">Restore Backup</label><input autocomplete="off" type="file" accept="*.bak" id="restore" /></li> <li class="toolbutton"><label for="restore">Restore Backup</label><input autocomplete="off" type="file" accept="*.bak" id="restore" /></li>
<li id="groups" onclick="groups()">Edit Groups</li> <li id="groups" onclick="groups()">Edit Groups</li>
<li id="removeKey" style="display: none" onclick="removeKey()">Password Forgotten</li> <li id="removeKey" style="display: none" onclick="removeKey()">Password Forgotten</li>
<li id="android-download" href="safechat.apk"><a href="safechat.apk">Download Android-App</a></li> <li id="android-download" href="safechat.apk"><a href="safechat.apk">Download Android-App</a></li>
<li href="https://dev.marc.waeckerlin.org/redmine/projects/safechat/embedded/index.html" target="_blank"><a href="https://dev.marc.waeckerlin.org/redmine/projects/safechat/embedded/index.html" target="_blank">About Safe Chat</a></li> <li href="https://dev.marc.waeckerlin.org/redmine/projects/safechat/embedded/index.html" target="_blank"><a href="https://dev.marc.waeckerlin.org/redmine/projects/safechat/embedded/index.html" target="_blank">About Safe Chat</a></li>
</ul> </ul>
<script type="text/javascript"> <script type="text/javascript">
$(function() { // on load: without cordova, remove andoid-download $(function() { // on load: without cordova, remove andoid-download
if ("@CORDOVA@" == "0") $("#android-download").hide(); if ("@CORDOVA@" == "0") $("#android-download").hide();
if (!window.FileReader) $("#restore").hide(); // not supported by browser if (!window.FileReader) $("#restore").hide(); // not supported by browser
$("#groups").hide(); $("#groups").hide();
}) })
$("#restore").change(function(evt){restore(evt)}); $("#restore").change(function(evt){restore(evt)});
</script> </script>
<div id="main"> <div id="main">
<p>start up engine, please wait ...</p> <p>start up engine, please wait ...</p>
</div> </div>
<div id="status"> <div id="status">

Loading…
Cancel
Save