updated build system

master
Marc Wäckerlin 8 years ago
parent 203f866c28
commit 693ecbefe5
  1. 5
      ChangeLog
  2. 48
      ax_init_standard_project.m4
  3. 92
      bootstrap.sh
  4. 2
      build-in-docker.conf
  5. 3
      configure.ac
  6. 6
      debian/control.in
  7. 10
      debian/rules
  8. 16
      nodejs/routes/index.js
  9. 4
      nodejs/views/index.ejs
  10. 11
      resolve-debbuilddeps.sh

@ -1,3 +1,8 @@
2017-03-03 14:09
* [r108] ChangeLog, nodejs/makefile.am:
added missing directory
2017-01-21 10:13 2017-01-21 10:13
* [r107] debian/control.in: * [r107] debian/control.in:

@ -137,6 +137,8 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
AX_SUBST(PREFIX) AX_SUBST(PREFIX)
SYSCONFDIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${sysconfdir}") SYSCONFDIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${sysconfdir}")
AX_SUBST(SYSCONFDIR) AX_SUBST(SYSCONFDIR)
PKGSYSCONFDIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${SYSCONFDIR}/${PACKAGE_NAME}")
AX_SUBST(PKGSYSCONFDIR)
DATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${datadir}") DATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${datadir}")
AX_SUBST(DATADIR) AX_SUBST(DATADIR)
PKGDATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${DATADIR}/${PACKAGE_NAME}") PKGDATADIR=$(test "$prefix" = NONE && prefix=$ac_default_prefix; eval echo "${DATADIR}/${PACKAGE_NAME}")
@ -498,6 +500,12 @@ maintainer-clean-html-targets:
EOF EOF
]) ])
# use this in configure.ac to support HTML data for webservers
AC_DEFUN([AX_BUILD_HTML_NPM], [
AC_CONFIG_FILES([html/package.json])
AX_BUILD_HTML
])
# use this in configure.ac to support C++ libraries # use this in configure.ac to support C++ libraries
AC_DEFUN([AX_USE_LIBTOOL], [ AC_DEFUN([AX_USE_LIBTOOL], [
# libtool versioning # libtool versioning
@ -571,6 +579,11 @@ distclean-rpm-targets:
EOF EOF
]) ])
# use this in configure.ac to support scripts, e.g. bash scripts
AC_DEFUN([AX_USE_ETC], [
AC_CONFIG_FILES([etc/makefile])
])
# use this in configure.ac to support scripts, e.g. bash scripts # use this in configure.ac to support scripts, e.g. bash scripts
AC_DEFUN([AX_USE_SCRIPTS], [ AC_DEFUN([AX_USE_SCRIPTS], [
AC_CONFIG_FILES([scripts/makefile]) AC_CONFIG_FILES([scripts/makefile])
@ -968,9 +981,40 @@ AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [
# - parameter: # - parameter:
# $1 = package name # $1 = package name
AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [ AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [
pkg=$1 pkg="$1"
if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then
DEB_DEPEND_IFEXISTS+=", ${pkg}" DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}"
fi fi
])
# require package in debian/control.in append @DEB_BUILD_DEPEND@ to Build-Depends
# - parameter:
# $1 = package name
AC_DEFUN([AX_DEB_BUILD_DEPEND], [
pkg="$1"
DEB_BUILD_DEPEND="${DEB_BUILD_DEPEND}, ${pkg}"
])
# require package in debian/control.in append @DEB_DEPEND@ to Depends
# - parameter:
# $1 = package name
AC_DEFUN([AX_DEB_DEPEND], [
pkg="$1"
DEB_DEPEND="${DEB_DEPEND}, ${pkg}"
])
# require package in debian/control.in append @DEB_DEPEND@ to Depends
# - parameter:
# $1 = package name
AC_DEFUN([AX_DEB_SECTION], [
pkg="$1"
DEB_SECTION="${pkg}"
])
# call after setting debian dependencies
AC_DEFUN([AX_DEB_RESOLVE], [
AC_SUBST(DEB_BUILD_DEPEND)
AC_SUBST(DEB_DEPEND)
AC_SUBST(DEB_SECTION)
AC_SUBST(DEB_DEPEND_IFEXISTS) AC_SUBST(DEB_DEPEND_IFEXISTS)
]) ])

@ -147,7 +147,9 @@ GENERATED FILES
* src/makefile.am - if you enabled AX_USE_CXX * src/makefile.am - if you enabled AX_USE_CXX
* src/version.hxx - if you enabled AX_USE_CXX * src/version.hxx - if you enabled AX_USE_CXX
* src/version.cxx - if you enabled AX_USE_CXX * src/version.cxx - if you enabled AX_USE_CXX
* html/makefile.am - if you enabled AX_BUILD_HTML * etc/makefile.am - if you enable AX_USE_ETC
* html/makefile.am - if you enabled AX_BUILD_HTML or AX_BUILD_HTML_NPM
* html/package.json.in - if you enabled AX_BUILD_HTML_NPM
* scripts/makefile.am - if you enabled AX_USE_SCRIPTS * scripts/makefile.am - if you enabled AX_USE_SCRIPTS
* nodejs/makefile.am - if you add AX_USE_NODEJS * nodejs/makefile.am - if you add AX_USE_NODEJS
* nodejs/${DEFAULT_PROJECT_NAME}.js - if you add AX_USE_NODEJS * nodejs/${DEFAULT_PROJECT_NAME}.js - if you add AX_USE_NODEJS
@ -222,7 +224,7 @@ FILE DEPENDENCIES
configuration a dependent, i.e.: configuration a dependent, i.e.:
* test/makefile.am depends on AX_USE_LIBTOOL * test/makefile.am depends on AX_USE_LIBTOOL
* html/makefile.am depends on AX_BUILD_HTML * html/makefile.am depends on AX_BUILD_HTML or AX_BUILD_HTML_NPM
* doc/doxyfile.in depends on AX_BUILD_EXAMPLES * doc/doxyfile.in depends on AX_BUILD_EXAMPLES
* debian/control.in depends on AX_USE_DOXYGEN, AX_USE_PERLDOC, * debian/control.in depends on AX_USE_DOXYGEN, AX_USE_PERLDOC,
AX_USE_CPPUNIT AX_CXX_QT, AX_CHECK_QT, AX_REQUIRE_QT, AX_USE_LIBTOOL AX_USE_CPPUNIT AX_CXX_QT, AX_CHECK_QT, AX_REQUIRE_QT, AX_USE_LIBTOOL
@ -256,6 +258,7 @@ FILES
number. In git, git rev-list --all --count is used. number. In git, git rev-list --all --count is used.
The following macros are supported in configure.ac: The following macros are supported in configure.ac:
* Enable C++: AX_USE_CXX * Enable C++: AX_USE_CXX
* Enable system config files in /etc: AX_USE_ETC
* Enable LibTool library creation: AX_USE_LIBTOOL * Enable LibTool library creation: AX_USE_LIBTOOL
* Enable Scripts: AX_USE_SCRIPTS * Enable Scripts: AX_USE_SCRIPTS
* Enable NodeJS project: AX_USE_NODEJS * Enable NodeJS project: AX_USE_NODEJS
@ -569,6 +572,7 @@ AX_INIT_STANDARD_PROJECT
# requirements, uncomment, what you need: # requirements, uncomment, what you need:
#AX_USE_CXX #AX_USE_CXX
#AX_USE_ETC
#AX_USE_LIBTOOL #AX_USE_LIBTOOL
#AX_USE_SCRIPTS #AX_USE_SCRIPTS
#AX_USE_NODEJS #AX_USE_NODEJS
@ -580,6 +584,7 @@ AX_INIT_STANDARD_PROJECT
#AX_BUILD_TEST #AX_BUILD_TEST
#AX_BUILD_EXAMPLES #AX_BUILD_EXAMPLES
#AX_BUILD_HTML #AX_BUILD_HTML
#AX_BUILD_HTML_NPM
# qt features, uncomment, what you need: # qt features, uncomment, what you need:
#AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets]) #AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
@ -690,9 +695,13 @@ ${CHEADER}#include <${PACKAGE_NAME}.hxx>
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <iostream> #include <iostream>
#include <version.hxx>
int main(int argc, char *argv[]) try { int main(int argc, char *argv[]) try {
QApplication a(argc, argv); QApplication a(argc, argv);
a.setApplicationDisplayName(a.tr("${PACKAGE_NAME}"));
a.setApplicationName(${PACKAGE_NAME}::package_name().c_str());
a.setApplicationVersion(${PACKAGE_NAME}::version().c_str());
QCommandLineParser parser; QCommandLineParser parser;
parser.addHelpOption(); parser.addHelpOption();
parser.process(a); parser.process(a);
@ -725,6 +734,7 @@ class ${PackageName}: public QMainWindow, protected Ui::${PackageName} {
Q_OBJECT; Q_OBJECT;
public: public:
explicit ${PackageName}(QWidget *parent = 0): QMainWindow(parent) { explicit ${PackageName}(QWidget *parent = 0): QMainWindow(parent) {
setTitle(tr("${PACKAGE_NAME}[*]"));
setupUi(this); setupUi(this);
} }
virtual ~${PackageName}() {} virtual ~${PackageName}() {}
@ -854,6 +864,13 @@ namespace NAMESPACE {
const std::string IDENT("\$Id: " PACKAGE_STRING); const std::string IDENT("\$Id: " PACKAGE_STRING);
} }
EOF EOF
to --condition AX_USE_ETC etc/makefile.am <<EOF
${HEADER}pkgsysconfdir = \${sysconfdir}/@PACKAGE_NAME@
dist_pkgsysconf_DATA =
MAINTAINERCLEANFILES = makefile.in
EOF
to --condition AX_USE_SCRIPTS scripts/makefile.am <<EOF to --condition AX_USE_SCRIPTS scripts/makefile.am <<EOF
${HEADER}dist_bin_SCRIPTS = ${HEADER}dist_bin_SCRIPTS =
@ -1066,7 +1083,9 @@ to --condition AX_USE_NODEJS nodejs/etc/systemd/system/${PACKAGE_NAME}.service <
Description=$(head -1 README) Description=$(head -1 README)
[Service] [Service]
ExecStart=/usr/bin/nodejs /usr/share/${PACKAGE_NAME}/nodejs/${PACKAGE_NAME} > /var/log/${PACKAGE_NAME}.log ExecStart=/usr/bin/nodejs /usr/share/${PACKAGE_NAME}/nodejs/${PACKAGE_NAME}
StandardOutput=journal
StandardError=journal
Restart=on-abort Restart=on-abort
[Install] [Install]
@ -1265,11 +1284,59 @@ LDADD = -l${PACKAGE_NAME#lib}
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in
EOF EOF
to --condition AX_BUILD_HTML html/makefile.am <<EOF to --condition AX_BUILD_HTML_NPM html/package.json.in <<EOF
${HEADER}EXTRA_DIST = \${www_DATA} {
"name": "@PACKAGE_NAME@",
"version": "@PACKAGE_VERSION@",
"private": true,
"dependencies": {
},
"description": "@DESCRIPTION@",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "@AUTHOR@",
"license": "@LICENSE@",
"path": {
"prefix": "@PREFIX@",
"sysconf": "@SYSCONFDIR@",
"pkgdata": "@PKGDATADIR@",
"localstate": "@LOCALSTATEDIR@",
"log": "@LOCALSTATEDIR@/log/@PACKAGE_NAME@.log",
"config": "@SYSCONFDIR@/@PACKAGE_NAME@.json",
"nodejs": "@PKGDATADIR@/nodejs"
}
}
EOF
to --condition 'AX_BUILD_HTML|AX_BUILD_HTML_NPM' html/makefile.am <<EOF
${HEADER}EXTRA_DIST = $(testtag AX_BUILD_HTML_NPM && echo "package.json.in")
wwwdir = \${pkgdatadir}/html wwwdir = \${pkgdatadir}/html
www_DATA = www_DATA = $(testtag AX_BUILD_HTML_NPM && echo "package.json")
dist_www_DATA =
$(if testtag AX_BUILD_HTML_NPM; then
cat<<EOF2
all: node_modules
node_modules: package.json.in
HOME=. npm install
clean-local:
-rm -r node_modules .npm
install-data-hook:
test -d \$(DESTDIR)\${wwwdir} || mkdir -p \$(DESTDIR)\${wwwdir}
chmod -R u+w \$(DESTDIR)\${wwwdir}
cp -r . \$(DESTDIR)\${wwwdir}
uninstall-local:
-chmod -R u+w \$(DESTDIR)\${wwwdir}
-rm -rf \$(DESTDIR)\${wwwdir}
EOF2
fi)
MAINTAINERCLEANFILES = makefile.in MAINTAINERCLEANFILES = makefile.in
EOF EOF
@ -1471,12 +1538,12 @@ EOF
Source: @PACKAGE_NAME@ Source: @PACKAGE_NAME@
Priority: extra Priority: extra
Maintainer: @PACKAGER@ Maintainer: @PACKAGER@
Build-Depends: ${BUILD_DEPENDS}${RUN_DEPENDS} Build-Depends: ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@
Package: @PACKAGE_NAME@ Package: @PACKAGE_NAME@
Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi) Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; else echo "@DEB_SECTION@"; fi)
Architecture: any Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}${RUN_DEPENDS} Depends: \${shlibs:Depends}, \${misc:Depends}${RUN_DEPENDS} @DEB_DEPEND@
Description: @DESCRIPTION@ Description: @DESCRIPTION@
@README_DEB@ @README_DEB@
$( if testtag AX_USE_LIBTOOL; then $( if testtag AX_USE_LIBTOOL; then
@ -1485,7 +1552,7 @@ $( if testtag AX_USE_LIBTOOL; then
Package: @PACKAGE_NAME@-dev Package: @PACKAGE_NAME@-dev
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD_DEPENDS}${RUN_DEPENDS} Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_DEPEND@ @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@
Description: @DESCRIPTION@ - Development Package Description: @DESCRIPTION@ - Development Package
@README_DEB@ @README_DEB@
EOF2 EOF2
@ -1497,6 +1564,7 @@ README
EOF EOF
to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}.install <<EOF to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}.install <<EOF
usr/lib/lib*.so.* usr/lib/lib*.so.*
usr/share/${PACKAGE_NAME}
EOF EOF
to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}-dev.install <<EOF to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}-dev.install <<EOF
usr/include/* usr/include/*
@ -1504,7 +1572,6 @@ usr/lib/lib*.a
usr/lib/lib*.so usr/lib/lib*.so
usr/lib/pkgconfig/* usr/lib/pkgconfig/*
usr/lib/*.la usr/lib/*.la
usr/share/${PACKAGE_NAME}
usr/share/doc/${PACKAGE_NAME}/html usr/share/doc/${PACKAGE_NAME}/html
EOF EOF
to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
@ -1675,6 +1742,9 @@ SUBDIRS=""
if testtag AX_USE_CXX; then if testtag AX_USE_CXX; then
SUBDIRS="${SUBDIRS} src" SUBDIRS="${SUBDIRS} src"
fi fi
if testtag AX_USE_ETC; then
SUBDIRS="${SUBDIRS} etc"
fi
if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then
SUBDIRS="${SUBDIRS} test" SUBDIRS="${SUBDIRS} test"
fi fi

@ -2,7 +2,7 @@
## ##
## This file has been added: ## This file has been added:
## - by bootstrap.sh ## - by bootstrap.sh
## - on Sat, 14 January 2017 11:25:34 +0100 ## - on Wed, 15 March 2017 22:40:08 +0100
## Feel free to change it or even remove and rebuild it, up to your needs ## Feel free to change it or even remove and rebuild it, up to your needs
## ##
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8

@ -36,5 +36,8 @@ AX_USE_CORDOVA
#AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets]) #AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
#AX_QT_NO_KEYWORDS #AX_QT_NO_KEYWORDS
AX_DEB_SECTION(web)
AX_DEB_RESOLVE
# create output # create output
AC_OUTPUT AC_OUTPUT

6
debian/control.in vendored

@ -1,12 +1,12 @@
Source: @PACKAGE_NAME@ Source: @PACKAGE_NAME@
Priority: extra Priority: extra
Maintainer: @PACKAGER@ Maintainer: @PACKAGER@
Build-Depends: debhelper, fakeroot, svn2cl, subversion, subversion-tools, pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, doxygen, graphviz, mscgen, default-jre-headless|default-jre, nodejs, npm Build-Depends: debhelper, fakeroot, svn2cl, subversion, subversion-tools, pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, doxygen, graphviz, mscgen, default-jre-headless|default-jre, nodejs, npm @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@
Package: @PACKAGE_NAME@ Package: @PACKAGE_NAME@
Section: web Section: @DEB_SECTION@
Architecture: any Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, nodejs, npm Depends: ${shlibs:Depends}, ${misc:Depends}, nodejs, npm @DEB_DEPEND@
Description: @DESCRIPTION@ Description: @DESCRIPTION@
@README_DEB@ @README_DEB@

10
debian/rules vendored

@ -1,8 +1,10 @@
## @id $Id$ ## @id $Id$
# ##
# This file has been added by bootstrap.sh on Sun, 28 June 2015 22:06:16 +0200 ## This file has been added:
# Feel free to change it or even remove and rebuild it, up to your needs ## - by bootstrap.sh
# ## - on Wed, 15 March 2017 22:40:08 +0100
## Feel free to change it or even remove and rebuild it, up to your needs
##
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890

@ -11,4 +11,20 @@ module.exports = function(app, package) {
}) })
}) })
if (app) {
var path = require('path')
// serve jquery library
app.get('/jquery.js', function(req, res) {
res.sendfile('jquery.min.js', {root: path.dirname(require.resolve('jquery'))});
});
// serve openpgp library
app.get('/openpgp.js', function(req, res) {
res.sendfile('openpgp.min.js', {root: path.dirname(require.resolve('openpgp'))});
});
}
} }

@ -4,8 +4,8 @@
<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="stylesheets/safechat.css" rel="stylesheet" type="text/css" /> <link href="stylesheets/safechat.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="openpgp.min.js"></script> <script type="text/javascript" src="openpgp.js"></script>
<script type="text/javascript" src="socket.io/socket.io.js"></script> <script type="text/javascript" src="socket.io/socket.io.js"></script>
<script type="text/javascript" src="javascripts/mediarecorder.js"></script> <script type="text/javascript" src="javascripts/mediarecorder.js"></script>
<script type="text/javascript" src="javascripts/safechat.js"></script> <script type="text/javascript" src="javascripts/safechat.js"></script>

@ -32,21 +32,24 @@ function install() {
} }
TO_INSTALL= TO_INSTALL=
DEPS=
if test -e debian/control.in -a ! -e debian/control; then if test -e debian/control.in -a ! -e debian/control; then
for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do
if test -n "$(${DO} apt-cache policy -q ${f})" && ((! $(${DO} apt-cache policy ${f} 2>&1 | grep -q 'N: Unable to locate package')) && (! ${DO} dpkg -l "${f}")); then if test -n "$(${DO} apt-cache policy -q ${f})" && ((! $(${DO} apt-cache policy ${f} 2>&1 | grep -q 'N: Unable to locate package')) && (! ${DO} dpkg -l "${f}")); then
TO_INSTALL+=" ${f}" DEPS+=" ${f}"
fi fi
done done
for f in $(sed -n 's, *AX_DEB_BUILD_DEPEND(\([^)]*\)).*,\1,p' configure.ac); do
DEPS+=" ${f}"
done
trap "rm debian/control" INT TERM EXIT trap "rm debian/control" INT TERM EXIT
sed 's,@DEB_DEPEND_IFEXISTS@,,g' debian/control.in | \ sed 's,@\(DEB_DEPEND_IFEXISTS\|DEB_BUILD_DEPEND\|DEB_DEPEND\)@,,g' debian/control.in | \
sed 's,@[^@]*@, dummytext,g' > debian/control sed 's,@[^@]*@, dummytext,g' > debian/control
fi fi
install dpkg-dev install dpkg-dev
DEPS=$(LANG= ${DO} dpkg-checkbuilddeps 2>&1 || true) DEPS+=" $(LANG= ${DO} dpkg-checkbuilddeps 2>&1 | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}')"
DEPS=$(echo "$DEPS" | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}')
for pa in ${DEPS}; do for pa in ${DEPS}; do
if test ${pa//|/} = ${pa}; then if test ${pa//|/} = ${pa}; then

Loading…
Cancel
Save