GUI tool to display PKCS#11 crypto token information. Specially designed fot SuisseID.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1960 lines
60 KiB

  1. #! /bin/bash
  2. ## @file
  3. ##
  4. ## $Id: bootstrap.sh 52 2015-11-03 15:38:21Z marc $
  5. ##
  6. ## $Date: 2004/08/31 15:57:19 $
  7. ## $Author: marc $
  8. ##
  9. ## @copy © Marc Wäckerlin
  10. ## @license LGPL, see file <a href="license.html">COPYING</a>
  11. ##
  12. ## $Log: bootstrap.sh,v $
  13. ## Revision 1.3 2004/08/31 15:57:19 marc
  14. ## added file header
  15. ##
  16. MY_NAME=${0##*/}
  17. PROJECT_PATH=$(pwd)
  18. DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
  19. configure=0
  20. build=0
  21. docker=0
  22. buildtarget=""
  23. overwrite=0
  24. rebuild=0
  25. novcs=0
  26. excludevcs=()
  27. rebuildfiles=()
  28. while test $# -gt 0; do
  29. case "$1" in
  30. (--configure|-c) configure=1;;
  31. (--docker|-d) docker=1;;
  32. (--build|-b) configure=1; build=1; buildtarget+=" distcheck";;
  33. (--all|-a) configure=1; build=1; buildtarget+=" all";;
  34. (--install|-i) configure=1; build=1; buildtarget+=" all install";;
  35. (--clean) configure=1; build=1; buildtarget+=" maintainer-clean";;
  36. (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";;
  37. (--overwrite|-o) overwrite=1;;
  38. (--rebuild|-r) rebuild=1;;
  39. (--rebuild-file|-f) shift; rebuildfiles+=("$1");;
  40. (--no-vcs|-n) novcs=1;;
  41. (--exclude-vcs|-x) shift; excludevcs+=("$1");;
  42. (--version|-v)
  43. echo "$Id: bootstrap.sh 52 2015-11-03 15:38:21Z marc $";
  44. exit;;
  45. (--help|-h) less <<EOF
  46. SYNOPSIS
  47. ${MY_NAME} [--help|-h] [OPTIOS]
  48. OPTIONS
  49. --configure, -c call ./configure after initialization
  50. --docker, -d build and run tests in a docker instance
  51. --build, -b build, also call ./configure && make distcheck
  52. --all, -a same as -b, but make target all
  53. --install, -i same as -a, but add make install
  54. --clean same as -b, but make target maintainer-clean
  55. --target, -t <target> same as -b, but specify target instead of distcheck
  56. --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros)
  57. --rebuild, -r force rebuild of generated files, even if modified
  58. --rebuild-file, -f <file> rebild specific file (can be added multiple times)
  59. --no-vcs, -n do not automatically add files to version control
  60. --exclude-vcs, -x <file> exclude specific file from version control
  61. --help, -h show this help
  62. --version, -v show version and date of this file
  63. DESCRIPTION
  64. Initializes your build environment, as far as neccessary. Reads your
  65. used features from configure.ac, if that file exists, or creates a
  66. configure.ac. Automatically copies or creates all required template
  67. files.
  68. From your new and empty project's subversion or git path, call $0 to
  69. initialize your build environment.
  70. Before you call ${MY_NAME} the very first time, edit ${0#/*}/AUTHORS
  71. and replace it with your name (or the authors of your project, one
  72. name each line, main developper and copyright holder on the first
  73. line).
  74. The first call to ${MY_NAME} should be something like
  75. ../bootstrap-build-environment/${MY_NAME} and not
  76. ./${MY_NAME}. Actually, you called $0.
  77. In the way you called ${MY_NAME}, it has detected
  78. ${DEFAULT_PROJECT_NAME} as the project name for your project in
  79. ${PROJECT_PATH}. In the first run, you should call ${MY_NAME} from a
  80. checked out the bootstrap-build-environment from
  81. https://mrw.sh/, and the path from where you call
  82. ${MY_NAME} (which is actually ${PROJECT_PATH}) should be the path to
  83. your newly created project. Please note that your project must be a
  84. checked out subversion or git repository, since this build
  85. environment relies on subversion or git.
  86. Example for an initial run, where your new projet is stored in
  87. subversion on https:/path/to/your/new-project:
  88. cd ~/svn
  89. svn co https://svn.mrw.sh/bootstrap-build-environment/trunk \\
  90. bootstrap-build-environment
  91. svn co https:/path/to/your/new-project/trunk new-project
  92. cd new-project
  93. ../bootstrap-build-environment/bootstrap.sh
  94. Example for an initial run, where your new projet is stored in
  95. git on https:/path/to/your/new-project:
  96. cd ~/svn
  97. svn co https://svn.mrw.sh/bootstrap-build-environment/trunk \\
  98. bootstrap-build-environment
  99. cd ~/git
  100. git clone https:/path/to/your/new-project
  101. cd new-project
  102. ../bootstrap-build-environment/bootstrap.sh
  103. RUNNING
  104. If you run ${MY_NAME}, it first generates the necessary files (see
  105. below), then first runs make distclean if a makefile exists. After
  106. this it calles aclocal, libtoolize, automake, autoconf and
  107. optionally ./configure. If necessary, files are added to version
  108. control.
  109. GENERATED FILES
  110. This script copies the following files into your project environment:
  111. * ${MY_NAME}
  112. * autogen.sh - just the basics to initialize auto tools and create configure
  113. * ax_init_standard_project.m4 - auxiliary macro definition file
  114. * ax_cxx_compile_stdcxx.m4 - auxiliary macro definition file
  115. * ax_check_qt.m4 - auxiliary macro definition file
  116. * resolve-debbuilddeps.sh - script to install debian package dependencies
  117. * resolve-rpmbuilddeps.sh - script to install RPM package dependencies
  118. * build-in-docker.sh - script to build the project encapsulated in a docker container
  119. * build-in-docker.conf - additional configuration for build-in-docker.sh
  120. * rpmsign.exp - script for signing rpms unattended
  121. * build-resource-file.sh - build resource.qrc file from a resource directory
  122. * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen
  123. * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle
  124. * dependency-graph.sh - script to draw project dependencies
  125. * template.sh - generic template for bash scripts
  126. * test/runtests.sh - template file to run test scripts, i.e. docker based
  127. * AUTHORS - replace your name in AUTHORS before first run
  128. * NEWS - empty file add your project's news
  129. * README (or README.md) - add project description (first line: header, followed by empty line)
  130. * configure.ac - global configuration file template
  131. * makefile.am - global makefile template
  132. * ${DEFAULT_PROJECT_NAME}.desktop.in - linux desktop file
  133. * src/makefile.am - if you enabled AX_USE_CXX
  134. * src/version.hxx - if you enabled AX_USE_CXX
  135. * src/version.cxx - if you enabled AX_USE_CXX
  136. * etc/makefile.am - if you enable AX_USE_ETC
  137. * html/makefile.am - if you enabled AX_BUILD_HTML or AX_BUILD_HTML_NPM
  138. * html/package.json.in - if you enabled AX_BUILD_HTML_NPM
  139. * scripts/makefile.am - if you enabled AX_USE_SCRIPTS
  140. * nodejs/makefile.am - if you add AX_USE_NODEJS
  141. * nodejs/${DEFAULT_PROJECT_NAME}.js - if you add AX_USE_NODEJS
  142. * nodejs/package.json.in - if you add AX_USE_NODEJS
  143. * nodejs/etc/${DEFAULT_PROJECT_NAME}.json - if you add AX_USE_NODEJS
  144. * nodejs/etc/default/${DEFAULT_PROJECT_NAME} - if you add AX_USE_NODEJS
  145. * nodejs/etc/init/${DEFAULT_PROJECT_NAME}.conf - if you add AX_USE_NODEJS
  146. * nodejs/etc/systemd/system/${DEFAULT_PROJECT_NAME}.service - if you add AX_USE_NODEJS
  147. * nodejs/public - if you add AX_USE_NODEJS
  148. * nodejs/public/images - if you add AX_USE_NODEJS
  149. * nodejs/public/javascripts/${DEFAULT_PROJECT_NAME}.js - if you add AX_USE_NODEJS
  150. * nodejs/public/stylesheets/style.styl - if you add AX_USE_NODEJS
  151. * nodejs/routes/index.js - if you add AX_USE_NODEJS
  152. * nodejs/sockets/index.js - if you add AX_USE_NODEJS
  153. * nodejs/views/index.ejs - if you add AX_USE_NODEJS
  154. * nodejs/views/layout.ejs - if you add AX_USE_NODEJS
  155. * nodejs/node_modules - if you add AX_USE_NODEJS
  156. * doc/makefile.am - if you enabled AX_USE_DOXYGEN or AX_USE_PERLDOC
  157. * doc/doxyfile.in - if you enabled AX_USE_DOXYGEN
  158. * doc/header.html.in - if you enabled AX_USE_DOXYGEN
  159. * doc/footer.html.in - if you enabled AX_USE_DOXYGEN
  160. * doc/style.css - if you enabled AX_USE_DOXYGEN
  161. * doc/plantuml.jar - if you enable AX_USE_DOXYGEN
  162. * test/makefile.am - if you enabled AX_USE_CPPUNIT and AX_USE_CXX
  163. * test/${DEFAULT_PROJECT_NAME#lib}.cxx - if you enabled AX_BUILD_TEST or AX_USE_CPPUNIT
  164. * examples/makefile.am - if you enabled AX_BUILD_EXAMPLES
  165. * debian/changelog.in - if you enabled AX_USE_DEBIAN_PACKAGING
  166. * debian/control.in - if you enabled AX_USE_DEBIAN_PACKAGING
  167. * debian/docs - if you enabled AX_USE_DEBIAN_PACKAGING
  168. * debian/${DEFAULT_PROJECT_NAME}.install - if you enabled AX_USE_DEBIAN_PACKAGING
  169. * debian/${DEFAULT_PROJECT_NAME}.dirs - if you enabled AX_USE_DEBIAN_PACKAGING
  170. * debian/${DEFAULT_PROJECT_NAME}-dev.install - if you enabled AX_USE_DEBIAN_PACKAGING
  171. * debian/${DEFAULT_PROJECT_NAME}-dev.dirs - if you enabled AX_USE_DEBIAN_PACKAGING
  172. * debian/rules - if you enabled AX_USE_DEBIAN_PACKAGING
  173. * debian/compat - if you enabled AX_USE_DEBIAN_PACKAGING
  174. * ${DEFAULT_PROJECT_NAME}.spec.in - if you enable AX_USE_RPM_PACKAGING
  175. * src/${DEFAULT_PROJECT_NAME}.pc.in - if you enabled AX_USE_LIBTOOL
  176. REBUILDING FILES
  177. To rebuild all these files, just run "${MY_NAME} -r".
  178. To copy only the files provided by this package, that means those
  179. files you must never change, that means to update the build system
  180. to the latest release, run "${MY_NAME} -o"
  181. You can also rebuild a list of singleany list of specific file files
  182. by adding option "${MY_NAME} -f <file>" to rebuild file
  183. "<file>". You can add option "-f" more than once.
  184. FILES TO EDIT
  185. After creation of the files, you can edit them according to your
  186. needs. Please don't forget to redo your edits after rebuilding a
  187. file. Most files don't even need to be edited, they work out of the
  188. box.
  189. The following files normally require editing:
  190. * AUTHORS
  191. * NEWS
  192. * README
  193. * configure.ac
  194. * src/makefile.am
  195. * html/makefile.am
  196. * test/makefile.am
  197. * test/${DEFAULT_PROJECT_NAME}.cxx
  198. * examples/makefile.am
  199. FILE DEPENDENCIES
  200. You should rebuild (see above) the files, whenever you change the
  201. configuration a dependent, i.e.:
  202. * test/makefile.am depends on AX_USE_LIBTOOL
  203. * html/makefile.am depends on AX_BUILD_HTML or AX_BUILD_HTML_NPM
  204. * doc/doxyfile.in depends on AX_BUILD_EXAMPLES
  205. * debian/control.in depends on AX_USE_DOXYGEN, AX_USE_PERLDOC,
  206. AX_USE_CPPUNIT AX_CXX_QT, AX_CHECK_QT, AX_REQUIRE_QT, AX_USE_LIBTOOL
  207. * debian/${DEFAULT_PROJECT_NAME}.install depends on AX_USE_LIBTOOL
  208. * debian/${DEFAULT_PROJECT_NAME}.dirs depends on AX_USE_LIBTOOL
  209. * debian/${DEFAULT_PROJECT_NAME}-dev.install depends on AX_USE_LIBTOOL
  210. * debian/${DEFAULT_PROJECT_NAME}-dev.dirs depends on AX_USE_LIBTOOL
  211. * ${DEFAULT_PROJECT_NAME}.spec.in depends on AX_USE_RPM_PACKAGING,
  212. AX_USE_LIBTOOL, AX_CHECK_QT, AX_REQUIRE_QT, AX_CXX_QT, AX_USE_CPPUNIT
  213. FILES
  214. * AUTHORS: First line is the main author and used in Debian and RPM
  215. packaging, so there must be a GPG key that matches
  216. to this line.
  217. * NEWS: File to add project news.
  218. * README: First line is a short description of your project, then an
  219. empty line must follow. All remaining lines are a
  220. long description of your project. this information
  221. is copied, e.g. in Debian or RPM packages. In C++
  222. <ou can access the readme by calling
  223. ${DEFAULT_PROJECT_NAME}::description().
  224. * ChangeLog: Your changelog is automatically maintained from
  225. subversion history, using svn2cl. You don't need to
  226. care about. It uses git2cl on git repositories.
  227. * configure.ac: This file becomes very short and simple. You provide
  228. the project name, the major and minor version. The
  229. least version number is automatically taken from
  230. subversion's revision, so every checkin
  231. automatically increments the least version
  232. number. In git, git rev-list --all --count is used.
  233. The following macros are supported in configure.ac:
  234. * Enable C++: AX_USE_CXX
  235. * Enable system config files in /etc: AX_USE_ETC
  236. * Enable LibTool library creation: AX_USE_LIBTOOL
  237. * Enable Scripts: AX_USE_SCRIPTS
  238. * Enable NodeJS project: AX_USE_NODEJS
  239. * Enable Doxygen documentation generation: AX_USE_DOXYGEN
  240. * Enable Perldoc documentation generation: AX_USE_PERLDOC
  241. * Enable Debian packaging by calling "make deb": AX_USE_DEBIAN_PACKAGING
  242. * Enable RPM packaging by calling "make rpm": AX_USE_RPM_PACKAGING
  243. * Enable C++ testing using CppUnit: AX_USE_CPPUNIT
  244. * Enable other tests: AX_BUILD_TEST
  245. * Enable C++ examples, i.e. for libraries: AX_BUILD_EXAMPLES
  246. * Require C++17 support: AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) (see ax_cxx_compile_stdcxx.m4)
  247. * Require a QT module: AX_REQUIRE_QT (see ax_check_qt.m4)
  248. * Optionally use a QT module: AX_CHECK_QT (see ax_check_qt.m4)
  249. * Require a module: AX_PKG_REQUIRE (see ax_init_standard_project.m4)
  250. * Check for an optional module: AX_PKG_CHECK (see ax_init_standard_project.m4)
  251. EXAMPLES: src/makefile.am in a QT project
  252. In this example, you wrote the following files:
  253. * ${DEFAULT_PROJECT_NAME}.hxx - Qt Header file, passed to moc
  254. * ${DEFAULT_PROJECT_NAME}.cxx - C++ file containing main()
  255. * ${DEFAULT_PROJECT_NAME}.ui - UI file
  256. All rules are implicitely added, all you need to do is to add the
  257. following definitions, most lines are generic:
  258. bin_PROGRAMS = ${DEFAULT_PROJECT_NAME}
  259. ${DEFAULT_PROJECT_NAME}_MOCFILES = moc_${DEFAULT_PROJECT_NAME}.cxx
  260. ${DEFAULT_PROJECT_NAME}_UIFILES = ui_${DEFAULT_PROJECT_NAME}.hxx
  261. ${DEFAULT_PROJECT_NAME}_SOURCES = version.cxx version.hxx ${DEFAULT_PROJECT_NAME}.cxx ${DEFAULT_PROJECT_NAME}_MOCFILES ${DEFAULT_PROJECT_NAME}_UIFILES
  262. BUILT_SOURCES = \${${DEFAULT_PROJECT_NAME}_MOCFILES} \${${DEFAULT_PROJECT_NAME}_UIFILES}
  263. EXTRA_DIST = \${${DEFAULT_PROJECT_NAME}_MOCFILES:moc_%.cxx=%.hxx} \${${DEFAULT_PROJECT_NAME}_UIFILES:ui_%.hxx=%.ui}
  264. MAINTAINERCLEANFILES = makefile.in
  265. EOF
  266. exit;;
  267. (*) break;;
  268. esac
  269. shift;
  270. done
  271. # check if stdout is a terminal...
  272. if test -t 1; then
  273. # see if it supports colors...
  274. ncolors=$(tput colors)
  275. if test -n "$ncolors" && test $ncolors -ge 8; then
  276. bold="$(tput bold)"
  277. underline="$(tput smul)"
  278. standout="$(tput smso)"
  279. normal="$(tput sgr0)"
  280. black="$(tput setaf 0)"
  281. red="$(tput setaf 1)"
  282. green="$(tput setaf 2)"
  283. yellow="$(tput setaf 3)"
  284. blue="$(tput setaf 4)"
  285. magenta="$(tput setaf 5)"
  286. cyan="$(tput setaf 6)"
  287. white="$(tput setaf 7)"
  288. fi
  289. fi
  290. notice() {
  291. echo "${yellow}→ notice: ${bold}$*${normal}"
  292. }
  293. running() {
  294. echo -n "${bold}${blue}→ running: ${bold}${white}$*${normal} … "
  295. }
  296. checking() {
  297. echo -n "${bold}${blue}→ checking: ${bold}${white}$*${normal} … "
  298. }
  299. generating() {
  300. echo -n "${bold}${blue}→ generating: ${bold}${white}$*${normal} … "
  301. }
  302. configuring() {
  303. echo -n "${bold}${blue}→ configuring ${bold}${white}$1${normal}:"
  304. shift
  305. echo -n "${white}$*${normal} … "
  306. }
  307. ignored() {
  308. echo "${bold}${yellow}ignored $*${normal}"
  309. }
  310. success() {
  311. echo "${bold}${green}success $*${normal}"
  312. }
  313. error() {
  314. echo "${bold}${red}→ error: $1${normal}"
  315. shift
  316. if test -n "$*"; then
  317. echo "${bold}$*${normal}"
  318. fi
  319. exit 1
  320. }
  321. run() {
  322. check=1
  323. while test $# -gt 0; do
  324. case "$1" in
  325. (--no-check) check=0;;
  326. (*) break;;
  327. esac
  328. shift;
  329. done
  330. running $*
  331. result=$($* 2>&1)
  332. res=$?
  333. if test $res -ne 0; then
  334. if test $check -eq 1; then
  335. error "Failed with return code: $res" "$result"
  336. else
  337. ignored
  338. fi
  339. else
  340. success
  341. fi
  342. }
  343. checking for version control system
  344. VCS=""
  345. VCSDEPENDS=""
  346. for path in . .. ../.. ../../..; do
  347. if test -d ${path}/.svn; then
  348. VCS="svn"
  349. VCSDEPENDS_DEB="svn2cl, subversion, subversion-tools,"
  350. VCSDEPENDS_RPM="subversion, "
  351. success detected ${VCS}
  352. break
  353. elif test -d ${path}/.git; then
  354. VCS="git"
  355. VCSDEPENDS_DEB="git2cl, git,"
  356. VCSDEPENDS_RPM="git, "
  357. success detected ${VCS}
  358. break
  359. fi
  360. done
  361. if test -z "$VCS"; then
  362. ignored
  363. fi
  364. HEADER='## @id '"\$Id\$"'
  365. ##
  366. ## This file has been added:
  367. ## - by '${MY_NAME}'
  368. ## - on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")'
  369. ## Feel free to change it or even remove and rebuild it, up to your needs
  370. ##
  371. ## 1 2 3 4 5 6 7 8
  372. ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
  373. '
  374. CHEADER='/** @id '"\$Id\$"'
  375. This file has been added:
  376. - by '${MY_NAME}'
  377. - on '$(LANG= date +"%a, %d %B %Y %H:%M:%S %z")'
  378. */
  379. // 1 2 3 4 5 6 7 8
  380. // 45678901234567890123456789012345678901234567890123456789012345678901234567890
  381. '
  382. testtag() {
  383. local IFS="|"
  384. egrep -q '^ *'"($*)"' *(\(.*)? *$' configure.ac
  385. }
  386. contains() {
  387. local e
  388. for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
  389. return 1
  390. }
  391. checkdir() {
  392. if ! test -d "$1"; then # create path
  393. run mkdir -p "$1"
  394. if test -n "${VCS}" -a $novcs -eq 0 && ! contains "$1" "${excludevcs[@]}"; then
  395. run --no-check ${VCS} add "$1"
  396. fi
  397. fi
  398. }
  399. checkfile() {
  400. exists=0
  401. if test -f "$1" -o -f "$1".in; then
  402. exists=1
  403. fi
  404. test $exists -eq 1
  405. }
  406. to() {
  407. mode="u=rw,g=rw,o=r"
  408. while test $# -gt 0; do
  409. case "$1" in
  410. (--condition) shift # test for a tag, abort if not set
  411. if ! testtag "$1"; then
  412. return 0
  413. fi;;
  414. (--unless) shift # test for a tag, abort if set
  415. if testtag "$1"; then
  416. return 0
  417. fi;;
  418. (--mode) shift # test for a tag, abort if not set
  419. mode="$1";;
  420. (*) break;;
  421. esac
  422. shift;
  423. done
  424. if checkfile "$1" && test $rebuild -eq 0 -o "$1" = "configure.ac" \
  425. && ! contains "$1" "${rebuildfiles[@]}"; then
  426. # file already exists and must not be rebuilt
  427. return 1
  428. fi
  429. checkdir "$(dirname ${1})"
  430. generating $1
  431. result=$(cat > "$1" 2>&1)
  432. res=$?
  433. if test $res -ne 0; then
  434. error "Failed with return code: $res" "$result"
  435. else
  436. success
  437. fi
  438. run chmod $mode $1
  439. if test $exists -eq 0; then
  440. if test -n "${VCS}" -a $novcs -eq 0 && ! contains "$1" "${excludevcs[@]}"; then
  441. run --no-check ${VCS} add "$1"
  442. if test "${VCS}" = "svn"; then
  443. run svn propset svn:keywords "Id" "$1"
  444. fi
  445. fi
  446. fi
  447. return 0
  448. }
  449. copy() {
  450. if checkfile "$1" && test $overwrite -eq 0 \
  451. && ! contains "$1" "${rebuildfiles[@]}"; then
  452. # file already exists and must not be rebuilt
  453. return
  454. fi
  455. local source="${0%/*}/$1"
  456. if ! test -r "${source}"; then
  457. source="../${source}"
  458. if ! test -r "${source}"; then
  459. source="${0%/*}/$1"
  460. fi
  461. fi
  462. if test "${1%/*}" != "$1"; then
  463. test -d "${1%/*}" || svn mkdir "${1%/*}"
  464. fi
  465. if ! test -e "${source}"; then
  466. ignored "$1" not found
  467. return
  468. fi
  469. run cp "${source}" "$1"
  470. if test $exists -eq 0; then
  471. if test -n "${VCS}" -a $novcs -eq 0 && ! contains "$1" "${excludevcs[@]}"; then
  472. run --no-check ${VCS} add "$1"
  473. if test "${VCS}" = "svn"; then
  474. run svn propset svn:keywords "Id" "$1"
  475. fi
  476. fi
  477. fi
  478. }
  479. doxyreplace() {
  480. configuring doxyfile $1
  481. if sed -i 's|\(^'"$1"' *=\) *.*|\1'" $2"'|g' doc/doxyfile.in; then
  482. success
  483. else
  484. error $0 $*
  485. fi
  486. }
  487. doxyadd() {
  488. configuring doxyfile $1
  489. if sed -i '/^'"$1"' *=/a'"$1"' += '"$2" doc/doxyfile.in; then
  490. success
  491. else
  492. error $0 $*
  493. fi
  494. }
  495. vcs2cl() {
  496. exists=0
  497. if test -f "ChangeLog"; then
  498. exists=1
  499. else
  500. touch "ChangeLog"
  501. fi
  502. if test -x $(which timeout); then
  503. local TIMEOUT="timeout 10"
  504. else
  505. local TIMEOUT=
  506. fi
  507. if test -x $(which ${VCS}2cl); then
  508. if test "${VCS}" = "git"; then
  509. $TIMEOUT ${VCS}2cl || true > ChangeLog
  510. elif test "${VCS}" = "svn"; then
  511. $TIMEOUT ${VCS}2cl --break-before-msg -a -i || true
  512. elif test -n "${VCS}"; then
  513. $TIMEOUT ${VCS}2cl || true
  514. fi
  515. fi
  516. if test $exists -eq 0; then
  517. if test -n "${VCS}" -a $novcs -eq 0 && ! contains "ChangeLog" "${excludevcs[@]}"; then
  518. run --no-check ${VCS} add ChangeLog
  519. fi
  520. fi
  521. }
  522. # Check if we are in subversion root, if so, create trunk, branches, tags:
  523. if test "${VCS}" = "svn" -a $novcs -eq 0; then
  524. if test "$(LANG= svn info | sed -n 's,Relative URL: *,,p')" = "^/"; then
  525. svn mkdir trunk branches tags
  526. cd trunk
  527. fi
  528. fi
  529. # Initialize the environment:
  530. copy ${MY_NAME}
  531. copy ax_init_standard_project.m4
  532. copy ax_cxx_compile_stdcxx.m4
  533. copy ax_check_qt.m4
  534. copy resolve-debbuilddeps.sh
  535. copy resolve-rpmbuilddeps.sh
  536. copy build-in-docker.sh
  537. copy rpmsign.exp
  538. copy build-resource-file.sh
  539. copy sql-to-dot.sed
  540. copy mac-create-app-bundle.sh
  541. copy dependency-graph.sh
  542. copy template.sh
  543. AUTHOR=$(gpg -K 2>/dev/null | sed -n 's,uid *\(\[ultimate\] *\)\?,,p' | head -1)
  544. if test -z "${AUTHOR}"; then
  545. AUTHOR="FIRSTNAME LASTNAME (URL) <EMAIL>"
  546. fi
  547. to AUTHORS <<EOF && notice "please edit AUTHORS"
  548. $AUTHOR
  549. EOF
  550. to NEWS <<EOF && notice "please edit NEWS"
  551. $(date) created ${DEFAULT_PROJECT_NAME}
  552. EOF
  553. if test -e README.md; then
  554. README=README.md
  555. else
  556. README=README
  557. to README <<EOF && notice "please edit README"
  558. ${DEFAULT_PROJECT_NAME}
  559. add description for ${DEFAULT_PROJECT_NAME}
  560. EOF
  561. fi
  562. DESCRIPTION=$(head -1 $README | sed 's,^#\+ *,,;s, *#\+$,,')
  563. to configure.ac <<EOF && notice "please edit configure.ac, then rerun $0" && exit 0
  564. ${HEADER}# default is generated from AUTHORS and project name
  565. PROJECT_URL=
  566. SOURCE_DOWNLOAD=
  567. m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
  568. m4_define(x_major, 0) # project's major version
  569. m4_define(x_minor, 0) # project's minor version
  570. m4_include(ax_init_standard_project.m4)
  571. AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
  572. AM_INIT_AUTOMAKE([1.9 tar-pax])
  573. AX_INIT_STANDARD_PROJECT
  574. # requirements, uncomment, what you need:
  575. #AX_USE_CXX
  576. #AX_USE_ETC
  577. #AX_USE_LIBTOOL
  578. #AX_USE_SCRIPTS
  579. #AX_USE_NODEJS
  580. #AX_USE_DOXYGEN
  581. #AX_USE_PERLDOC
  582. #AX_USE_DEBIAN_PACKAGING
  583. #AX_USE_RPM_PACKAGING
  584. #AX_USE_CPPUNIT
  585. #AX_BUILD_TEST
  586. #AX_BUILD_EXAMPLES
  587. #AX_BUILD_HTML
  588. #AX_BUILD_HTML_NPM
  589. # qt features, uncomment, what you need:
  590. #AX_CHECK_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
  591. #AX_REQUIRE_QT([QT], [QtCore QtGui QtNetwork], [QtWidgets])
  592. #AX_QT_NO_KEYWORDS
  593. # create output
  594. AX_OUTPUT
  595. EOF
  596. PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac)
  597. SAVEIFS="$IFS"
  598. IFS="-" PackageName=( $PACKAGE_NAME )
  599. IFS="$SAVEIFS"
  600. PackageName=${PackageName[*]^}
  601. PackageName=${PackageName// /}
  602. if ! testtag AX_CHECK_QT && \
  603. ! testtag AX_REQUIRE_QT; then
  604. echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | \
  605. to --condition AX_USE_CXX src/makefile.am
  606. if ! ls src/*.[ch]xx; then
  607. to --condition AX_USE_CXX src/${PACKAGE_NAME#lib}.hxx <<EOF
  608. ${CHEADER}#ifndef ${PackageName^^}_HXX
  609. #define ${PackageName^^}_HXX
  610. /** @mainpage @description
  611. @readme
  612. */
  613. #endif
  614. EOF
  615. fi
  616. elif ! test -e src/makefile.am; then
  617. to --condition AX_USE_CXX src/makefile.am <<EOF
  618. ${HEADER}bin_PROGRAMS = ${PACKAGE_NAME}
  619. ## required to enable the translation feature
  620. LANGUAGE_FILE_BASE = ${PACKAGE_NAME}
  621. ## list here the Qt plugins your project depends on
  622. ## required to build Mac OS-X app-bundle
  623. QT_PLUGINS = iconengines imageformats platforms
  624. #### enable if you deliver a KDE/Gnome desktop file
  625. #applicationsdir = \${datarootdir}/applications
  626. #dist_applications_DATA = ${PACKAGE_NAME}.desktop
  627. #### enable (ev. instead of bin_PROGRAMS) if you build a library
  628. #lib_LTLIBRARIES = ${PACKAGE_NAME}.la
  629. #${PACKAGE_NAME}_la_SOURCES = libmain.cxx version.cxx
  630. ## noop to prevent:
  631. ## «src/makefile.am: error: object 'version.\$(OBJEXT)' created both with
  632. ## libtool and without»
  633. #${PACKAGE_NAME}_la_CXXFLAGS = \$(AM_CXXFLAGS)
  634. ## list headers that are required for build, but that are not installed
  635. noinst_HEADERS = version.hxx
  636. ## list all %.hxx files with Q_OBJECT as moc_%.cxx
  637. ${PACKAGE_NAME//-/_}_MOCFILES = moc_${PACKAGE_NAME}.cxx
  638. ## list all %.ui files as ui_%.hxx
  639. ${PACKAGE_NAME//-/_}_UIFILES = ui_${PACKAGE_NAME}.hxx
  640. ## list all %.qrc resource files as qrc_%.cxx
  641. ## note: if there exists a directory %, the file %.qrc is generated from that
  642. ${PACKAGE_NAME//-/_}_RESOURCES = qrc_languages.cxx # qrc_resources.cxx
  643. ## list all final translation files, list all supported languages here
  644. ${PACKAGE_NAME//-/_}_TRANSLATIONS = \${LANGUAGE_FILE_BASE}_en.qm \\
  645. \${LANGUAGE_FILE_BASE}_de.qm \\
  646. \${LANGUAGE_FILE_BASE}_fr.qm \\
  647. \${LANGUAGE_FILE_BASE}_it.qm
  648. ## list all C++ files that need translation
  649. ${PACKAGE_NAME//-/_}_TR_FILES = main.cxx version.cxx
  650. ## automatic assembly, no need to change
  651. ${PACKAGE_NAME//-/_}_SOURCES = \${${PACKAGE_NAME//-/_}_TR_FILES} \${BUILT_SOURCES}
  652. ## automatic assembly, no need to change
  653. BUILT_SOURCES = \${${PACKAGE_NAME//-/_}_MOCFILES} \\
  654. \${${PACKAGE_NAME//-/_}_UIFILES} \\
  655. \${${PACKAGE_NAME//-/_}_TRANSLATIONS} \\
  656. \${${PACKAGE_NAME//-/_}_RESOURCES}
  657. ## automatic assembly, no need to change
  658. EXTRA_DIST_TR = \${${PACKAGE_NAME//-/_}_MOCFILES:moc_%.cxx=%.hxx} \\
  659. \${${PACKAGE_NAME//-/_}_UIFILES:ui_%.hxx=%.ui}
  660. ## automatic assembly, no need to change
  661. ## except: adapt the pre-delivered qt_%.qm list (language files you copy from qt
  662. EXTRA_DIST = \${EXTRA_DIST_TR} \\
  663. \${${PACKAGE_NAME//-/_}_RESOURCES:qrc_%.cxx=%.qrc} \\
  664. \${${PACKAGE_NAME//-/_}_TRANSLATIONS:%.qm=%.ts} \\
  665. qt_de.qm qt_fr.qm
  666. ## automatic assembly, no need to change
  667. LANGUAGE_FILES = \${EXTRA_DIST_TR} \${${PACKAGE_NAME//-/_}_TR_FILES}
  668. CLEANFILES = \${${PACKAGE_NAME//-/_}_RESOURCES}
  669. MAINTAINERCLEANFILES = makefile.in
  670. EOF
  671. to --condition AX_USE_CXX src/main.cxx <<EOF
  672. ${CHEADER}#include <${PACKAGE_NAME}.hxx>
  673. #include <QApplication>
  674. #include <QCommandLineParser>
  675. #include <iostream>
  676. #include <version.hxx>
  677. int main(int argc, char *argv[]) try {
  678. QApplication a(argc, argv);
  679. a.setApplicationDisplayName(a.tr("${PACKAGE_NAME}"));
  680. a.setApplicationName(${PACKAGE_NAME}::package_name().c_str());
  681. a.setApplicationVersion(${PACKAGE_NAME}::version().c_str());
  682. QCommandLineParser parser;
  683. parser.addHelpOption();
  684. parser.process(a);
  685. QStringList scripts(parser.positionalArguments());
  686. ${PackageName} w;
  687. w.show();
  688. return a.exec();
  689. } catch (std::exception &x) {
  690. std::cerr<<"**** error: "<<x.what()<<std::endl;
  691. return 1;
  692. }
  693. EOF
  694. if ! ls src/*.[ch]xx; then
  695. to --condition AX_USE_CXX src/${PACKAGE_NAME#lib}.hxx <<EOF
  696. ${CHEADER}#ifndef ${PackageName^^}_HXX
  697. #define ${PackageName^^}_HXX
  698. /** @mainpage @description
  699. @readme
  700. */
  701. #include <QMainWindow>
  702. #include <ui_${PACKAGE_NAME}.hxx>
  703. /// Main Window
  704. /** Main window for ${PACKAGE_NAME} */
  705. class ${PackageName}: public QMainWindow, protected Ui::${PackageName} {
  706. Q_OBJECT;
  707. public:
  708. explicit ${PackageName}(QWidget *parent = 0): QMainWindow(parent) {
  709. setTitle(tr("${PACKAGE_NAME}[*]"));
  710. setupUi(this);
  711. }
  712. virtual ~${PackageName}() {}
  713. };
  714. #endif
  715. EOF
  716. fi
  717. to --condition AX_USE_CXX src/${PACKAGE_NAME#lib}.ui <<EOF
  718. <?xml version="1.0" encoding="UTF-8"?>
  719. <ui version="4.0">
  720. <class>${PackageName}</class>
  721. <widget class="QMainWindow" name="${PackageName}">
  722. <property name="geometry">
  723. <rect>
  724. <x>0</x>
  725. <y>0</y>
  726. <width>800</width>
  727. <height>600</height>
  728. </rect>
  729. </property>
  730. <property name="windowTitle">
  731. <string>${PackageName}</string>
  732. </property>
  733. <widget class="QWidget" name="centralwidget"/>
  734. <widget class="QMenuBar" name="menubar">
  735. <property name="geometry">
  736. <rect>
  737. <x>0</x>
  738. <y>0</y>
  739. <width>800</width>
  740. <height>22</height>
  741. </rect>
  742. </property>
  743. </widget>
  744. <widget class="QStatusBar" name="statusbar"/>
  745. </widget>
  746. <resources/>
  747. <connections/>
  748. </ui>
  749. EOF
  750. to --condition AX_USE_CXX src/languages.qrc <<EOF
  751. <RCC>
  752. <qresource prefix="/language">
  753. <file>${PACKAGE_NAME}_de.qm</file>
  754. <file>${PACKAGE_NAME}_fr.qm</file>
  755. <file>${PACKAGE_NAME}_it.qm</file>
  756. <file>${PACKAGE_NAME}_en.qm</file>
  757. </qresource>
  758. </RCC>
  759. EOF
  760. fi
  761. to --condition AX_USE_CXX src/version.hxx <<EOF
  762. /*! @file
  763. @id \$Id\$
  764. */
  765. // 1 2 3 4 5 6 7 8
  766. // 45678901234567890123456789012345678901234567890123456789012345678901234567890
  767. #include <string>
  768. namespace NAMESPACE {
  769. /// get package string which consists of package name and package version
  770. std::string package_string();
  771. /// get package name
  772. std::string package_name();
  773. /// get package version
  774. std::string version();
  775. /// get code build date
  776. std::string build_date();
  777. /// get author, i.e. copyright holder
  778. std::string author();
  779. /// get short package description (1st line of README)
  780. std::string description();
  781. /// get long package description (starting at 3rd line in README)
  782. std::string readme();
  783. /// get package logo file name
  784. std::string logo();
  785. /// get package icon file name
  786. std::string icon();
  787. /// used for <code>what filename</code>
  788. extern const std::string WHAT;
  789. /// used for <code>ident filename</code>
  790. extern const std::string IDENT;
  791. }
  792. EOF
  793. to --condition AX_USE_CXX src/version.cxx <<EOF
  794. /*! @file
  795. @id \$Id\$
  796. */
  797. // 1 2 3 4 5 6 7 8
  798. // 45678901234567890123456789012345678901234567890123456789012345678901234567890
  799. #include <string>
  800. namespace NAMESPACE {
  801. std::string package_string() {
  802. return PACKAGE_STRING;
  803. }
  804. std::string package_name() {
  805. return PACKAGE_NAME;
  806. }
  807. std::string version() {
  808. return PACKAGE_VERSION;
  809. }
  810. std::string build_date() {
  811. return BUILD_DATE;
  812. }
  813. std::string author() {
  814. return AUTHOR;
  815. }
  816. std::string description() {
  817. return DESCRIPTION;
  818. }
  819. std::string readme() {
  820. return README;
  821. }
  822. std::string logo() {
  823. return PACKAGE_LOGO;
  824. }
  825. std::string icon() {
  826. return PACKAGE_ICON;
  827. }
  828. const std::string WHAT("#(@) " PACKAGE_STRING);
  829. const std::string IDENT("\$Id: " PACKAGE_STRING);
  830. }
  831. EOF
  832. to --condition AX_USE_ETC etc/makefile.am <<EOF
  833. ${HEADER}pkgsysconfdir = \${sysconfdir}/@PACKAGE_NAME@
  834. dist_pkgsysconf_DATA =
  835. MAINTAINERCLEANFILES = makefile.in
  836. EOF
  837. to --condition AX_USE_SCRIPTS scripts/makefile.am <<EOF
  838. ${HEADER}dist_bin_SCRIPTS =
  839. MAINTAINERCLEANFILES = makefile.in
  840. EOF
  841. if testtag AX_USE_NODEJS; then
  842. checkdir nodejs
  843. checkdir nodejs/public
  844. checkdir nodejs/public/images
  845. checkdir nodejs/etc
  846. checkdir nodejs/etc/systemd
  847. fi
  848. to --condition AX_USE_NODEJS nodejs/makefile.am <<EOF
  849. ${HEADER}EXTRA_DIST = @PACKAGE_NAME@.js package.json.in public routes sockets views
  850. nodejsdir = \${pkgdatadir}/nodejs
  851. sysconfdefaultdir = \${sysconfdir}/default
  852. sysconfinitdir = \${sysconfdir}/init
  853. dist_sysconf_DATA = \${sysconfdir}/@PACKAGE_NAME@.json
  854. dist_sysconfdefault_DATA = \${sysconfdir}/default/@PACKAGE_NAME@
  855. dist_sysconfinit_DATA = \${sysconfdir}/init/@PACKAGE_NAME@.conf
  856. all: node_modules
  857. node_modules: package.json.in
  858. HOME=. npm install
  859. clean-local:
  860. -rm -r node_modules .npm
  861. install-data-hook:
  862. test -d \$(DESTDIR)\${nodejsdir} || mkdir -p \$(DESTDIR)\${nodejsdir}
  863. chmod -R u+w \$(DESTDIR)\${nodejsdir}
  864. cp -r . \$(DESTDIR)\${nodejsdir}
  865. uninstall-local:
  866. -chmod -R u+w \$(DESTDIR)\${nodejsdir}
  867. -rm -rf \$(DESTDIR)\${nodejsdir}
  868. MAINTAINERCLEANFILES = makefile.in
  869. EOF
  870. to --condition AX_USE_NODEJS nodejs/${PACKAGE_NAME}.js <<EOF
  871. ${CHEADER}try {
  872. process.on('uncaughtException', function(e) {
  873. console.log("**** UNCAUGHT EXCEPTION ****");
  874. console.log(e);
  875. console.log(e.stack);
  876. process.exit(1);
  877. });
  878. /**
  879. * Module dependencies.
  880. */
  881. var express = require('express')
  882. , routes = require(__dirname+'/routes');
  883. var app = module.exports = express.createServer();
  884. var io = require('socket.io').listen(app);
  885. var package = require(__dirname+'/package.json');
  886. var config = require(package.path.config);
  887. var authentication = require(__dirname+'/authentication')(config.restrict);
  888. var sockets = require(__dirname+'/sockets')(io, authentication);
  889. // Configuration
  890. process.argv.forEach(function(val, index) {
  891. if (index<2) {return}
  892. if (index!=2 || isNaN(val)) {
  893. console.log("**** ERROR: Unexpected Argument - allowed is only a port number");
  894. process.exit(1);
  895. }
  896. config.port = parseInt(val);
  897. });
  898. if (typeof config.port != 'number') {
  899. console.log("**** WARNING: no valid port given, defaults to 8888");
  900. config.port = 8888;
  901. }
  902. app.configure(function(){
  903. app.set('views', __dirname + '/views');
  904. app.set('view engine', 'ejs');
  905. app.use(express.bodyParser());
  906. app.use(express.methodOverride());
  907. app.use(require('stylus').middleware({ src: __dirname + '/public' }));
  908. app.use(app.router);
  909. app.use(express.static(__dirname + '/public'));
  910. });
  911. app.configure('development', function(){
  912. app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  913. });
  914. app.configure('production', function(){
  915. app.use(express.errorHandler());
  916. });
  917. // Routes
  918. app.get('/', routes.index);
  919. app.listen(config.port, function() {
  920. console.log("Express server listening on port %d in %s mode",
  921. app.address().port, app.settings.env);
  922. });
  923. } catch (e) {
  924. console.log("**** EXCEPTION ****");
  925. console.log(e);
  926. console.log(e.stack);
  927. process.exit(1);
  928. }
  929. EOF
  930. to --condition AX_USE_NODEJS nodejs/package.json.in <<EOF
  931. {
  932. "name": "@PACKAGE_NAME@",
  933. "version": "@PACKAGE_VERSION@",
  934. "private": true,
  935. "dependencies": {
  936. "express": "~2.5.8",
  937. "stylus": "~0.53.0",
  938. "ejs": ">= 0.0.1",
  939. "socket.io": "~1.4.4",
  940. "socketio-auth": "0.0.5",
  941. "ldapauth": "git+https://github.com/DimensionSoftware/node-ldapauth.git"
  942. },
  943. "description": "@DESCRIPTION@",
  944. "main": "@PACKAGE_NAME@.js",
  945. "devDependencies": {},
  946. "scripts": {
  947. "test": "echo \"Error: no test specified\" && exit 1"
  948. },
  949. "author": "@AUTHOR@",
  950. "license": "@LICENSE@",
  951. "path": {
  952. "prefix": "@PREFIX@",
  953. "sysconf": "@SYSCONFDIR@",
  954. "pkgdata": "@PKGDATADIR@",
  955. "localstate": "@LOCALSTATEDIR@",
  956. "log": "@LOCALSTATEDIR@/log/@PACKAGE_NAME@.log",
  957. "config": "@SYSCONFDIR@/@PACKAGE_NAME@.json",
  958. "nodejs": "@PKGDATADIR@/nodejs"
  959. }
  960. }
  961. EOF
  962. to --condition AX_USE_NODEJS nodejs/etc/${PACKAGE_NAME}.json <<EOF
  963. {
  964. "port": 8888,
  965. "restrict": {
  966. "passwords": {
  967. "foo": ["sha256", "fcde2b2edxx56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"]
  968. },
  969. "ldap": {
  970. "url": "ldap://your.ldap.host",
  971. "adminDn": "cn=tmp,ou=system,ou=people,dc=your,dc=ldap,dc=host",
  972. "adminPassword": "secret",
  973. "searchBase": "ou=person,ou=people,dc=your,dc=ldap,dc=host",
  974. "searchFilter": "(uid={{username}})"
  975. }
  976. }
  977. }
  978. EOF
  979. PACKAGE_NAME_UPPER=$(echo ${PACKAGE_NAME} | tr '+[:lower:]' 'X[:upper:]' | tr -cd '[[:alnum:]]._-')
  980. to --condition AX_USE_NODEJS nodejs/etc/default/${PACKAGE_NAME} <<EOF
  981. #EXEC_${PACKAGE_NAME_UPPER}="/usr/bin/nodejs /usr/share/${PACKAGE_NAME}/nodejs/${PACKAGE_NAME}"
  982. #${PACKAGE_NAME_UPPER}_LOG="/var/log/${PACKAGE_NAME}.log"
  983. #${PACKAGE_NAME_UPPER}="${PACKAGE_NAME}"
  984. #${PACKAGE_NAME_UPPER}_PORT="8888"
  985. EOF
  986. to --condition AX_USE_NODEJS nodejs/etc/init/${PACKAGE_NAME}.conf <<EOF
  987. #!upstart
  988. description "$DESCRIPTION"
  989. author "$(head -1 AUTHORS)"
  990. start on (local-filesystems and net-device-up)
  991. stop on runlevel [!2345]
  992. respawn
  993. script
  994. echo \$\$ > /var/run/${PACKAGE_NAME}.pid
  995. # there are some useful defaults
  996. # do not edit this file, overwrite values in /etc/default/${PACKAGE_NAME}
  997. EXEC_${PACKAGE_NAME_UPPER}="/usr/bin/nodejs /usr/share/${PACKAGE_NAME}/nodejs/${PACKAGE_NAME}"
  998. ${PACKAGE_NAME_UPPER}_LOG="/var/log/${PACKAGE_NAME}.log"
  999. ${PACKAGE_NAME_UPPER}_USER="${PACKAGE_NAME}"
  1000. ${PACKAGE_NAME_UPPER}_PORT=""
  1001. [ -r /etc/default/${PACKAGE_NAME} ] && . /etc/default/${PACKAGE_NAME}
  1002. if test -n "\${${PACKAGE_NAME_UPPER}_USER}"; then
  1003. exec sudo -u "\${${PACKAGE_NAME_UPPER}_USER}" \${EXEC_${PACKAGE_NAME_UPPER}} \${${PACKAGE_NAME_UPPER}_PORT} >> \${${PACKAGE_NAME_UPPER}_LOG} 2>&1
  1004. else
  1005. exec \${EXEC_${PACKAGE_NAME_UPPER}} \${${PACKAGE_NAME_UPPER}_PORT} >> \${${PACKAGE_NAME_UPPER}_LOG} 2>&1
  1006. fi
  1007. end script
  1008. pre-start script
  1009. ${PACKAGE_NAME_UPPER}_LOG="/var/log/${PACKAGE_NAME}.log"
  1010. [ -r /etc/default/${PACKAGE_NAME} ] && . /etc/default/${PACKAGE_NAME}
  1011. # Date format same as (new Date()).toISOString() for consistency
  1012. echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> \${${PACKAGE_NAME_UPPER}_LOG}
  1013. end script
  1014. pre-stop script
  1015. ${PACKAGE_NAME_UPPER}_LOG="/var/log/${PACKAGE_NAME}.log"
  1016. [ -r /etc/default/${PACKAGE_NAME} ] && . /etc/default/${PACKAGE_NAME}
  1017. rm /var/run/${PACKAGE_NAME}.pid
  1018. echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> \${${PACKAGE_NAME_UPPER}_LOG}
  1019. end script
  1020. EOF
  1021. to --condition AX_USE_NODEJS nodejs/etc/systemd/system/${PACKAGE_NAME}.service <<EOF
  1022. [Unit]
  1023. Description=$DESCRIPTION
  1024. [Service]
  1025. ExecStart=/usr/bin/nodejs /usr/share/${PACKAGE_NAME}/nodejs/${PACKAGE_NAME}
  1026. StandardOutput=journal
  1027. StandardError=journal
  1028. Restart=on-abort
  1029. [Install]
  1030. WantedBy=multi-user.target
  1031. EOF
  1032. to --condition AX_USE_NODEJS nodejs/public/javascripts/${PACKAGE_NAME}.js <<EOF
  1033. ${CHEADER}var socket = null;
  1034. function init() {
  1035. socket = io.connect();
  1036. /*
  1037. socket
  1038. .io
  1039. .on("connect", connect)
  1040. .on("reconnect", connect)
  1041. .on("disconnect", disconnected)
  1042. .on("error", disconnected);
  1043. socket
  1044. .on("authenticated", authenticated)
  1045. .on("unauthorized", unauthorized)
  1046. .on("fail", error);
  1047. */
  1048. }
  1049. /// On Load, Call @ref start
  1050. /*
  1051. \$(window.onbeforeunload = function() {
  1052. return "Are you sure you want to navigate away?";
  1053. });
  1054. */
  1055. \$(init);
  1056. EOF
  1057. to --condition AX_USE_NODEJS nodejs/public/stylesheets/style.styl <<EOF
  1058. body
  1059. padding: 50px
  1060. font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
  1061. a
  1062. color: #00B7FF
  1063. EOF
  1064. to --condition AX_USE_NODEJS nodejs/routes/index.js <<EOF
  1065. ${CHEADER}var package = require(__dirname+"/../package.json");
  1066. exports.index = function(req, res) {
  1067. res.render('index', {
  1068. packagename: package.name,
  1069. packageversion: package.version
  1070. });
  1071. };
  1072. EOF
  1073. to --condition AX_USE_NODEJS nodejs/sockets/index.js <<EOF
  1074. module.exports = function(io, authentication) {
  1075. var module={};
  1076. function broadcast(signal, data) {
  1077. console.log("<= signal: "+signal);
  1078. io.sockets.emit(signal, data);
  1079. }
  1080. function fail(txt, data) {
  1081. console.log("** "+txt, data);
  1082. }
  1083. function connection(socket, userdata) {
  1084. console.log("=> new connection from "+userdata.username);
  1085. function emit(signal, data, info) {
  1086. if (typeof data == 'string' && !data.match("\n")) {
  1087. console.log("<- signal: "+signal+"("+data+")");
  1088. } else {
  1089. console.log("<- signal: "+signal);
  1090. }
  1091. if (info) console.log(info);
  1092. socket.emit(signal, data);
  1093. }
  1094. function fail(txt, data) {
  1095. console.log("** "+txt, data);
  1096. emit("fail", txt);
  1097. }
  1098. /*
  1099. socket
  1100. .on("xxx", xxx)
  1101. .on("yyy", yyy;
  1102. */
  1103. }
  1104. // Handle Connection
  1105. require('socketio-auth')(io, {
  1106. authenticate: function (socket, data, callback) {
  1107. console.log("=> authenticate: ", data.username);
  1108. //get credentials sent by the client
  1109. var username = data.username;
  1110. var password = data.password;
  1111. authentication(data.username, data.password,
  1112. function() {
  1113. console.log("####LOGIN-SUCESS####");
  1114. callback(null, true)
  1115. },
  1116. function() {
  1117. console.log("####LOGIN-FAIL####");
  1118. callback(new Error("wrong credentials"))
  1119. });
  1120. },
  1121. postAuthenticate: connection,
  1122. timeout: "none"
  1123. });
  1124. return module;
  1125. }
  1126. EOF
  1127. to --condition AX_USE_NODEJS nodejs/views/index.ejs <<EOF
  1128. <!DOCTYPE html>
  1129. <html>
  1130. <head>
  1131. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  1132. <meta name="viewport" content="width=device-width initial-scale=1" />
  1133. <link href="stylesheets/style.css" rel="stylesheet" type="text/css" />
  1134. <script type="text/javascript" src="/socket.io/socket.io.js"></script>
  1135. <script type="text/javascript" src="javascripts/${PACKAGE_NAME}.js"></script>
  1136. <title>$DESCRIPTION</title>
  1137. </head>
  1138. <body>
  1139. <h1>$DESCRIPTION</h1>
  1140. <p>generated by bootstrap, please edit</p>
  1141. </body>
  1142. </html>
  1143. EOF
  1144. to --condition AX_USE_NODEJS nodejs/views/layout.ejs <<EOF
  1145. <%- body %>
  1146. EOF
  1147. echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition 'AX_USE_DOXYGEN|AX_USE_PERLDOC' doc/makefile.am
  1148. if testtag AX_BUILD_TEST; then
  1149. to test/runtests.sh < ${0%/*}/test/runtests.sh
  1150. fi
  1151. to --condition 'AX_BUILD_TEST|AX_USE_CPPUNIT' test/makefile.am <<EOF
  1152. ${HEADER}$(if testtag AX_USE_CXX; then
  1153. cat <<EOF2
  1154. AM_CPPFLAGS = -I\${top_srcdir}/src -I\${top_builddir}/src
  1155. AM_LDFLAGS = -L\${abs_top_builddir}/src/.libs
  1156. $(if testtag AX_USE_LIBTOOL; then
  1157. cat <<EOF3
  1158. LDADD = -lcppunit -l${PACKAGE_NAME#lib}
  1159. EOF3
  1160. fi)
  1161. EOF2
  1162. fi)
  1163. check_PROGRAMS = ${PACKAGE_NAME#lib}
  1164. TESTS = \${check_PROGRAMS}
  1165. ${PACKAGE_NAME#lib}_SOURCES = ${PACKAGE_NAME#lib}.cxx
  1166. MAINTAINERCLEANFILES = makefile.in
  1167. EOF
  1168. to --condition AX_USE_CPPUNIT --condition AX_USE_CXX test/${PACKAGE_NAME#lib}.cxx <<EOF
  1169. ${CHEADER}
  1170. #include <cppunit/TestFixture.h>
  1171. #include <cppunit/ui/text/TestRunner.h>
  1172. #include <cppunit/extensions/HelperMacros.h>
  1173. #include <cppunit/extensions/TestFactoryRegistry.h>
  1174. #include <cppunit/XmlOutputter.h>
  1175. #include <fstream>
  1176. /// @todo Rename DummyTest and DummyTest::dummy()
  1177. /// @todo Write test cases
  1178. class DummyTest: public CppUnit::TestFixture {
  1179. public:
  1180. void dummy() {
  1181. }
  1182. CPPUNIT_TEST_SUITE(DummyTest);
  1183. CPPUNIT_TEST(dummy);
  1184. CPPUNIT_TEST_SUITE_END();
  1185. };
  1186. CPPUNIT_TEST_SUITE_REGISTRATION(DummyTest);
  1187. int main(int argc, char** argv) try {
  1188. std::ofstream ofs((*argv+std::string(".xml")).c_str());
  1189. CppUnit::TextUi::TestRunner runner;
  1190. runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
  1191. runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
  1192. return runner.run() ? 0 : 1;
  1193. } catch (std::exception& e) {
  1194. std::cerr<<"***Exception: "<<e.what()<<std::endl;
  1195. return 1;
  1196. }
  1197. EOF
  1198. to --condition AX_BUILD_EXAMPLES examples/makefile.am <<EOF
  1199. ${HEADER}AM_CPPFLAGS = -I\${top_srcdir}/src -I\${top_builddir}/src
  1200. AM_LDFLAGS = -L\${abs_top_builddir}/src/.libs
  1201. LDADD = -l${PACKAGE_NAME#lib}
  1202. exampledir = \${docdir}/examples
  1203. example_DATA =
  1204. MAINTAINERCLEANFILES = makefile.in
  1205. EOF
  1206. to --condition AX_BUILD_HTML_NPM html/package.json.in <<EOF
  1207. {
  1208. "name": "@PACKAGE_NAME@",
  1209. "version": "@PACKAGE_VERSION@",
  1210. "private": true,
  1211. "dependencies": {
  1212. },
  1213. "description": "@DESCRIPTION@",
  1214. "devDependencies": {},
  1215. "scripts": {
  1216. "test": "echo \"Error: no test specified\" && exit 1"
  1217. },
  1218. "author": "@AUTHOR@",
  1219. "license": "@LICENSE@",
  1220. "path": {
  1221. "prefix": "@PREFIX@",
  1222. "sysconf": "@SYSCONFDIR@",
  1223. "pkgdata": "@PKGDATADIR@",
  1224. "localstate": "@LOCALSTATEDIR@",
  1225. "log": "@LOCALSTATEDIR@/log/@PACKAGE_NAME@.log",
  1226. "config": "@SYSCONFDIR@/@PACKAGE_NAME@.json",
  1227. "nodejs": "@PKGDATADIR@/nodejs"
  1228. }
  1229. }
  1230. EOF
  1231. to --condition 'AX_BUILD_HTML|AX_BUILD_HTML_NPM' html/makefile.am <<EOF
  1232. ${HEADER}EXTRA_DIST = $(testtag AX_BUILD_HTML_NPM && echo "package.json.in")
  1233. wwwdir = \${pkgdatadir}/html
  1234. www_DATA = $(testtag AX_BUILD_HTML_NPM && echo "package.json")
  1235. dist_www_DATA =
  1236. $(if testtag AX_BUILD_HTML_NPM; then
  1237. cat<<EOF2
  1238. all: node_modules
  1239. node_modules: package.json.in
  1240. HOME=. npm install
  1241. clean-local:
  1242. -rm -r node_modules .npm
  1243. install-data-hook:
  1244. test -d \$(DESTDIR)\${wwwdir} || mkdir -p \$(DESTDIR)\${wwwdir}
  1245. chmod -R u+w \$(DESTDIR)\${wwwdir}
  1246. cp -r . \$(DESTDIR)\${wwwdir}
  1247. uninstall-local:
  1248. -chmod -R u+w \$(DESTDIR)\${wwwdir}
  1249. -rm -rf \$(DESTDIR)\${wwwdir}
  1250. EOF2
  1251. fi)
  1252. MAINTAINERCLEANFILES = makefile.in
  1253. EOF
  1254. to --condition AX_USE_DOXYGEN doc/header.html.in <<EOF
  1255. <!-- HTML header for doxygen 1.8.6-->
  1256. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  1257. <html xmlns="http://www.w3.org/1999/xhtml">
  1258. <head>
  1259. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  1260. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  1261. <meta name="generator" content="Doxygen \$doxygenversion"/>
  1262. <!--BEGIN PROJECT_NAME--><title>\$projectname: \$title</title><!--END PROJECT_NAME-->
  1263. <!--BEGIN !PROJECT_NAME--><title>\$title</title><!--END !PROJECT_NAME-->
  1264. <link href="\$relpath^tabs.css" rel="stylesheet" type="text/css"/>
  1265. <script type="text/javascript" src="\$relpath^jquery.js"></script>
  1266. <script type="text/javascript" src="\$relpath^dynsections.js"></script>
  1267. \$treeview
  1268. \$search
  1269. \$mathjax
  1270. <link href="\$relpath^\$stylesheet" rel="stylesheet" type="text/css" />
  1271. \$extrastylesheet
  1272. </head>
  1273. <body>
  1274. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  1275. <div id="titlearea">
  1276. <div id="projecthead">
  1277. <div id="projectlogo"><img alt="" src="\$relpath^\$projectlogo"/></div>
  1278. <div id="projectname">\$projectname</span>&#160;<span id="projectnumber">\$projectnumber</div>
  1279. <div id="projectbrief">\$projectbrief</div>
  1280. </div>
  1281. <nav>
  1282. <a href="@PROJECT_URL@" target="_blank">Project Management</a>
  1283. <a href="@SOURCE_DOWNLOAD@" target="_blank">Download</a>
  1284. <div>\$searchbox</div>
  1285. </nav>
  1286. </div>
  1287. EOF
  1288. to --condition AX_USE_DOXYGEN doc/footer.html.in <<EOF
  1289. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  1290. <ul>
  1291. \$navpath
  1292. <li class="footer"><a href="@AUTHOR_URL@" target="_blank">@AUTHOR_NAME@</a></li>
  1293. </ul>
  1294. </div>
  1295. </body>
  1296. </html>
  1297. EOF
  1298. to --condition AX_USE_DOXYGEN doc/style.css <<EOF
  1299. #titlearea {
  1300. display: flex;
  1301. justify-content: space-between;
  1302. align-items: flex-begin;
  1303. }
  1304. #titlearea nav {
  1305. padding: 0;
  1306. margin: 0;
  1307. }
  1308. #titlearea nav a {
  1309. background-color: lightgray;
  1310. border: 1px solid gray;
  1311. color: black;
  1312. padding: 1ex;
  1313. margin: 0;
  1314. }
  1315. img, object {
  1316. max-width: 100% !important;
  1317. }
  1318. @media (max-width: 50em) {
  1319. #navrow1, #navrow2 {
  1320. display: block
  1321. }
  1322. #side-nav, #splitbar, .ui-resizable-handle ui-resizable-e, .ui-resizable-handle ui-resizable-s {
  1323. display: none;
  1324. }
  1325. #doc-content {
  1326. margin-left: 0 !important;
  1327. }
  1328. }
  1329. @media (min-width: 50em) {
  1330. #navrow1, #navrow2 {
  1331. display: none;
  1332. }
  1333. #side-nav, #splitbar, .ui-resizable-handle ui-resizable-e, .ui-resizable-handle ui-resizable-s {
  1334. display: block
  1335. }
  1336. }
  1337. EOF
  1338. if testtag AX_USE_DOXYGEN; then
  1339. copy doc/plantuml.jar
  1340. fi
  1341. if testtag AX_USE_DOXYGEN; then
  1342. if ! checkfile doc/doxyfile.in || \
  1343. contains doc/doxyfile.in "${rebuildfiles[@]}"; then
  1344. run doxygen -g doc/doxyfile.in
  1345. sed -i ':a;/\\$/{s///;N;s/ *\n */ /g;ba}' doc/doxyfile.in
  1346. if test $exists -eq 0; then
  1347. if test -n "${VCS}" -a $novcs -eq 0 && ! contains "doc/doxyfile" "${excludevcs[@]}"; then
  1348. run --no-check ${VCS} add doc/doxyfile.in
  1349. if test "${VCS}" = "svn"; then
  1350. run svn propset svn:keywords "Id" doc/doxyfile.in
  1351. fi
  1352. fi
  1353. fi
  1354. doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
  1355. doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
  1356. doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
  1357. doxyreplace PROJECT_LOGO "@top_srcdir@/@PACKAGE_LOGO@"
  1358. doxyreplace INLINE_INHERITED_MEMB YES
  1359. doxyreplace MULTILINE_CPP_IS_BRIEF YES
  1360. doxyreplace TAB_SIZE 2
  1361. doxyreplace ALIASES '"id=\\par File-ID\\n"'
  1362. doxyadd ALIASES '"copy=\\par Copyright by <a href="@AUTHOR_URL@" target="_blank">@AUTHOR_NAME@</a>\\n"'
  1363. doxyadd ALIASES '"license=\\par License\\n"'
  1364. doxyadd ALIASES '"classmutex=\\par Reentrant:\\nAccess is locked with class static mutex @c "'
  1365. doxyadd ALIASES '"instancemutex=\\par Reentrant:\\nAccess is locked with per instance mutex @c "'
  1366. doxyadd ALIASES '"mutex=\\par Reentrant:\\nAccess is locked with mutex @c "'
  1367. doxyadd ALIASES '"api=\\xrefitem api \\"API Call\\" \\"\\""'
  1368. doxyadd ALIASES '"description=@DESCRIPTION@"'
  1369. doxyadd ALIASES '"readme=@README_HTML@"'
  1370. doxyadd ALIASES '"author=<a href="@AUTHOR_URL@" target="_blank">@AUTHOR_NAME@</a>"'
  1371. doxyreplace PLANTUML_JAR_PATH '"@top_srcdir@/doc/plantuml.jar"'
  1372. doxyreplace ENABLE_PREPROCESSING YES
  1373. doxyreplace MACRO_EXPANSION YES
  1374. doxyadd PREDEFINED '"NAMESPACE=@PACKAGE_NAME@"'
  1375. doxyreplace BUILTIN_STL_SUPPORT YES
  1376. doxyreplace DISTRIBUTE_GROUP_DOC YES
  1377. doxyreplace EXTRACT_ALL YES
  1378. doxyreplace EXTRACT_PACKAGE YES
  1379. doxyreplace EXTRACT_PRIVATE YES
  1380. doxyreplace EXTRACT_STATIC YES
  1381. doxyreplace EXTRACT_LOCAL_CLASSES YES
  1382. doxyreplace EXTRACT_LOCAL_METHODS YES
  1383. doxyreplace EXTRACT_ANON_NSPACES YES
  1384. doxyreplace SHOW_GROUPED_MEMB_INC YES
  1385. doxyreplace SORT_MEMBERS_CTORS_1ST YES
  1386. doxyreplace WARN_IF_UNDOCUMENTED NO
  1387. doxyreplace WARN_LOGFILE doxygen.errors
  1388. doxyreplace INPUT "@top_srcdir@/src"
  1389. doxyadd INPUT "@top_srcdir@/@README_FILE@"
  1390. if testtag AX_USE_SCRIPTS; then
  1391. doxyadd INPUT "@top_srcdir@/scripts"
  1392. fi
  1393. if testtag AX_BUILD_HTML; then
  1394. doxyadd INPUT "@top_srcdir@/html"
  1395. fi
  1396. if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then
  1397. doxyadd INPUT "@top_srcdir@/test"
  1398. fi
  1399. if testtag AX_USE_NODEJS; then
  1400. doxyadd INPUT "@top_srcdir@/nodejs"
  1401. doxyadd EXCLUDE "@top_srcdir@/nodejs/node_modules"
  1402. doxyadd EXCLUDE "@top_srcdir@/nodejs/public/javascripts/ext"
  1403. fi
  1404. doxyreplace USE_MDFILE_AS_MAINPAGE "@top_srcdir@/@README_FILE@"
  1405. doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt *.sql'
  1406. doxyreplace RECURSIVE YES
  1407. doxyreplace EXCLUDE_PATTERNS "moc_* uic_* qrc_* version.[ch]xx"
  1408. doxyreplace HTML_HEADER header.html
  1409. doxyreplace HTML_FOOTER footer.html
  1410. doxyreplace HTML_EXTRA_STYLESHEET style.css
  1411. doxyreplace HTML_DYNAMIC_SECTIONS YES
  1412. doxyreplace DISABLE_INDEX NO
  1413. doxyreplace GENERATE_TREEVIEW YES
  1414. doxyreplace EXAMPLE_PATH @top_srcdir@
  1415. doxyreplace EXAMPLE_RECURSIVE YES
  1416. doxyreplace FILTER_PATTERNS '*.wt=doxygen-webtester.sed *.sql=@top_srcdir@/sql-to-dot.sed'
  1417. doxyreplace SOURCE_BROWSER YES
  1418. doxyreplace INLINE_SOURCES YES
  1419. doxyreplace GENERATE_TESTLIST YES
  1420. doxyreplace SEARCHENGINE NO
  1421. doxyreplace GENERATE_HTML YES
  1422. doxyreplace GENERATE_LATEX NO
  1423. doxyreplace LATEX_BATCHMODE YES
  1424. doxyreplace LATEX_HIDE_INDICES YES
  1425. doxyreplace COMPACT_RTF YES
  1426. doxyreplace RTF_HYPERLINKS YES
  1427. doxyreplace GENERATE_TAGFILE "@PACKAGE_NAME@.doxytag"
  1428. doxyreplace HIDE_UNDOC_RELATIONS NO
  1429. doxyreplace HAVE_DOT YES
  1430. doxyreplace CLASS_GRAPH YES
  1431. doxyreplace TEMPLATE_RELATIONS YES
  1432. doxyreplace DOT_IMAGE_FORMAT svg
  1433. doxyreplace INTERACTIVE_SVG NO
  1434. doxyreplace DOT_TRANSPARENT YES
  1435. fi
  1436. fi
  1437. if testtag AX_USE_DEBIAN_PACKAGING; then
  1438. checkdir debian
  1439. to debian/changelog.in <<EOF
  1440. @PACKAGE@ (@PACKAGE_VERSION@~@DISTRO@.@BUILD_NUMBER@) @DISTRO@; urgency=low
  1441. @DEB_CHANGELOG@
  1442. -- @PACKAGER@ @BUILD_DATE@
  1443. EOF
  1444. RUN_DEPENDS="$(if testtag AX_USE_NODEJS; then echo -n ", nodejs, npm,"; fi)"
  1445. BUILD_DEPENDS="gnupg, debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, libltdl-dev, autotools-dev, pandoc, lsb-release$(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev | qt4-dev,"; fi)"
  1446. to debian/control.in <<EOF
  1447. Source: @PACKAGE_NAME@
  1448. Priority: extra
  1449. Maintainer: @PACKAGER@
  1450. Build-Depends: ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@
  1451. Package: @PACKAGE_NAME@
  1452. Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; else echo "@DEB_SECTION@"; fi)
  1453. Architecture: any
  1454. Depends: \${shlibs:Depends}, \${misc:Depends}${RUN_DEPENDS} @DEB_DEPEND@
  1455. Description: @DESCRIPTION@
  1456. @README_DEB@
  1457. $( if testtag AX_USE_LIBTOOL; then
  1458. cat <<EOF2
  1459. Package: @PACKAGE_NAME@-dev
  1460. Section: libdevel
  1461. Architecture: any
  1462. Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@
  1463. Description: @DESCRIPTION@ - Development Package
  1464. @README_DEB@
  1465. EOF2
  1466. fi)
  1467. EOF
  1468. to debian/docs <<EOF
  1469. NEWS
  1470. $README
  1471. EOF
  1472. to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}.install <<EOF
  1473. usr/lib/lib*.so.*
  1474. usr/share/${PACKAGE_NAME}
  1475. EOF
  1476. to --condition AX_USE_LIBTOOL debian/${PACKAGE_NAME}-dev.install <<EOF
  1477. usr/include/*
  1478. usr/lib/lib*.a
  1479. usr/lib/lib*.so
  1480. usr/lib/pkgconfig/*
  1481. usr/lib/*.la
  1482. usr/share/doc/${PACKAGE_NAME}/html
  1483. $(if testtag AX_BUILD_EXAMPLES; then
  1484. echo usr/share/doc/${PACKAGE_NAME}/examples
  1485. fi)
  1486. EOF
  1487. to --mode "u=rwx,g=rwx,o=rx" debian/rules <<EOF
  1488. ${HEADER}%:
  1489. dh \$@
  1490. EOF
  1491. echo 7 | to debian/compat
  1492. fi
  1493. to ${PACKAGE_NAME}.desktop.in <<EOF
  1494. [Desktop Entry]
  1495. Type=Application
  1496. Name=${PACKAGE_NAME}
  1497. GenericName=${PACKAGE_NAME}
  1498. Comment=@DESCRIPTION@
  1499. Icon=@prefix@/share/@PACKAGE_NAME@/@PACKAGE_ICON@
  1500. Exec=${PACKAGE_NAME} %u
  1501. Terminal=false
  1502. Categories=Qt;Utility;
  1503. EOF
  1504. to --condition AX_USE_RPM_PACKAGING ${PACKAGE_NAME}.spec.in <<EOF
  1505. Summary: @DESCRIPTION@
  1506. Name: @PACKAGE_NAME@
  1507. Version: @VERSION@
  1508. Release: @BUILD_NUMBER@.@DISTRO@
  1509. License: LGPL
  1510. Group: $(if testtag AX_USE_LIBTOOL; then
  1511. echo Development/Libraries/C++;
  1512. else
  1513. echo @RPM_GROUP@;
  1514. fi)
  1515. $(if testtag AX_RPM_DEPEND; then echo "Requires: @RPM_DEPEND@"; fi)
  1516. Source0: %{name}-%{version}.tar.gz
  1517. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
  1518. BuildRequires: which, pkgconfig, gnupg, expect, ${VCSDEPENDS_RPM}make, automake, autoconf, rpm-build$(
  1519. if testtag AX_USE_CXX; then
  1520. echo -n ", binutils-devel, gcc-c++"
  1521. fi
  1522. if testtag AX_USE_CPPUNIT; then
  1523. echo -n ", cppunit-devel"
  1524. fi
  1525. if testtag AX_USE_DOXYGEN; then
  1526. echo -n ", doxygen, graphviz, java-openjdk";
  1527. fi
  1528. if testtag AX_USE_PERLDOC; then
  1529. echo -n ", libpod-tree-perl";
  1530. fi
  1531. ) @RPM_BUILD_DEPEND@ @RPM_DEPEND_IFEXISTS@
  1532. #### os dependent definitions ####
  1533. %if 0%{?suse_version} || 0%{?sles_version}
  1534. BuildRequires: lsb-release$(
  1535. if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
  1536. echo -n ", libqt5-qtbase-devel, libqt5-qttools, libqt5-linguist-devel, libQt5WebKit5-devel libqt5-qtwebengine-devel libQt5WebKitWidgets-devel";
  1537. fi)
  1538. %else
  1539. %if 0%{?mageia}
  1540. BuildRequires: rpm-sign, lsb-release
  1541. $(
  1542. if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
  1543. echo -n "BuildRequires: qtbase5-common-devel, qttools5, lib64qt5webkit-devel, lib64qt5webkitwidgets-devel";
  1544. fi)
  1545. %else
  1546. $(
  1547. if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
  1548. echo -n "BuildRequires: qt5-qtbase-devel, qt5-qttools-devel, qt5-qtwebkit-devel";
  1549. fi)
  1550. BuildRequires: rpm-sign, redhat-lsb
  1551. %global debug_package %{nil}
  1552. %endif
  1553. %endif
  1554. $(
  1555. if testtag AX_USE_DOXYGEN; then cat <<EOS
  1556. %if ! 0%{?centos}
  1557. BuildRequires: mscgen
  1558. %if ! 0%{?mageia}
  1559. BuildRequires: pandoc
  1560. %endif
  1561. %endif
  1562. EOS
  1563. fi
  1564. if testtag AX_USE_LIBTOOL; then cat <<EOS
  1565. %if 0%{?mageia}
  1566. BuildRequires: libtool, libltdl-devel
  1567. %else
  1568. BuildRequires: libtool, libtool-ltdl-devel
  1569. %endif
  1570. EOS
  1571. fi)
  1572. %description
  1573. @README@
  1574. $(if testtag AX_USE_LIBTOOL; then
  1575. echo
  1576. echo This package contains only the shared libraries required at runtime.
  1577. fi)
  1578. $(if ! testtag 'AX_USE_LIBTOOL|AX_USE_CXX'; then
  1579. echo '%global debug_package %{nil}'
  1580. fi)
  1581. %prep
  1582. %setup -q
  1583. ./configure --prefix=/usr \\
  1584. --sysconfdir=/etc \\
  1585. --docdir=/usr/share/doc/packages/@PACKAGE_NAME@ \\
  1586. --libdir=/usr/%_lib
  1587. %build
  1588. make
  1589. %install
  1590. DESTDIR=\$RPM_BUILD_ROOT make install
  1591. %clean
  1592. rm -rf \$RPM_BUILD_ROOT
  1593. %files
  1594. %defattr(-,root,root,-)
  1595. $(if testtag AX_USE_LIBTOOL; then
  1596. echo '/usr/%_lib/*.so.*'
  1597. else
  1598. echo '/usr/bin'
  1599. echo '/usr/share/applications'
  1600. fi)
  1601. /usr/share/@PACKAGE_NAME@
  1602. $(if testtag AX_USE_ETC; then
  1603. cat <<EOF2
  1604. %config
  1605. /etc
  1606. EOF2
  1607. fi)
  1608. %doc
  1609. /usr/share/doc
  1610. $(if testtag AX_USE_LIBTOOL; then
  1611. cat <<EOF2
  1612. %package devel
  1613. Summary: @DESCRIPTION@
  1614. Group: Development/Libraries/C++
  1615. Requires: @PACKAGE_NAME@ = @VERSION@ @RPM_BUILD_DEPEND@
  1616. %description devel
  1617. @README@
  1618. This Package contains all files required for developement.
  1619. %files devel
  1620. %defattr(-,root,root,-)
  1621. /usr/%_lib/*.so
  1622. /usr/%_lib/*.a
  1623. /usr/%_lib/*.la
  1624. /usr/%_lib/pkgconfig
  1625. /usr/include/*
  1626. %doc
  1627. $(if testtag AX_USE_DOXYGEN AX_USE_PERLDOC; then
  1628. echo '/usr/share/doc/packages/@PACKAGE_NAME@/html'
  1629. fi)
  1630. $(if testtag AX_BUILD_EXAMPLES; then
  1631. echo '/usr/share/doc/packages/@PACKAGE_NAME@/examples'
  1632. fi)
  1633. EOF2
  1634. fi)
  1635. %changelog
  1636. EOF
  1637. SUBDIRS=""
  1638. if testtag AX_USE_CXX; then
  1639. SUBDIRS="${SUBDIRS} src"
  1640. fi
  1641. if testtag AX_USE_ETC; then
  1642. SUBDIRS="${SUBDIRS} etc"
  1643. fi
  1644. if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then
  1645. SUBDIRS="${SUBDIRS} test"
  1646. fi
  1647. if testtag AX_USE_SCRIPTS; then
  1648. SUBDIRS="${SUBDIRS} scripts"
  1649. fi
  1650. if testtag 'AX_USE_DOXYGEN|AX_USE_PERLDOC'; then
  1651. SUBDIRS="${SUBDIRS} doc"
  1652. fi
  1653. if testtag AX_BUILD_EXAMPLES; then
  1654. SUBDIRS="${SUBDIRS} examples"
  1655. fi
  1656. if testtag AX_BUILD_HTML; then
  1657. SUBDIRS="${SUBDIRS} html"
  1658. fi
  1659. for d in src test scripts doc examples html; do
  1660. if test -d "$d" -a "${SUBDIRS//$d/}" = "${SUBDIRS}"; then
  1661. SUBDIRS="${SUBDIRS} $d"
  1662. fi
  1663. done
  1664. to --mode "u=rwx,g=rwx,o=rx" autogen.sh <<EOF
  1665. #!/bin/bash -e
  1666. if test -n "$VCS" -a -d ".$VCS" -a -e -x "\$(which ${VCS}2cl)"; then
  1667. $(case "$VCS" in
  1668. (svn) echo " ${VCS}2cl";;
  1669. (git) echo " ${VCS}2cl > ChangeLog";;
  1670. esac)
  1671. fi
  1672. aclocal
  1673. $(if testtag AX_USE_LIBTOOL; then
  1674. cat <<EOF1
  1675. if which libtoolize > /dev/null; then
  1676. run libtoolize --force;
  1677. elif which glibtoolize > /dev/null; then
  1678. run glibtoolize --force;
  1679. else
  1680. echo "error: libtoolize not found" 1>&2
  1681. exit 1
  1682. fi
  1683. EOF1
  1684. fi)
  1685. automake -a
  1686. autoconf
  1687. EOF
  1688. to makefile.am<<EOF
  1689. ${HEADER}SUBDIRS =${SUBDIRS}
  1690. desktopdir = \${datadir}/applications
  1691. desktop_DATA = @PACKAGE_DESKTOP@
  1692. dist_pkgdata_DATA = @PACKAGE_ICON@
  1693. dist_noinst_DATA = ax_check_qt.m4 bootstrap.sh \\
  1694. resolve-rpmbuilddeps.sh autogen.sh \\
  1695. ax_cxx_compile_stdcxx.m4 build-in-docker.sh \\
  1696. build-resource-file.sh \\
  1697. ax_init_standard_project.m4 \\
  1698. mac-create-app-bundle.sh resolve-debbuilddeps.sh \\
  1699. dependency-graph.sh template.sh \\
  1700. sql-to-dot.sed
  1701. dist_doc_DATA = AUTHORS NEWS $README COPYING INSTALL ChangeLog
  1702. $(if test -e README.md -a ! -e README; then
  1703. cat <<EOF2
  1704. README: README.md
  1705. cp README.md README
  1706. CLEANFILES = README
  1707. EOF2
  1708. fi)
  1709. MAINTAINERCLEANFILES = makefile.in
  1710. EOF
  1711. to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF
  1712. ${HEADER}prefix=@prefix@
  1713. exec_prefix=@exec_prefix@
  1714. libdir=\${exec_prefix}/lib
  1715. includedir=\${prefix}/include
  1716. translationsdir=@datadir@/@PACKAGE_NAME@/translations
  1717. Name: @PACKAGE_NAME@
  1718. Description: @DESCRIPTION@
  1719. Version: @VERSION@
  1720. Libs: -L\${libdir} -l${PACKAGE_NAME#lib} @LDFLAGS@
  1721. Cflags: -I\${includedir} @CPPFLAGS@
  1722. Requires: @PKG_REQUIREMENTS@
  1723. EOF
  1724. to build-in-docker.conf <<EOF
  1725. ${HEADER}# Use Ubuntu Universe Repository
  1726. repos+=("ubuntu:::universe")
  1727. # Use Marc Wäckerlin's Repository, see https://repository.mrw.sh
  1728. repos+=("debian|ubuntu:::https://repository.mrw.sh:::https://repository.mrw.sh/@DISTRIBUTOR@/marc-waeckerlin.repo")
  1729. keys+=("https://repository.mrw.sh/PublicKey")
  1730. # centos requires epel-release for some packages, such as Qt WebKit
  1731. packages+=("centos:::epel-release")
  1732. EOF
  1733. #### Cleanup If Makefile Exists ####
  1734. if test -f makefile; then
  1735. run --no-check make maintainer-clean
  1736. fi
  1737. #### Build In Docker If User Requires ####
  1738. if test "$docker" -eq 1; then
  1739. ./build-in-docker.sh $buildtarget $* || exit 1
  1740. else
  1741. #### Bootstrap Before Configure ####
  1742. run --no-check vcs2cl
  1743. run aclocal
  1744. if testtag AX_USE_LIBTOOL; then
  1745. if which libtoolize > /dev/null; then
  1746. run libtoolize --force;
  1747. elif which glibtoolize > /dev/null; then
  1748. run glibtoolize --force;
  1749. else
  1750. error libtoolize not found
  1751. fi
  1752. fi
  1753. run automake -a
  1754. run autoconf
  1755. #### Run Configure If User Requires ####
  1756. if test "$configure" -eq 1; then
  1757. ./configure $* || exit 1
  1758. fi
  1759. #### Run Make If User Requires ####
  1760. if test "$build" -eq 1; then
  1761. make $buildtarget || exit 1
  1762. fi
  1763. fi