C++ Library containing a lot of needful things: Stack Trace, Command Line Parser, Resource Handling, Configuration Files, Unix Command Execution, Directories, Regular Expressions, Tokenizer, Function Trace, Standard Extensions.
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.

bootstrap.sh 60KB

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