challenger

OAuth 2.0-based authentication service that validates user can receive messages at a certain address
Log | Files | Refs | Submodules | README | LICENSE

commit c819304b382fb6a89afc933dbe6caeb7b6aacd27
parent 5fdac75795009a7f4dc0e954997ca8dee66eb15b
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Mon, 27 Apr 2026 10:16:30 +0200

build: convert to meson

Diffstat:
M.gitignore | 53+++--------------------------------------------------
AMakefile.in | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Mbootstrap | 36+++++++++++-------------------------
Aconfigure | 255+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontrib/meson.build | 16++++++++++++++++
Adoc/meson.build | 48++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.lock | 198+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.nix | 124+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dm4/ax_compare_version.m4 | 177-------------------------------------------------------------------------------
Dm4/ax_lib_postgresql.m4 | 247-------------------------------------------------------------------------------
Dm4/ax_prog_doxygen.m4 | 586-------------------------------------------------------------------------------
Dm4/libcurl.m4 | 251-------------------------------------------------------------------------------
Ameson.build | 284+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ameson.options | 5+++++
Ascripts/doxygen.meson.sh | 18++++++++++++++++++
Dsrc/Makefile.am | 3---
Dsrc/challenger/Makefile.am | 84-------------------------------------------------------------------------------
Asrc/challenger/meson.build | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/challengerdb/Makefile.am | 106-------------------------------------------------------------------------------
Asrc/challengerdb/Makefile.sql | 13+++++++++++++
Asrc/challengerdb/meson.build | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/include/Makefile.am | 23-----------------------
Asrc/include/meson.build | 6++++++
Asrc/meson.build | 5+++++
Dsrc/util/Makefile.am | 38--------------------------------------
Asrc/util/meson.build | 40++++++++++++++++++++++++++++++++++++++++
26 files changed, 1278 insertions(+), 1590 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -7,54 +7,7 @@ *.rej .deps/ .libs/ -Makefile -Makefile.in -aclocal.m4 -autom4te.cache/ -compile -config.cache -config.guess -config.log -config.status -config.sub -configure -contrib/uncrustify.sh -depcomp -doc/Makefile -install-sh -libtool -ltmain.sh -missing -src/Makefile -src/Makefile.in -src/util/.deps/ -src/util/.libs/ -src/backend/Makefile -src/backend/Makefile.in -src/include/Makefile -src/include/Makefile.in -src/lib/.deps/ -src/lib/Makefile -src/lib/Makefile.in -stamp-h1 -test-driver +build/ uncrustify.cfg -doc/Makefile.in -m4/libtool.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/ltversion.m4 -m4/lt~obsolete.m4 -*.swp -src/lib/.libs -*.lo -*.o -*.la -src/util/.deps/ -doc/Makefile.in -src/include/Makefile.in -challenger_config.h -challenger_config.h.in -src/challenger/challenger-httpd -src/testing/test_challenger_api_home/.local/share/taler/auditors/ -src/testing/test_challenger_api_home/.local/share/taler/exchange-secmod-cs/ +config.status +Makefile diff --git a/Makefile.in b/Makefile.in @@ -0,0 +1,49 @@ +# Build the program in the local tree +.PHONY: all +all: + $(NINJA) -C $(mesonbuilddir) + +# Install the program +.PHONY: install +install: all + $(MESON) install -C $(mesonbuilddir) + +# Remove files created during 'all' +.PHONY: clean +clean: + $(NINJA) -C $(mesonbuilddir) -t clean + +# Remove files created during 'install' +.PHONY: uninstall +uninstall: + $(NINJA) uninstall -C $(mesonbuilddir) + +# Make tarball +.PHONY: dist +dist: + $(MESON) dist -C $(mesonbuilddir) --no-tests --formats gztar + +# Make doxygen +.PHONY: doxygen +doxygen: + $(NINJA) -C $(mesonbuilddir) doxygen + +# Run tests +.PHONY: check +check: + $(MESON) test -C $(mesonbuilddir) + +.PHONY: installcheck +installcheck: + $(MESON) test -C $(mesonbuilddir) --suite=installcheck + +.PHONY: integrationtests +integrationtests: + $(MESON) test -C $(mesonbuilddir) --suite=integrationtests + +format: + $(MESON) fmt -i -r . + #find ./src -name "*.[h,c]" | uncrustify -l c -c contrib/conf/uncrustify.cfg -F - --replace --no-backup + +Makefile: Makefile.in + ./config.status diff --git a/bootstrap b/bootstrap @@ -8,16 +8,17 @@ if ! git --version >/dev/null; then exit 1 fi -# Make sure that "git pull" et al. also update -# submodules to avoid accidental rollbacks. -git config --local submodule.recurse true - -# Beware: We only want to update submodules to the commit hash -# stored in git, otherwise builds based on tags will not be -# reproducible. -echo "$0: Updating submodules" -echo | git submodule update --init --force - +if [ -d .git ]; then + # Make sure that "git pull" et al. also update + # submodules to avoid accidental rollbacks. + git config --local submodule.recurse true + + # Beware: We only want to update submodules to the commit hash + # stored in git, otherwise builds based on tags will not be + # reproducible. + echo "$0: Updating submodules" + echo | git submodule update --init --force +fi ./contrib/check-prebuilt # This is more portable than `which' but comes with @@ -38,18 +39,3 @@ if existence uncrustify; then else echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development" fi - -# Generate Makefile.am in contrib/ -cd contrib -rm -f Makefile.am -find wallet-core/challenger/ -type f -printf ' %p \\\n' | sort > Makefile.am.ext -# Remove extra '\' at the end of the file -truncate -s -2 Makefile.am.ext -cat Makefile.am.in Makefile.am.ext >> Makefile.am -# Prevent accidental editing of the generated Makefile.am -chmod -w Makefile.am -cd .. - - -echo "$0: Running autoreconf" -autoreconf -if diff --git a/configure b/configure @@ -0,0 +1,255 @@ +#!/bin/sh + +pkg_name="challenger" +pkg_default_features="" +pkg_optional_features="coverage logging only-doc install-rpath" +pkg_optional_dependencies="" + +# DO NOT EDIT BELOW THIS LINE +standard_dirs="prefix exec_prefix bindir sbindir libexecdir sysconfdir sharedstatedir localstatedir runstatedir libdir includedir oldincludedir datarootdir datadir infodir localedir mandir docdir htmldir dvidir pdfdir psdir srcdir mesonbuilddir" +standard_utils="AR AS BISON CC CXX CPP FLEX INSTALL LD LDCONFIG LEX MAKE MAKEINFO RANLIB TEXI2DVI YACC CHGRP CHMOD CHOWN MKNOD RM NINJA MESON" +standard_flags="ARFLAGS BISONFLAGS CFLAGS CXXFLAGS CPPFLAGS FLEXFLAGS INSTALLFLAGS LDFLAGS LDCONFIGFLAGS LFLAGS MAKEFLAGS MAKEINFOFLAGS RANLIBFLAGS TEXI2DVIFLAGS YACCFLAGS CHGRPFLAGS CHMODFLAGS CHOWNFLAGS MKNODFLAGS" +standard_vars="INSTALL_DATA INSTALL_PROGRAM INSTALL_SCRIPT" +generated_comment="# This file was generated by configure. DO NOT edit it directly." + +# Save arguments +cat > config.status <<EOF +#!/bin/sh +$generated_comment +$0 $* +EOF +chmod 755 config.status + +# Parse arguments +oldifs="$IFS" +while [ "$#" -gt "0" ]; do + arg="$1" + shift + argsave="$@" + + IFS="=" + set -- $arg + IFS="$oldifs" + arg="$1" + shift + argparam="$@" + + case "$arg" in + --help|-h) + cat <<-EOF + Usage: $0 [options...] + General options: + + <variable>=<value> Overrides default utils and flags, e.g. CC=gcc + EOF + echo "" + echo "Directory variables:" + for sdir in $standard_dirs; do + echo "--$sdir=<directory>" + done + echo "" + echo "Options specific to $pkg_name:" + for feat in $pkg_optional_features; do + echo "--enable-$feat[=arg]" + done + for feat in $pkg_default_features; do + echo "--disable-$feat" + done + for dep in $pkg_optional_dependencies; do + echo "--with-$dep" + done + + echo + echo Other options will be ignored. Please see the README for additional information. + exit 0 + ;; + --enable-*) + for feat in $pkg_optional_features $pkg_default_features; do + ft=$(echo $feat | tr - _) + if [ "--enable-$feat" = "$arg" ] && [ -z "$argparam" ]; then + eval "enable_$ft=true" + elif [ "--enable-$feat" = "$arg" ]; then + if [ "$argparam" = "yes" ]; then + eval "enable_$ft=\"true\"" + else + eval "enable_$ft=\"$argparam\"" + fi + fi + done + ;; + --disable-*) + argsave="--enable-${arg#--disable-}=false $argsave" + ;; + --with-*) + for dep in $pkg_optional_dependencies; do + if [ "--with-$dep" = "$arg" ] && [ -z "$argparam" ]; then + eval "with_$dep=yes" + elif [ "--with-$dep" = "$arg" ]; then + eval "with_$dep=\"$argparam\"" + fi + done + ;; + --without-*) + argsave="--with-${arg#--without-}=no $argsave" + ;; + --*) + for dir in $standard_dirs; do + [ "--$dir" = "$arg" ] && eval "var_$dir=\"$argparam\"" + done + ;; + *) + for flag in $standard_utils $standard_flags standard_vars; do + [ "$flag" = "$arg" ] && eval "$flag=\"$argparam\"" + done + ;; + esac + + set -- $argsave +done + +# Set default values +for util in $standard_utils; do + case "$util" in + CPP) eval "$util=\"\${${util}:-\\\$(CC) -E}\"" ;; + CXX) eval "$util=\"\${${util}:-g++}\"" ;; + RM) eval "$util=\"\${${util}:-rm -f}\"" ;; + MESON) eval "$util=\"\${${util}:-meson}\"" ;; + NINJA) eval "$util=\"\${${util}:-ninja}\"" ;; + *) eval "$util=\"\${${util}:-${util}}\"" ;; + esac +done +for feat in $pkg_optional_features; do + ft=$(echo $feat | tr - _) + eval "enable_$ft=\${enable_$ft:-false}" +done +for feat in $pkg_default_features; do + eval "enable_$feat=\${enable_$feat:-true}" +done +for feat in $pkg_optional_dependencies; do + eval "with_$feat=\${with_$feat:-no}" +done + +# Find source files +if [ -z "$var_srcdir" ]; then + [ -f ../Makefile.in ] && var_srcdir=.. + [ -f ./Makefile.in ] && var_srcdir=. +fi +if [ -z "$var_srcdir" ]; then + echo "Source files not found. Please specify a directory using --srcdir=..." >&2 + exit 1 +fi + +# Write Makefile +cat > Makefile <<EOF +$generated_comment +SHELL = /bin/sh +VPATH = ${var_srcdir} + +mesonbuilddir = ${var_mesonbuilddir:-build} +srcdir = ${var_srcdir} +prefix = ${var_prefix:-/usr/local} +exec_prefix = ${var_exec_prefix:-\$(prefix)} +bindir = ${var_bindir:-\$(exec_prefix)/bin} +sbindir = ${var_sbindir:-\$(exec_prefix)/sbin} +libexecdir = ${var_libexecdir:-\$(exec_prefix)/libexec} +datarootdir = ${var_datarootdir:-\$(prefix)/share} +datadir = ${var_datadir:-\$(datarootdir)} +sysconfdir = ${var_sysconfdir:-\$(prefix)/etc} +sharedstatedir = ${var_sharedstatedir:-\$(prefix)/com} +localstatedir = ${var_localstatedir:-\$(prefix)/var} +runstatedir = ${var_runstatedir:-\$(localstatedir)/run} +includedir = ${var_includedir:-\$(prefix)/include} +oldincludedir = ${var_oldincludedir:-/usr/include} +docdir = ${var_docdir:-\$(datarootdir)/doc/"$pkg_name"} +infodir = ${var_infodir:-\$(datarootdir)/info} +htmldir = ${var_htmldir:-\$(docdir)} +dvidir = ${var_dvidir:-\$(docdir)} +pdfdir = ${var_pdfdir:-\$(docdir)} +psdir = ${var_psdir:-\$(docdir)} +libdir = ${var_libdir:-\$(exec_prefix)/lib} +lispdir = ${var_lispdir:-\$(datarootdir)/emacs/site-lisp} +localedir = ${var_localedir:-\$(datarootdir)/locale} +mandir = ${var_mandir:-\$(datarootdir)/man} +manext = .1 +EOF + +if [ -d ${var_mesonbuilddir:-build} ]; then + echo "${var_mesonbuilddir:-build} already exists, deleting with" + $RM -r ${var_mesonbuilddir:-build} || exit 1 +fi + +for var in $standard_utils $standard_flags $standard_vars; do + eval "echo \"${var} = \$${var}\" >> Makefile" +done +echo >> Makefile + +mesonfeatopts="" +for feat in $pkg_optional_features $pkg_default_features; do + ft=$(echo $feat | tr - _) + eval "echo \"enable_$ft=\${enable_$ft}\" >> Makefile" + if [ "coverage" = $feat ]; then + mfeat="b_$feat" + else + mfeat=$feat + fi + eval "mesonfeatopts=\"$mesonfeatopts -D$mfeat=\${enable_$ft}\"" +done +for dep in $pkg_optional_dependencies; do + eval "echo \"with_$dep=\${with_$dep}\" >> Makefile" +done +echo >> Makefile + +cat "${var_srcdir}/Makefile.in" >> Makefile + +# Create default targets, if not already present +default_target() { + grep "^$1:" Makefile >/dev/null && return + echo ".PHONY: $1" >> Makefile + echo "$1: $2" >> Makefile + cat >> Makefile + echo >> Makefile +} + +#default_target Makefile <<EOF +# ./config.status +#EOF +for format in html dvi pdf ps; do + default_target "$format" </dev/null + default_target "install-$format" "$format" </dev/null +done +default_target check </dev/null +default_target mostlyclean clean </dev/null +default_target distclean clean <<EOF + \$(RM) Makefile config.status +EOF +default_target maintainer-clean distclean </dev/null +default_target install-strip <<EOF + \$(MAKE) INSTALL_PROGRAM='\$(INSTALL_PROGRAM) -s' \\ + INSTALL_SCRIPT='\$(INSTALL_SCRIPT)' install +EOF + +mesondiropts="" +for dr in $standard_dirs; do + if [ $dr = "srcdir" ]; then + continue + fi + if [ $dr = "mesonbuilddir" ]; then + continue + fi + eval "vn=\${var_$dr}" + if [ ! -z $vn ]; then + eval "mesondiropts=\"$mesondiropts -D$dr=\${var_$dr}\"" + fi +done + +${MESON} setup \ + -Ddefault_library=shared \ + $mesondiropts \ + $mesonfeatopts \ + ${var_mesonbuilddir:-build} \ + ${var_srcdir} || exit 1 + +# Done +echo "Package $pkg_name configured successfully." +echo "Run 'make' to build and 'make install' to install the package" + diff --git a/contrib/meson.build b/contrib/meson.build @@ -0,0 +1,16 @@ +# This file is in the public domain. + +configure_file( + input: 'challenger-dbconfig', + output: 'challenger-dbconfig', + copy: true, + install: true, + install_dir: get_option('bindir'), +) + + +install_subdir( + 'wallet-core' / 'challenger', + strip_directory: true, + install_dir: get_option('datadir') / 'challenger' / 'spa', +) diff --git a/doc/meson.build b/doc/meson.build @@ -0,0 +1,48 @@ +# This file is in the public domain + +install_man([ + 'prebuilt'/'man'/'challenger-admin.1', + 'prebuilt'/'man'/'challenger-config.1', + 'prebuilt'/'man'/'challenger-dbconfig.1', + 'prebuilt'/'man'/'challenger-dbinit.1', + 'prebuilt'/'man'/'challenger-httpd.1', + 'prebuilt'/'man'/'challenger.conf.5', + ],) + +fs = import('fs') + +fs.copyfile( + 'prebuilt' / 'texinfo' / 'challenger.texi', + 'challenger.texi', +) + +makeinfo = find_program('makeinfo', native: true, required: false) + +if makeinfo.found() + + f_info = '@0@.info'.format('challenger') + f_texi = meson.current_build_dir() / '@0@.texi'.format('challenger') + + custom_target( + f_info, + output: f_info, + command: [ + makeinfo, + '--no-split', + '--no-headers', + f_texi, + '-o', + '@OUTPUT0@', + ], + install: true, + install_dir: get_option('infodir'), + ) + +endif + + +install_emptydir(get_option('infodir') / 'challenger-figures') +install_data( + 'prebuilt' / 'texinfo' / 'challenger-figures' / 'challenger.png', + install_dir: get_option('infodir') / 'challenger-figures', +) diff --git a/flake.lock b/flake.lock @@ -0,0 +1,198 @@ +{ + "nodes": { + "exchange": { + "inputs": { + "gnunet": "gnunet", + "nixpkgs": "nixpkgs_2", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1776021477, + "narHash": "sha256-V6qYPCNgaalQi6tRkDZ+Per3PPifm1Ze2pShV6LGomg=", + "ref": "refs/heads/master", + "rev": "92da4e81006404494f6443781c8f55249e723847", + "revCount": 9932, + "submodules": true, + "type": "git", + "url": "https://git.gnunet.org/exchange" + }, + "original": { + "rev": "92da4e81006404494f6443781c8f55249e723847", + "type": "git", + "url": "https://git.gnunet.org/exchange" + } + }, + "gnunet": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1774899416, + "narHash": "sha256-YcGma1gX/t76xDv9DW71nKkWFhzXYz3NkN/WEceHbZM=", + "ref": "refs/heads/master", + "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", + "revCount": 33194, + "submodules": true, + "type": "git", + "url": "https://git.gnunet.org/gnunet" + }, + "original": { + "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", + "type": "git", + "url": "https://git.gnunet.org/gnunet" + } + }, + "gnunet_2": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "systems": "systems_3" + }, + "locked": { + "lastModified": 1774899416, + "narHash": "sha256-YcGma1gX/t76xDv9DW71nKkWFhzXYz3NkN/WEceHbZM=", + "ref": "refs/heads/master", + "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", + "revCount": 33194, + "submodules": true, + "type": "git", + "url": "https://git.gnunet.org/gnunet" + }, + "original": { + "rev": "7c6b613e37e301b0e81fb94af5878d00c98e5b75", + "type": "git", + "url": "https://git.gnunet.org/gnunet" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1774799055, + "narHash": "sha256-Tsq9BCz0q47ej1uFF39m4tuhcwru/ls6vCCJzutEpaw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "107cba9eb4a8d8c9f8e9e61266d78d340867913a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "release-25.11", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1774799055, + "narHash": "sha256-Tsq9BCz0q47ej1uFF39m4tuhcwru/ls6vCCJzutEpaw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "107cba9eb4a8d8c9f8e9e61266d78d340867913a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "release-25.11", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1774799055, + "narHash": "sha256-Tsq9BCz0q47ej1uFF39m4tuhcwru/ls6vCCJzutEpaw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "107cba9eb4a8d8c9f8e9e61266d78d340867913a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "release-25.11", + "type": "indirect" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1777271619, + "narHash": "sha256-gmurzpuuS5N90jEbbW7+T/cyC+SadLscpx3TPYTxfug=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8b598dd23b56ebd1db9707c9cdd7ff3797abad19", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "release-25.11", + "type": "indirect" + } + }, + "root": { + "inputs": { + "exchange": "exchange", + "gnunet": "gnunet_2", + "nixpkgs": "nixpkgs_4", + "systems": "systems_4" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,124 @@ +# This is a nix flake. To use it, you need nix (with flake support) installed. +# If you do not have nix and do not intend to use it, you can ignore this file. +# Why should you use it? Using this flake will allow you to enter a developer shell +# which has all necessary packages for this repository already installed. +# The shell will allow you to code against the specific revisions of the dependencies +# pinned in this file. +# This is useful when git HEAD of your dependencies already contains breaking changes +# you should not (yet) code against. +# OTOH, if you should code against a newer, not yet released revision, you can specify +# this revision in this file. +# You can use this file in three ways: +# 1. Build: $ nix build +# this will build the package (it runs make for you in an environment with the dependencies installed) +# 2. Develop: $ nix develop +# This will drop you inside a shell in which you can develop and compile (and test) your code. +# It even starts and sets up the test database for you. +# 3. Use this repository in a new project +# Should you create a new project that depends on this project you are in luck. You can create a flake.nix +# in your repository and include this packages as a dependency just like the dependencies of this package are +# included here. + +{ + inputs = { + nixpkgs.url = "nixpkgs/release-25.11"; + systems.url = "github:nix-systems/default"; + gnunet.url = "git+https://git.gnunet.org/gnunet?rev=7c6b613e37e301b0e81fb94af5878d00c98e5b75"; + exchange.url = "git+https://git.gnunet.org/exchange?rev=92da4e81006404494f6443781c8f55249e723847"; + #merchant.url = "git+https://git.gnunet.org/merchant?rev=b174138726171601b666fff346762502be5150a1"; + #donau.url = "git+https://git.gnunet.org/donau?rev=4f609168fe263891f134eff01f86288066acdd81"; + self.submodules = true; + }; + + outputs = { self, nixpkgs, gnunet, exchange, systems, ... } @ inputs: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forEachSystem = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; }); + in + { + # This defines (installable) package derivations + # For use in flakes that use this flake as input in order + # to specify/use this package from git as a dependency + packages = forEachSystem (system: + let + pkgs = nixpkgsFor.${system}; + gnunetpkgs = gnunet.packages.${system}; + exchangepkgs = exchange.packages.${system}; + #donaupkgs = donau.packages.${system}; + #merchantpkgs = merchant.packages.${system}; + in { + challenger = pkgs.stdenv.mkDerivation { + name = "taler-mdb"; + src = ./.; + nativeBuildInputs = [ + pkgs.gnumake + pkgs.meson + pkgs.ninja + pkgs.pkg-config + ]; + buildInputs = [ + pkgs.libtool + pkgs.jansson + pkgs.git + pkgs.libmicrohttpd + pkgs.libgcrypt + pkgs.libunistring + pkgs.curlWithGnuTls + pkgs.libnfc + gnunetpkgs.gnunet + exchangepkgs.exchange + #donaupkgs.donau + #merchantpkgs.merchant + ]; + preConfigure = '' + patchShebangs --build contrib/check-prebuilt + ./bootstrap + ''; + }; + } + ); + defaultPackage = forEachSystem (system: self.packages.${system}.challenger); + # This defines a development shell in which you can compile + # (and use) exchange + devShells = forEachSystem + (system: + let + pkgs = nixpkgsFor.${system}; + gnunetpkgs = gnunet.packages.${system}; + exchangepkgs = exchange.packages.${system}; + #donaupkgs = donau.packages.${system}; + #merchantpkgs = merchant.packages.${system}; + in + { + default = pkgs.mkShell { + packages = [ + pkgs.gcc + pkgs.meson + pkgs.ninja + pkgs.gnumake + pkgs.pkg-config + pkgs.libtool + pkgs.jansson + pkgs.git + pkgs.curlWithGnuTls + gnunetpkgs.gnunet + pkgs.codespell + pkgs.clang-tools + pkgs.uncrustify + pkgs.libnfc + exchangepkgs.exchange + pkgs.python3 + #donaupkgs.donau + #merchantpkgs.merchant + ]; + + shellHook = '' + echo "taler-mdb environment loaded." + export CC=gcc + export CFLAGS="-O" + ''; + }; + }); + }; +} diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4 @@ -1,177 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# -# DESCRIPTION -# -# This macro compares two version strings. Due to the various number of -# minor-version numbers that can exist, and the fact that string -# comparisons are not compatible with numeric comparisons, this is not -# necessarily trivial to do in a autoconf script. This macro makes doing -# these comparisons easy. -# -# The six basic comparisons are available, as well as checking equality -# limited to a certain number of minor-version levels. -# -# The operator OP determines what type of comparison to do, and can be one -# of: -# -# eq - equal (test A == B) -# ne - not equal (test A != B) -# le - less than or equal (test A <= B) -# ge - greater than or equal (test A >= B) -# lt - less than (test A < B) -# gt - greater than (test A > B) -# -# Additionally, the eq and ne operator can have a number after it to limit -# the test to that number of minor versions. -# -# eq0 - equal up to the length of the shorter version -# ne0 - not equal up to the length of the shorter version -# eqN - equal up to N sub-version levels -# neN - not equal up to N sub-version levels -# -# When the condition is true, shell commands ACTION-IF-TRUE are run, -# otherwise shell commands ACTION-IF-FALSE are run. The environment -# variable 'ax_compare_version' is always set to either 'true' or 'false' -# as well. -# -# Examples: -# -# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) -# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) -# -# would both be true. -# -# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) -# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) -# -# would both be false. -# -# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) -# -# would be true because it is only comparing two minor versions. -# -# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) -# -# would be true because it is only comparing the lesser number of minor -# versions of the two values. -# -# Note: The characters that separate the version numbers do not matter. An -# empty string is the same as version 0. OP is evaluated by autoconf, not -# configure, so must be a string, not a variable. -# -# The author would like to acknowledge Guido Draheim whose advice about -# the m4_case and m4_ifvaln functions make this macro only include the -# portions necessary to perform the specific comparison specified by the -# OP argument in the final configure script. -# -# LICENSE -# -# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 13 - -dnl ######################################################################### -AC_DEFUN([AX_COMPARE_VERSION], [ - AC_REQUIRE([AC_PROG_AWK]) - - # Used to indicate true or false condition - ax_compare_version=false - - # Convert the two version strings to be compared into a format that - # allows a simple string comparison. The end result is that a version - # string of the form 1.12.5-r617 will be converted to the form - # 0001001200050617. In other words, each number is zero padded to four - # digits, and non digits are removed. - AS_VAR_PUSHDEF([A],[ax_compare_version_A]) - A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ - -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ - -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ - -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ - -e 's/[[^0-9]]//g'` - - AS_VAR_PUSHDEF([B],[ax_compare_version_B]) - B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ - -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ - -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ - -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ - -e 's/[[^0-9]]//g'` - - dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary - dnl # then the first line is used to determine if the condition is true. - dnl # The sed right after the echo is to remove any indented white space. - m4_case(m4_tolower($2), - [lt],[ - ax_compare_version=`echo "x$A -x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` - ], - [gt],[ - ax_compare_version=`echo "x$A -x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` - ], - [le],[ - ax_compare_version=`echo "x$A -x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` - ], - [ge],[ - ax_compare_version=`echo "x$A -x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` - ],[ - dnl Split the operator from the subversion count if present. - m4_bmatch(m4_substr($2,2), - [0],[ - # A count of zero means use the length of the shorter version. - # Determine the number of characters in A and B. - ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` - ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` - - # Set A to no more than B's length and B to no more than A's length. - A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` - B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` - ], - [[0-9]+],[ - # A count greater than zero means use only that many subversions - A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` - B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` - ], - [.+],[ - AC_WARNING( - [invalid OP numeric parameter: $2]) - ],[]) - - # Pad zeros at end of numbers to make same length. - ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" - B="$B`echo $A | sed 's/./0/g'`" - A="$ax_compare_version_tmp_A" - - # Check for equality or inequality as necessary. - m4_case(m4_tolower(m4_substr($2,0,2)), - [eq],[ - test "x$A" = "x$B" && ax_compare_version=true - ], - [ne],[ - test "x$A" != "x$B" && ax_compare_version=true - ],[ - AC_WARNING([invalid OP parameter: $2]) - ]) - ]) - - AS_VAR_POPDEF([A])dnl - AS_VAR_POPDEF([B])dnl - - dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. - if test "$ax_compare_version" = "true" ; then - m4_ifvaln([$4],[$4],[:])dnl - m4_ifvaln([$5],[else $5])dnl - fi -]) dnl AX_COMPARE_VERSION diff --git a/m4/ax_lib_postgresql.m4 b/m4/ax_lib_postgresql.m4 @@ -1,247 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_POSTGRESQL([MINIMUM-VERSION],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# This macro provides tests of availability of PostgreSQL 'libpq' library -# of particular version or newer. -# -# AX_LIB_POSTGRESQL macro takes only one argument which is optional. If -# there is no required version passed, then macro does not run version -# test. -# -# The --with-postgresql option takes one of three possible values: -# -# no - do not check for PostgreSQL client library -# -# yes - do check for PostgreSQL library in standard locations (pg_config -# should be in the PATH) -# -# path - complete path to pg_config utility, use this option if pg_config -# can't be found in the PATH (You could set also PG_CONFIG variable) -# -# This macro calls: -# -# AC_SUBST(POSTGRESQL_CPPFLAGS) -# AC_SUBST(POSTGRESQL_LDFLAGS) -# AC_SUBST(POSTGRESQL_LIBS) -# AC_SUBST(POSTGRESQL_VERSION) -# -# And sets: -# -# HAVE_POSTGRESQL -# -# It execute if found ACTION-IF-FOUND (empty by default) and -# ACTION-IF-NOT-FOUND (AC_MSG_FAILURE by default) if not found. -# -# LICENSE -# -# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net> -# Copyright (c) 2014 Sree Harsha Totakura <sreeharsha@totakura.in> -# Copyright (c) 2018 Bastien Roucaries <rouca@debian.org> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 22 - -AC_DEFUN([_AX_LIB_POSTGRESQL_OLD],[ - found_postgresql="no" - _AX_LIB_POSTGRESQL_OLD_fail="no" - while true; do - AC_CACHE_CHECK([for the pg_config program], [ac_cv_path_PG_CONFIG], - [AC_PATH_PROGS_FEATURE_CHECK([PG_CONFIG], [pg_config], - [[ac_cv_path_PG_CONFIG="";$ac_path_PG_CONFIG --includedir > /dev/null \ - && ac_cv_path_PG_CONFIG=$ac_path_PG_CONFIG ac_path_PG_CONFIG_found=:]], - [ac_cv_path_PG_CONFIG=""])]) - PG_CONFIG=$ac_cv_path_PG_CONFIG - AS_IF([test "X$PG_CONFIG" = "X"],[break]) - - AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS], - [ac_cv_POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS" - - AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS], - [ac_cv_POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir`" || _AX_LIB_POSTGRESQL_OLD_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS" - - AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS], - [ac_cv_POSTGRESQL_LIBS="-lpq"]) - POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS" - - AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION], - [ - ac_cv_POSTGRESQL_VERSION=`$PG_CONFIG --version | sed "s/^PostgreSQL[[[:space:]]][[[:space:]]]*\([[0-9.]][[0-9.]]*\).*/\1/"` \ - || _AX_LIB_POSTGRESQL_OLD_fail=yes - ]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_OLD_fail" = "Xyes"],[break]) - POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION" - - - dnl - dnl Check if required version of PostgreSQL is available - dnl - AS_IF([test X"$postgresql_version_req" != "X"],[ - AC_MSG_CHECKING([if PostgreSQL version $POSTGRESQL_VERSION is >= $postgresql_version_req]) - AX_COMPARE_VERSION([$POSTGRESQL_VERSION],[ge],[$postgresql_version_req], - [found_postgresql_req_version=yes],[found_postgresql_req_version=no]) - AC_MSG_RESULT([$found_postgresql_req_version]) - ]) - AS_IF([test "Xfound_postgresql_req_version" = "Xno"],[break]) - - found_postgresql="yes" - break - done -]) - -AC_DEFUN([_AX_LIB_POSTGRESQL_PKG_CONFIG], -[ - AC_REQUIRE([PKG_PROG_PKG_CONFIG]) - found_postgresql=no - - while true; do - PKG_PROG_PKG_CONFIG - AS_IF([test X$PKG_CONFIG = X],[break]) - - _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=no; - AS_IF([test "X$postgresql_version_req" = "X"], - [PKG_CHECK_EXISTS([libpq],[found_postgresql_pkg_config=yes],[found_postgresql=no])], - [PKG_CHECK_EXISTS([libpq >= "$postgresql_version_req"], - [found_postgresql=yes],[found_postgresql=no])]) - AS_IF([test "X$found_postgresql" = "no"],[break]) - - AC_CACHE_CHECK([for the PostgreSQL libraries CPPFLAGS],[ac_cv_POSTGRESQL_CPPFLAGS], - [ac_cv_POSTGRESQL_CPPFLAGS="`$PKG_CONFIG libpq --cflags-only-I`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_CPPFLAGS="$ac_cv_POSTGRESQL_CPPFLAGS" - - - AC_CACHE_CHECK([for the PostgreSQL libraries LDFLAGS],[ac_cv_POSTGRESQL_LDFLAGS], - [ac_cv_POSTGRESQL_LDFLAGS="`$PKG_CONFIG libpq --libs-only-L --libs-only-other`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_LDFLAGS="$ac_cv_POSTGRESQL_LDFLAGS" - - - AC_CACHE_CHECK([for the PostgreSQL libraries LIBS],[ac_cv_POSTGRESQL_LIBS], - [ac_cv_POSTGRESQL_LIBS="`$PKG_CONFIG libpq --libs-only-l`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=ye]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_LIBS="$ac_cv_POSTGRESQL_LIBS" - - dnl already checked by exist but need to be recovered - AC_CACHE_CHECK([for the PostgreSQL version],[ac_cv_POSTGRESQL_VERSION], - [ac_cv_POSTGRESQL_VERSION="`$PKG_CONFIG libpq --modversion`" || _AX_LIB_POSTGRESQL_PKG_CONFIG_fail=yes]) - AS_IF([test "X$_AX_LIB_POSTGRESQL_PKG_CONFIG_fail" = "Xyes"],[break]) - POSTGRESQL_VERSION="$ac_cv_POSTGRESQL_VERSION" - - found_postgresql=yes - break; - done - -]) - - - -AC_DEFUN([AX_LIB_POSTGRESQL], -[ - AC_ARG_WITH([postgresql], - AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@], - [use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config] - ), - [ - AS_CASE([$withval], - [[[nN]][[oO]]],[want_postgresql="no"], - [[[yY]][[eE]][[sS]]],[want_postgresql="yes"], - [ - want_postgresql="yes" - PG_CONFIG="$withval" - ]) - ], - [want_postgresql="yes"] - ) - - AC_ARG_VAR([POSTGRESQL_CPPFLAGS],[cpp flags for PostgreSQL overriding detected flags]) - AC_ARG_VAR([POSTGRESQL_LIBFLAGS],[libs for PostgreSQL overriding detected flags]) - AC_ARG_VAR([POSTGRESQL_LDFLAGS],[linker flags for PostgreSQL overriding detected flags]) - - # populate cache - AS_IF([test "X$POSTGRESQL_CPPFLAGS" != X],[ac_cv_POSTGRESQL_CPPFLAGS="$POSTGRESQL_CPPFLAGS"]) - AS_IF([test "X$POSTGRESQL_LDFLAGS" != X],[ac_cv_POSTGRESQL_LDFLAGS="$POSTGRESQL_LDFLAGS"]) - AS_IF([test "X$POSTGRESQL_LIBS" != X],[ac_cv_POSTGRESQL_LIBS="$POSTGRESQL_LIBS"]) - - postgresql_version_req=ifelse([$1], [], [], [$1]) - found_postgresql="no" - - POSTGRESQL_VERSION="" - - dnl - dnl Check PostgreSQL libraries (libpq) - dnl - AS_IF([test X"$want_postgresql" = "Xyes"],[ - _AX_LIB_POSTGRESQL_PKG_CONFIG - - - AS_IF([test X"$found_postgresql" = "Xno"], - [_AX_LIB_POSTGRESQL_OLD]) - - AS_IF([test X"$found_postgresql" = Xyes],[ - _AX_LIB_POSTGRESQL_OLD_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" - _AX_LIB_POSTGRESQL_OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $POSTGRESQL_LDFLAGS" - _AX_LIB_POSTGRESQL_OLD_LIBS="$LIBS" - LIBS="$LIBS $POSTGRESQL_LIBS" - while true; do - dnl try to compile - AC_CHECK_HEADER([libpq-fe.h],[],[found_postgresql=no]) - AS_IF([test "X$found_postgresql" = "Xno"],[break]) - dnl try now to link - AC_CACHE_CHECK([for the PostgreSQL library linking is working],[ac_cv_postgresql_found], - [ - AC_LINK_IFELSE([ - AC_LANG_PROGRAM( - [ - #include <libpq-fe.h> - ], - [[ - char conninfo[]="dbname = postgres"; - PGconn *conn; - conn = PQconnectdb(conninfo); - ]] - ) - ],[ac_cv_postgresql_found=yes], - [ac_cv_postgresql_found=no]) - ]) - found_postgresql="$ac_cv_postgresql_found" - AS_IF([test "X$found_postgresql" = "Xno"],[break]) - break - done - CPPFLAGS="$_AX_LIB_POSTGRESQL_OLD_CPPFLAGS" - LDFLAGS="$_AX_LIB_POSTGRESQL_OLD_LDFLAGS" - LIBS="$_AX_LIB_POSTGRESQL_OLD_LIBS" - ]) - - - AS_IF([test "x$found_postgresql" = "xyes"],[ - AC_DEFINE([HAVE_POSTGRESQL], [1], - [Define to 1 if PostgreSQL libraries are available])]) - ]) - - AC_SUBST([POSTGRESQL_VERSION]) - AC_SUBST([POSTGRESQL_CPPFLAGS]) - AC_SUBST([POSTGRESQL_LDFLAGS]) - AC_SUBST([POSTGRESQL_LIBS]) - - AS_IF([test "x$found_postgresql" = "xyes"], - [ifelse([$2], , :, [$2])], - [ifelse([$3], , AS_IF([test X"$want_postgresql" = "Xyes"],[AC_MSG_ERROR([Library requirements (PostgreSQL) not met.])],[:]), [$3])]) - -]) diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4 @@ -1,586 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html -# =========================================================================== -# -# SYNOPSIS -# -# DX_INIT_DOXYGEN(PROJECT-NAME, [DOXYFILE-PATH], [OUTPUT-DIR], ...) -# DX_DOXYGEN_FEATURE(ON|OFF) -# DX_DOT_FEATURE(ON|OFF) -# DX_HTML_FEATURE(ON|OFF) -# DX_CHM_FEATURE(ON|OFF) -# DX_CHI_FEATURE(ON|OFF) -# DX_MAN_FEATURE(ON|OFF) -# DX_RTF_FEATURE(ON|OFF) -# DX_XML_FEATURE(ON|OFF) -# DX_PDF_FEATURE(ON|OFF) -# DX_PS_FEATURE(ON|OFF) -# -# DESCRIPTION -# -# The DX_*_FEATURE macros control the default setting for the given -# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for -# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML -# help (for MS users), 'CHI' for generating a separate .chi file by the -# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate -# output formats. The environment variable DOXYGEN_PAPER_SIZE may be -# specified to override the default 'a4wide' paper size. -# -# By default, HTML, PDF and PS documentation is generated as this seems to -# be the most popular and portable combination. MAN pages created by -# Doxygen are usually problematic, though by picking an appropriate subset -# and doing some massaging they might be better than nothing. CHM and RTF -# are specific for MS (note that you can't generate both HTML and CHM at -# the same time). The XML is rather useless unless you apply specialized -# post-processing to it. -# -# The macros mainly control the default state of the feature. The use can -# override the default by specifying --enable or --disable. The macros -# ensure that contradictory flags are not given (e.g., -# --enable-doxygen-html and --enable-doxygen-chm, -# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each -# feature will be automatically disabled (with a warning) if the required -# programs are missing. -# -# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN -# with the following parameters: a one-word name for the project for use -# as a filename base etc., an optional configuration file name (the -# default is '$(srcdir)/Doxyfile', the same as Doxygen's default), and an -# optional output directory name (the default is 'doxygen-doc'). To run -# doxygen multiple times for different configuration files and output -# directories provide more parameters: the second, forth, sixth, etc -# parameter are configuration file names and the third, fifth, seventh, -# etc parameter are output directories. No checking is done to catch -# duplicates. -# -# Automake Support -# -# The DX_RULES substitution can be used to add all needed rules to the -# Makefile. Note that this is a substitution without being a variable: -# only the @DX_RULES@ syntax will work. -# -# The provided targets are: -# -# doxygen-doc: Generate all doxygen documentation. -# -# doxygen-run: Run doxygen, which will generate some of the -# documentation (HTML, CHM, CHI, MAN, RTF, XML) -# but will not do the post processing required -# for the rest of it (PS, PDF). -# -# doxygen-ps: Generate doxygen PostScript documentation. -# -# doxygen-pdf: Generate doxygen PDF documentation. -# -# Note that by default these are not integrated into the automake targets. -# If doxygen is used to generate man pages, you can achieve this -# integration by setting man3_MANS to the list of man pages generated and -# then adding the dependency: -# -# $(man3_MANS): doxygen-doc -# -# This will cause make to run doxygen and generate all the documentation. -# -# The following variable is intended for use in Makefile.am: -# -# DX_CLEANFILES = everything to clean. -# -# Then add this variable to MOSTLYCLEANFILES. -# -# LICENSE -# -# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org> -# Copyright (c) 2015 Olaf Mandel <olaf@mandel.name> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 23 - -## ----------## -## Defaults. ## -## ----------## - -DX_ENV="" -AC_DEFUN([DX_FEATURE_doc], ON) -AC_DEFUN([DX_FEATURE_dot], OFF) -AC_DEFUN([DX_FEATURE_man], OFF) -AC_DEFUN([DX_FEATURE_html], ON) -AC_DEFUN([DX_FEATURE_chm], OFF) -AC_DEFUN([DX_FEATURE_chi], OFF) -AC_DEFUN([DX_FEATURE_rtf], OFF) -AC_DEFUN([DX_FEATURE_xml], OFF) -AC_DEFUN([DX_FEATURE_pdf], ON) -AC_DEFUN([DX_FEATURE_ps], ON) - -## --------------- ## -## Private macros. ## -## --------------- ## - -# DX_ENV_APPEND(VARIABLE, VALUE) -# ------------------------------ -# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen and add it -# as a substitution (but not a Makefile variable). The substitution -# is skipped if the variable name is VERSION. -AC_DEFUN([DX_ENV_APPEND], -[AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl -m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl -AM_SUBST_NOTMAKE([$1])])dnl -]) - -# DX_DIRNAME_EXPR -# --------------- -# Expand into a shell expression prints the directory part of a path. -AC_DEFUN([DX_DIRNAME_EXPR], - [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) - -# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) -# ------------------------------------- -# Expands according to the M4 (static) status of the feature. -AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) - -# DX_REQUIRE_PROG(VARIABLE, PROGRAM) -# ---------------------------------- -# Require the specified program to be found for the DX_CURRENT_FEATURE to work. -AC_DEFUN([DX_REQUIRE_PROG], [ -AC_PATH_TOOL([$1], [$2]) -if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then - AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) - AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -fi -]) - -# DX_TEST_FEATURE(FEATURE) -# ------------------------ -# Expand to a shell expression testing whether the feature is active. -AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) - -# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) -# ------------------------------------------------- -# Verify that a required features has the right state before trying to turn on -# the DX_CURRENT_FEATURE. -AC_DEFUN([DX_CHECK_DEPEND], [ -test "$DX_FLAG_$1" = "$2" \ -|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, - requires, contradicts) doxygen-DX_CURRENT_FEATURE]) -]) - -# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) -# ---------------------------------------------------------- -# Turn off the DX_CURRENT_FEATURE if the required feature is off. -AC_DEFUN([DX_CLEAR_DEPEND], [ -test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -]) - -# DX_FEATURE_ARG(FEATURE, DESCRIPTION, -# CHECK_DEPEND, CLEAR_DEPEND, -# REQUIRE, DO-IF-ON, DO-IF-OFF) -# -------------------------------------------- -# Parse the command-line option controlling a feature. CHECK_DEPEND is called -# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), -# otherwise CLEAR_DEPEND is called to turn off the default state if a required -# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional -# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and -# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. -AC_DEFUN([DX_ARG_ABLE], [ - AC_DEFUN([DX_CURRENT_FEATURE], [$1]) - AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) - AC_ARG_ENABLE(doxygen-$1, - [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], - [--enable-doxygen-$1]), - DX_IF_FEATURE([$1], [don't $2], [$2]))], - [ -case "$enableval" in -#( -y|Y|yes|Yes|YES) - AC_SUBST([DX_FLAG_$1], 1) - $3 -;; #( -n|N|no|No|NO) - AC_SUBST([DX_FLAG_$1], 0) -;; #( -*) - AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) -;; -esac -], [ -AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) -$4 -]) -if DX_TEST_FEATURE([$1]); then - $5 - : -fi -if DX_TEST_FEATURE([$1]); then - $6 - : -else - $7 - : -fi -]) - -## -------------- ## -## Public macros. ## -## -------------- ## - -# DX_XXX_FEATURE(DEFAULT_STATE) -# ----------------------------- -AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) -AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])]) -AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) -AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) -AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) -AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) -AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) -AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) - -# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR], ...) -# -------------------------------------------------------------- -# PROJECT also serves as the base name for the documentation files. -# The default CONFIG-FILE is "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is -# "doxygen-doc". -# More arguments are interpreted as interleaved CONFIG-FILE and -# OUTPUT-DOC-DIR values. -AC_DEFUN([DX_INIT_DOXYGEN], [ - -# Files: -AC_SUBST([DX_PROJECT], [$1]) -AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])']) -AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])']) -m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, - [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]), - 'm4_default_nblank_quoted(m4_argn(DX_i, $@), - [$(srcdir)/Doxyfile])')])])dnl -m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2, - [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]), - 'm4_default_nblank_quoted(m4_argn(DX_i, $@), - [doxygen-doc])')])])dnl -m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1, - [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])], - [])))dnl - -# Environment variables used inside doxygen.cfg: -DX_ENV_APPEND(SRCDIR, $srcdir) -DX_ENV_APPEND(PROJECT, $DX_PROJECT) -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) - -# Doxygen itself: -DX_ARG_ABLE(doc, [generate any doxygen documentation], - [], - [], - [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) - DX_REQUIRE_PROG([DX_PERL], perl)], - [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) - -# Dot for graphics: -DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_DOT], dot)], - [DX_ENV_APPEND(HAVE_DOT, YES) - DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], - [DX_ENV_APPEND(HAVE_DOT, NO)]) - -# Man pages generation: -DX_ARG_ABLE(man, [generate doxygen manual pages], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_MAN, YES)], - [DX_ENV_APPEND(GENERATE_MAN, NO)]) - -# RTF file generation: -DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_RTF, YES)], - [DX_ENV_APPEND(GENERATE_RTF, NO)]) - -# XML file generation: -DX_ARG_ABLE(xml, [generate doxygen XML documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_XML, YES)], - [DX_ENV_APPEND(GENERATE_XML, NO)]) - -# (Compressed) HTML help generation: -DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_HHC], hhc)], - [DX_ENV_APPEND(HHC_PATH, $DX_HHC) - DX_ENV_APPEND(GENERATE_HTML, YES) - DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], - [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) - -# Separate CHI file generation. -DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file], - [DX_CHECK_DEPEND(chm, 1)], - [DX_CLEAR_DEPEND(chm, 1)], - [], - [DX_ENV_APPEND(GENERATE_CHI, YES)], - [DX_ENV_APPEND(GENERATE_CHI, NO)]) - -# Plain HTML pages generation: -DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], - [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], - [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], - [], - [DX_ENV_APPEND(GENERATE_HTML, YES)], - [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) - -# PostScript file generation: -DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_LATEX], latex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_DVIPS], dvips) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# PDF file generation: -DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# LaTeX generation for PS and/or PDF: -if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then - DX_ENV_APPEND(GENERATE_LATEX, YES) -else - DX_ENV_APPEND(GENERATE_LATEX, NO) -fi - -# Paper size for PS and/or PDF: -AC_ARG_VAR(DOXYGEN_PAPER_SIZE, - [a4wide (default), a4, letter, legal or executive]) -case "$DOXYGEN_PAPER_SIZE" in -#( -"") - AC_SUBST(DOXYGEN_PAPER_SIZE, "") -;; #( -a4wide|a4|letter|legal|executive) - DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) -;; #( -*) - AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) -;; -esac - -# Rules: -AS_IF([[test $DX_FLAG_html -eq 1]], -[[DX_SNIPPET_html="## ------------------------------- ## -## Rules specific for HTML output. ## -## ------------------------------- ## - -DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/html]])[ - -"]], -[[DX_SNIPPET_html=""]]) -AS_IF([[test $DX_FLAG_chi -eq 1]], -[[DX_SNIPPET_chi=" -DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]], -[[DX_SNIPPET_chi=""]]) -AS_IF([[test $DX_FLAG_chm -eq 1]], -[[DX_SNIPPET_chm="## ------------------------------ ## -## Rules specific for CHM output. ## -## ------------------------------ ## - -DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/chm]])[\ -${DX_SNIPPET_chi} - -"]], -[[DX_SNIPPET_chm=""]]) -AS_IF([[test $DX_FLAG_man -eq 1]], -[[DX_SNIPPET_man="## ------------------------------ ## -## Rules specific for MAN output. ## -## ------------------------------ ## - -DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/man]])[ - -"]], -[[DX_SNIPPET_man=""]]) -AS_IF([[test $DX_FLAG_rtf -eq 1]], -[[DX_SNIPPET_rtf="## ------------------------------ ## -## Rules specific for RTF output. ## -## ------------------------------ ## - -DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/rtf]])[ - -"]], -[[DX_SNIPPET_rtf=""]]) -AS_IF([[test $DX_FLAG_xml -eq 1]], -[[DX_SNIPPET_xml="## ------------------------------ ## -## Rules specific for XML output. ## -## ------------------------------ ## - -DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/xml]])[ - -"]], -[[DX_SNIPPET_xml=""]]) -AS_IF([[test $DX_FLAG_ps -eq 1]], -[[DX_SNIPPET_ps="## ----------------------------- ## -## Rules specific for PS output. ## -## ----------------------------- ## - -DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[ - -DX_PS_GOAL = doxygen-ps - -doxygen-ps: \$(DX_CLEAN_PS) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag - \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ - \$(DX_LATEX) refman.tex; \\ - \$(DX_MAKEINDEX) refman.idx; \\ - \$(DX_LATEX) refman.tex; \\ - countdown=5; \\ - while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ - refman.log > /dev/null 2>&1 \\ - && test \$\$countdown -gt 0; do \\ - \$(DX_LATEX) refman.tex; \\ - countdown=\`expr \$\$countdown - 1\`; \\ - done; \\ - \$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi - -]])["]], -[[DX_SNIPPET_ps=""]]) -AS_IF([[test $DX_FLAG_pdf -eq 1]], -[[DX_SNIPPET_pdf="## ------------------------------ ## -## Rules specific for PDF output. ## -## ------------------------------ ## - -DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[ - -DX_PDF_GOAL = doxygen-pdf - -doxygen-pdf: \$(DX_CLEAN_PDF) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag - \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ - \$(DX_PDFLATEX) refman.tex; \\ - \$(DX_MAKEINDEX) refman.idx; \\ - \$(DX_PDFLATEX) refman.tex; \\ - countdown=5; \\ - while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ - refman.log > /dev/null 2>&1 \\ - && test \$\$countdown -gt 0; do \\ - \$(DX_PDFLATEX) refman.tex; \\ - countdown=\`expr \$\$countdown - 1\`; \\ - done; \\ - mv refman.pdf ../\$(PACKAGE).pdf - -]])["]], -[[DX_SNIPPET_pdf=""]]) -AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]], -[[DX_SNIPPET_latex="## ------------------------------------------------- ## -## Rules specific for LaTeX (shared for PS and PDF). ## -## ------------------------------------------------- ## - -DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) -_DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) -_DX_v_LATEX_0 = @echo \" LATEX \" \$][@; - -DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/latex]])[ - -"]], -[[DX_SNIPPET_latex=""]]) - -AS_IF([[test $DX_FLAG_doc -eq 1]], -[[DX_SNIPPET_doc="## --------------------------------- ## -## Format-independent Doxygen rules. ## -## --------------------------------- ## - -${DX_SNIPPET_html}\ -${DX_SNIPPET_chm}\ -${DX_SNIPPET_man}\ -${DX_SNIPPET_rtf}\ -${DX_SNIPPET_xml}\ -${DX_SNIPPET_ps}\ -${DX_SNIPPET_pdf}\ -${DX_SNIPPET_latex}\ -DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) -_DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) -_DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; - -.PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -.INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -doxygen-run:]m4_foreach([DX_i], [DX_loop], - [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[ - -doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS) - \$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[) - \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[) - \$(A""M_V_at)echo Timestamp >\$][@ - -]])dnl -[DX_CLEANFILES = \\] -m4_foreach([DX_i], [DX_loop], -[[ \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ -]])dnl -[ -r \\ - \$(DX_CLEAN_HTML) \\ - \$(DX_CLEAN_CHM) \\ - \$(DX_CLEAN_CHI) \\ - \$(DX_CLEAN_MAN) \\ - \$(DX_CLEAN_RTF) \\ - \$(DX_CLEAN_XML) \\ - \$(DX_CLEAN_PS) \\ - \$(DX_CLEAN_PDF) \\ - \$(DX_CLEAN_LATEX)"]], -[[DX_SNIPPET_doc=""]]) -AC_SUBST([DX_RULES], -["${DX_SNIPPET_doc}"])dnl -AM_SUBST_NOTMAKE([DX_RULES]) - -#For debugging: -#echo DX_FLAG_doc=$DX_FLAG_doc -#echo DX_FLAG_dot=$DX_FLAG_dot -#echo DX_FLAG_man=$DX_FLAG_man -#echo DX_FLAG_html=$DX_FLAG_html -#echo DX_FLAG_chm=$DX_FLAG_chm -#echo DX_FLAG_chi=$DX_FLAG_chi -#echo DX_FLAG_rtf=$DX_FLAG_rtf -#echo DX_FLAG_xml=$DX_FLAG_xml -#echo DX_FLAG_pdf=$DX_FLAG_pdf -#echo DX_FLAG_ps=$DX_FLAG_ps -#echo DX_ENV=$DX_ENV -]) diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 @@ -1,251 +0,0 @@ -# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], -# [ACTION-IF-YES], [ACTION-IF-NO]) -# ---------------------------------------------------------- -# David Shaw <dshaw@jabberwocky.com> May-09-2006 -# -# Checks for libcurl. DEFAULT-ACTION is the string yes or no to -# specify whether to default to --with-libcurl or --without-libcurl. -# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the -# minimum version of libcurl to accept. Pass the version as a regular -# version number like 7.10.1. If not supplied, any version is -# accepted. ACTION-IF-YES is a list of shell commands to run if -# libcurl was successfully found and passed the various tests. -# ACTION-IF-NO is a list of shell commands that are run otherwise. -# Note that using --without-libcurl does run ACTION-IF-NO. -# -# This macro #defines HAVE_LIBCURL if a working libcurl setup is -# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary -# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are -# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy -# where yyy are the various protocols supported by libcurl. Both xxx -# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of -# the macro for the complete list of possible defines. Shell -# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also -# defined to 'yes' for those features and protocols that were found. -# Note that xxx and yyy keep the same capitalization as in the -# curl-config list (e.g. it's "HTTP" and not "http"). -# -# Users may override the detected values by doing something like: -# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure -# -# For the sake of sanity, this macro assumes that any libcurl that is -# found is after version 7.7.2, the first version that included the -# curl-config script. Note that it is very important for people -# packaging binary versions of libcurl to include this script! -# Without curl-config, we can only guess what protocols are available, -# or use curl_version_info to figure it out at runtime. - -AC_DEFUN([LIBCURL_CHECK_CONFIG], -[ - AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) - AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) - AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) - AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) - AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) - AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) - AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) - AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) - - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) - AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) - AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) - - AC_ARG_WITH(libcurl, - AS_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), - [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) - - if test "$_libcurl_with" != "no" ; then - - AC_PROG_AWK - - _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" - - _libcurl_try_link=yes - - if test -d "$_libcurl_with" ; then - LIBCURL_CPPFLAGS="-I$withval/include" - _libcurl_ldflags="-L$withval/lib" - AC_PATH_PROG([_libcurl_config],[curl-config],[], - ["$withval/bin"]) - else - AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) - fi - - if test x$_libcurl_config != "x" ; then - AC_CACHE_CHECK([for the version of libcurl], - [libcurl_cv_lib_curl_version], - [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) - - _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` - _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` - - if test $_libcurl_wanted -gt 0 ; then - AC_CACHE_CHECK([for libcurl >= version $2], - [libcurl_cv_lib_version_ok], - [ - if test $_libcurl_version -ge $_libcurl_wanted ; then - libcurl_cv_lib_version_ok=yes - else - libcurl_cv_lib_version_ok=no - fi - ]) - fi - - if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then - if test x"$LIBCURL_CPPFLAGS" = "x" ; then - LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` - fi - if test x"$LIBCURL" = "x" ; then - LIBCURL=`$_libcurl_config --libs` - - # This is so silly, but Apple actually has a bug in their - # curl-config script. Fixed in Tiger, but there are still - # lots of Panther installs around. - case "${host}" in - powerpc-apple-darwin7*) - LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` - ;; - esac - fi - - # All curl-config scripts support --feature - _libcurl_features=`$_libcurl_config --feature` - - # Is it modern enough to have --protocols? (7.12.4) - if test $_libcurl_version -ge 461828 ; then - _libcurl_protocols=`$_libcurl_config --protocols` - fi - else - _libcurl_try_link=no - fi - - unset _libcurl_wanted - fi - - if test $_libcurl_try_link = yes ; then - - # we didn't find curl-config, so let's see if the user-supplied - # link line (or failing that, "-lcurl") is enough. - LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} - - AC_CACHE_CHECK([whether libcurl is usable], - [libcurl_cv_lib_curl_usable], - [ - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBCURL $LIBS" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[ -/* Try and use a few common options to force a failure if we are - missing symbols or can't link. */ -int x; -curl_easy_setopt(NULL,CURLOPT_URL,NULL); -x=CURL_ERROR_SIZE; -x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_WRITEDATA; -x=CURLOPT_ERRORBUFFER; -x=CURLOPT_STDERR; -x=CURLOPT_VERBOSE; -if (x) ; -]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - ]) - - if test $libcurl_cv_lib_curl_usable = yes ; then - - # Does curl_free() exist in this version of libcurl? - # If not, fake it with free() - - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBS $LIBCURL" - - AC_CHECK_FUNC(curl_free,, - AC_DEFINE(curl_free,free, - [Define curl_free() as free() if our version of curl lacks curl_free.])) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - - AC_DEFINE(HAVE_LIBCURL,1, - [Define to 1 if you have a functional curl library.]) - AC_SUBST(LIBCURL_CPPFLAGS) - AC_SUBST(LIBCURL) - - for _libcurl_feature in $_libcurl_features ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) - eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes - done - - if test "x$_libcurl_protocols" = "x" ; then - - # We don't have --protocols, so just assume that all - # protocols are available - _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - - if test x$libcurl_feature_SSL = xyes ; then - _libcurl_protocols="$_libcurl_protocols HTTPS" - - # FTPS wasn't standards-compliant until version - # 7.11.0 (0x070b00 == 461568) - if test $_libcurl_version -ge 461568; then - _libcurl_protocols="$_libcurl_protocols FTPS" - fi - fi - - # RTSP, IMAP, POP3 and SMTP were added in - # 7.20.0 (0x071400 == 463872) - if test $_libcurl_version -ge 463872; then - _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" - fi - fi - - for _libcurl_protocol in $_libcurl_protocols ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) - eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes - done - else - unset LIBCURL - unset LIBCURL_CPPFLAGS - fi - fi - - unset _libcurl_try_link - unset _libcurl_version_parse - unset _libcurl_config - unset _libcurl_feature - unset _libcurl_features - unset _libcurl_protocol - unset _libcurl_protocols - unset _libcurl_version - unset _libcurl_ldflags - fi - - if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then - # This is the IF-NO path - ifelse([$4],,:,[$4]) - else - # This is the IF-YES path - ifelse([$3],,:,[$3]) - fi - - unset _libcurl_with -])dnl diff --git a/meson.build b/meson.build @@ -0,0 +1,284 @@ + project( + 'challenger', + 'c', + license: 'AGPLv3', + meson_version: '>=1.1.0', + version: '1.5.1', +) + +cc = meson.get_compiler('c') +incdir = include_directories('src/include', 'src/include/challenger-database') + +private_config = configuration_data() + + +plugindir = get_option('libdir') / 'challenger' +pkgdatadir = get_option('datadir') / 'challenger' +pkgcfgdir = pkgdatadir / 'config.d' +docdir = get_option('datadir') / 'doc' / 'challenger' + +if get_option('install-rpath') + rpath_option = get_option('prefix') / get_option('libdir') +else + rpath_option = '' +endif + +install_emptydir(docdir) +install_data('README', 'COPYING', install_dir: docdir) + +gnunet_user = false +dpkg_architecture_bin = find_program( + 'dpkg-architecture', + '/usr/bin/dpkg-architecture', + required: false, +) +if dpkg_architecture_bin.found() + private_config.set( + 'MULTIARCH', + dpkg_architecture_bin.full_path() + ' -qDEB_HOST_MULTIARCH', + ) +endif + +TALER_PLUGIN_LDFLAGS = [ + '-export-dynamic', + '-avoid-version', + '-module', + '--no-undefined', +] + +cdata = configuration_data() +if not get_option('only-doc') + add_project_arguments( + '-Wall', + '-Wno-address-of-packed-member', + language: 'c', + ) + taler_lib_ldflags = '-export-dynamic -no-undefined' + + check_headers = ['stdint.h', 'stdlib.h', 'string.h', 'unistd.h'] + + foreach h : check_headers + if cc.check_header(h) + define = 'HAVE_' + h.underscorify().to_upper() + message(define) + private_config.set(define, 1) + endif + endforeach + + mhd_dep = dependency('libmicrohttpd', required: false) + if not mhd_dep.found() + mhd_dep = cc.find_library('microhttpd', required: true) + endif + + json_dep = dependency('jansson', required: false) + if not json_dep.found() + json_dep = cc.find_library('jansson', required: true) + endif + + gcrypt_dep = dependency('libgcrypt', required: false) + if not gcrypt_dep.found() + gcrypt_dep = cc.find_library('gcrypt', required: true) + endif + + private_config.set_quoted('NEED_LIBGCRYPT_VERSION', '1.6.1') + + gnunetutil_dep = dependency('gnunetutil', required: false) + if not gnunetutil_dep.found() + gnunetutil_dep = cc.find_library('gnunetutil', required: true) + endif + + cc.has_header_symbol( + 'gnunet/gnunet_util_lib.h', + 'GNUNET_TIME_round_up', + dependencies: [gnunetutil_dep], + required: true, + ) + + gnunetjson_dep = dependency('gnunetjson', required: false) + if not gnunetjson_dep.found() + gnunetjson_dep = cc.find_library('gnunetjson', required: true) + endif + + curl_dep = dependency('libcurl', version: '>=7.34.0', required: false) + if not curl_dep.found() + curl_dep = cc.find_library('curl', required: true) + curl_version_check = '''#include <curl/curl.h> + int main(int argc, char **argv) { + #if LIBCURL_VERSION_NUM < 0x073400 + #error "cURL version >= 7.34.0 required" + #endif + return 0; + } + ''' + if not cc.compiles( + curl_version_check, + name: 'cURL version check', + dependencies: curl_dep, + ) + error('cURL version >=7.34.0 required') + endif + endif + + gnunetcurl_dep = dependency('gnunetcurl', required: false) + if not gnunetcurl_dep.found() + gnunetcurl_dep = cc.find_library('gnunetcurl', required: true) + endif + cc.has_header_symbol( + 'gnunet/gnunet_curl_lib.h', + 'GNUNET_CURL_get_select_info', + dependencies: [gnunetcurl_dep], + required: true, + ) + + pq_dep = dependency('libpq', required: false) + if not pq_dep.found() + pq_dep = cc.find_library('pq', required: true) + endif + gnunetpq_dep = dependency('gnunetpq', required: false) + if not gnunetpq_dep.found() + gnunetpq_dep = cc.find_library('gnunetpq', required: true) + endif + cc.has_header_symbol( + 'gnunet/gnunet_pq_lib.h', + 'GNUNET_PQ_query_param_blind_sign_priv', + required: true, + dependencies: [pq_dep, gnunetpq_dep], + ) + private_config.set10('HAVE_GNUNETPQ', gnunetpq_dep.found()) + + + talerutil_dep = dependency('talerutil', required: false) + if not talerutil_dep.found() + talerutil_dep = cc.find_library('talerutil', required: true) + endif + cc.has_header_symbol( + 'taler/taler_util.h', + 'TALER_merchant_instance_auth_hash_with_salt', + required: true, + dependencies: [talerutil_dep], + ) + private_config.set10('HAVE_TALERUTIL', talerutil_dep.found()) + talertemplating_dep = dependency('talertemplating', required: false) + if not talertemplating_dep.found() + talertemplating_dep = cc.find_library('talertemplating', required: true) + endif + talerjson_dep = dependency('talerjson', required: false) + if not talerjson_dep.found() + talerjson_dep = cc.find_library('talerjson', required: true) + endif + talermhd_dep = dependency('talermhd', required: false) + if not talermhd_dep.found() + talermhd_dep = cc.find_library('talermhd', required: true) + endif + cc.has_header_symbol( + 'taler/taler_mhd_lib.h', + 'TALER_MHD_parse_request_arg_rel_time', + required: true, + dependencies: [talermhd_dep], + ) + private_config.set10('HAVE_TALERMHD', talermhd_dep.found()) + talerpq_dep = dependency('talerpq', required: false) + if not talerpq_dep.found() + talerpq_dep = cc.find_library('talerpq', required: true) + endif + cc.has_header_symbol( + 'taler/taler_pq_lib.h', + 'TALER_PQ_query_param_array_blinded_denom_sig', + required: true, + dependencies: [ + talerpq_dep, + pq_dep, + ], + ) + private_config.set10('HAVE_TALERPQ', talerpq_dep.found()) + + talerexchange_dep = dependency('talerexchange', required: false) + if not talerexchange_dep.found() + talerexchange_dep = cc.find_library('talerexchange', required: true) + endif + private_config.set10('HAVE_TALEREXCHANGE', talerexchange_dep.found()) + + logging_opt = get_option('logging') + logging_verbosity = 0 + + if logging_opt == 'yes' + logging_verbosity = 1 + endif + if logging_opt == 'no' + add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c') + endif + if logging_opt == 'verbose' + logging_verbosity = 2 + endif + if logging_opt == 'veryverbose' + logging_verbosity = 3 + endif + + #add_project_arguments('-DGNUNET_EXTRA_LOGGING=@0@'.format(logging_verbosity), language: 'c') + + + # todo gcov has meson builtin + + # Used to populate configuration file and script templates + + + libltversions = [['libchallengerutil', '0:1:0'], ['libchallengerdb', '0:1:0']] + + solibversions = {} + + foreach libversion : libltversions + ltversion = libversion[1].split(':') + current = ltversion[0].to_int() + revision = ltversion[1].to_int() + age = ltversion[2].to_int() + soversion_str = '@0@'.format(current - age) + ltversion_str = '@0@.@1@.@2@'.format(current - age, age, revision) + solibversions = solibversions + { + libversion[0]: { + 'soversion': soversion_str, + 'version': ltversion_str, + }, + } + endforeach + + private_config.set_quoted('PACKAGE', meson.project_name()) + private_config.set_quoted('PACKAGE_VERSION', meson.project_version()) + # Compatibility. Used in source. + private_config.set_quoted('VERSION', meson.project_version()) + private_config.set_quoted('VCS_VERSION', 'mesonbuild') + private_config.set_quoted('PACKAGE_BUGREPORT', 'taler@gnu.org') + configure_file(output: 'challenger_config.h', configuration: private_config) + configuration_inc = include_directories('.') + + cdata.merge_from(private_config) + add_project_arguments('-DHAVE_CONFIG_H', language: 'c') + + pkg = import('pkgconfig') + subdir('contrib') + subdir('src') + if not get_option('disable-doc') + subdir('doc') + endif + + taler_prefix = get_option('prefix') / get_option('libdir') + + add_test_setup( + 'default', + env: ['CHALLENGER_PREFIX=' + taler_prefix], + exclude_suites: ['perf', 'installcheck', 'integrationtests'], + is_default: true, + ) +else + subdir('contrib') + if not get_option('disable-doc') + subdir('doc') + endif +endif + +run_target( + 'doxygen', + command: 'scripts/doxygen.meson.sh', + env: {'PACKAGE_VERSION': meson.project_version()}, +) +#meson.add_dist_script('meson-dist-script') + diff --git a/meson.options b/meson.options @@ -0,0 +1,5 @@ +# Build options +option('only-doc', type : 'boolean', value : false, description: 'whether to compile documentation ONLY') +option('disable-doc', type : 'boolean', value : false, description: 'whether to disable documentation') +option('install-rpath', type : 'boolean', value : false, description: 'Add rpath to installed binaries if set') +option('logging', type : 'string', value: 'yes', description: 'Log setting. Can be set to "yes" (logging, default), "no" (no logging), "verbose" (extra logging"), "veryverbose" (even more logging)') diff --git a/scripts/doxygen.meson.sh b/scripts/doxygen.meson.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# This is more portable than `which' but comes with +# the caveat of not(?) properly working on busybox's ash: +existence() +{ + type "$1" >/dev/null 2>&1 +} + +if ! existence doxygen; then + echo "Doxygen not found" + exit 1 +fi +cd "${MESON_SOURCE_ROOT}/doc/doxygen" +echo "PROJECT_NUMBER = ${PACKAGE_VERSION}" > version.doxy +make all + +echo "Doxygen files generated into ${MESON_SOURCE_ROOT}/doc/doxygen!" diff --git a/src/Makefile.am b/src/Makefile.am @@ -1,3 +0,0 @@ -# This Makefile is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include -SUBDIRS = include util challengerdb challenger diff --git a/src/challenger/Makefile.am b/src/challenger/Makefile.am @@ -1,84 +0,0 @@ -# This Makefile.am is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include - -if USE_COVERAGE - AM_CFLAGS = --coverage -O0 - XLIB = -lgcov -endif - -tmpldatadir = $(prefix)/share/challenger/templates/ - -dist_tmpldata_DATA = \ - default-challenge-message.txt - -pkgcfgdir = $(prefix)/share/challenger/config.d/ - -pkgcfg_DATA = \ - challenger.conf - -bin_PROGRAMS = \ - challenger-admin \ - challenger-httpd - -bin_SCRIPTS = \ - challenger-send-email \ - challenger-send-post \ - challenger-send-sms \ - challenger-send-sms-clicksend \ - challenger-send-sms-telesign - -check_SCRIPTS = \ - test-challenger.sh \ - test-challenger-pkce.sh \ - test-challenger-revisit.sh - -TESTS = \ - $(check_SCRIPTS) - -challenger_admin_SOURCES = \ - challenger-admin.c -challenger_admin_LDADD = \ - $(top_builddir)/src/challengerdb/libchallengerdb.la \ - $(top_builddir)/src/util/libchallengerutil.la \ - -ltalerutil \ - -lgnunetutil \ - $(XLIB) - -challenger_httpd_SOURCES = \ - challenger_cm_enums.c challenger_cm_enums.h \ - challenger-httpd.c challenger-httpd.h \ - challenger-httpd_agpl.c challenger-httpd_agpl.h \ - challenger-httpd_spa.c challenger-httpd_spa.h \ - challenger-httpd_authorize.c challenger-httpd_authorize.h \ - challenger-httpd_challenge.c challenger-httpd_challenge.h \ - challenger-httpd_common.c challenger-httpd_common.h \ - challenger-httpd_config.c challenger-httpd_config.h \ - challenger-httpd_info.c challenger-httpd_info.h \ - challenger-httpd_mhd.c challenger-httpd_mhd.h \ - challenger-httpd_setup.c challenger-httpd_setup.h \ - challenger-httpd_solve.c challenger-httpd_solve.h \ - challenger-httpd_token.c challenger-httpd_token.h - -challenger_httpd_LDADD = \ - $(top_builddir)/src/util/libchallengerutil.la \ - $(top_builddir)/src/challengerdb/libchallengerdb.la \ - -ltalertemplating \ - -lmicrohttpd \ - -ljansson \ - -ltalermhd \ - -ltalerjson \ - -ltalerutil \ - -lgnunetcurl \ - -lgnunetjson \ - -lgnunetutil \ - -lgcrypt \ - $(XLIB) - -EXTRA_DIST = \ - cat.sh \ - challenger.conf \ - test-challenger.conf \ - test-challenger-pkce.conf \ - $(pkgcfg_DATA) \ - $(bin_SCRIPTS) \ - $(check_SCRIPTS) diff --git a/src/challenger/meson.build b/src/challenger/meson.build @@ -0,0 +1,99 @@ +# This file is in the public domain + +tmpldatadir = get_option('datadir') / 'challenger' / 'templates' + +dist_tmpldata_DATA = \ +install_data( + 'default-challenge-message.txt', + install_dir: tmpldatadir, + ) + +install_data( + 'challenger.conf', + install_dir: pkgcfgdir +) + +bin_SCRIPTS = [ + 'challenger-send-email', + 'challenger-send-post', + 'challenger-send-sms', + 'challenger-send-sms-clicksend', + 'challenger-send-sms-telesign', + ] + +foreach s : bin_SCRIPTS + configure_file( + input: s, + output: s, + install_dir: get_option('bindir'), + copy: true, + ) +endforeach + + +check_SCRIPTS = [ + 'test-challenger', + 'test-challenger-pkce', + 'test-challenger-revisit', + ] + +foreach s : check_SCRIPTS + tscript = '@0@.sh'.format(s) + test_exe = configure_file( + input: tscript, + output: tscript, + copy: true, + ) + test(s, test_exe, workdir: meson.current_build_dir(), suite: ['challenger'], is_parallel: false) +endforeach + +executable( + 'challenger-admin', + ['challenger-admin.c'], + dependencies: [ + libchallengerutil_dep, + libchallengerdb_dep, + talerutil_dep, + gnunetutil_dep, + ], + include_directories: [incdir, configuration_inc], + install: true, +) + + +challenger_httpd_SOURCES = [ + 'challenger_cm_enums.c', + 'challenger-httpd.c', + 'challenger-httpd_agpl.c', + 'challenger-httpd_spa.c', + 'challenger-httpd_authorize.c', + 'challenger-httpd_challenge.c', + 'challenger-httpd_common.c', + 'challenger-httpd_config.c', + 'challenger-httpd_info.c', + 'challenger-httpd_mhd.c', + 'challenger-httpd_setup.c', + 'challenger-httpd_solve.c', + 'challenger-httpd_token.c', + ] + +executable( + 'challenger-httpd', + challenger_httpd_SOURCES, + dependencies: [ + libchallengerutil_dep, + libchallengerdb_dep, + talerutil_dep, + talermhd_dep, + talerjson_dep, + talertemplating_dep, + gnunetutil_dep, + gnunetjson_dep, + gnunetcurl_dep, + mhd_dep, + json_dep, + gcrypt_dep, + ], + include_directories: [incdir, configuration_inc], + install: true, +) diff --git a/src/challengerdb/Makefile.am b/src/challengerdb/Makefile.am @@ -1,106 +0,0 @@ -# This Makefile.am is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/include/challenger-database - -pkgcfgdir = $(prefix)/share/challenger/config.d/ - -pkgcfg_DATA = \ - challenger_db_postgres.conf - - -if USE_COVERAGE - AM_CFLAGS = --coverage -O0 - XLIB = -lgcov -endif - -sqlinputs = \ - challenger_do_*.sql \ - procedures.sql.in - -sqldir = $(prefix)/share/challenger/sql/ - -sql_DATA = \ - versioning.sql \ - procedures.sql \ - challenger-0001.sql \ - challenger-0002.sql \ - drop.sql - -BUILT_SOURCES = \ - procedures.sql - -procedures.sql: procedures.sql.in challenger_do_*.sql - chmod +w $@ || true - gcc -E -P -undef - < procedures.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@ - chmod ugo-w $@ - -bin_PROGRAMS = \ - challenger-dbinit - -challenger_dbinit_SOURCES = \ - challenger-dbinit.c -challenger_dbinit_LDADD = \ - $(LIBGCRYPT_LIBS) \ - $(top_builddir)/src/util/libchallengerutil.la \ - libchallengerdb.la \ - -ltalerutil \ - -lgnunetutil \ - $(XLIB) - -lib_LTLIBRARIES = \ - libchallengerdb.la -libchallengerdb_la_SOURCES = \ - address_get.c \ - client_add.c \ - client_modify.c \ - client_delete.c \ - client_check.c \ - create_tables.c \ - drop_tables.c \ - gc.c \ - info_get_token.c \ - token_add_token.c \ - setup_nonce.c \ - preflight.c \ - pg.c pg_helper.h \ - authorize_start.c \ - challenge_set_address_and_pin.c \ - validate_solve_pin.c \ - validation_get.c \ - validation_get_pkce.c -libchallengerdb_la_LIBADD = \ - $(LTLIBINTL) \ - $(top_builddir)/src/util/libchallengerutil.la \ - -lgnunetpq \ - -lpq \ - -ltalerpq \ - -lgnunetutil \ - $(XLIB) -libchallengerdb_la_LDFLAGS = \ - $(POSTGRESQL_LDFLAGS) \ - -version-info 0:1:0 \ - -no-undefined - -check_PROGRAMS = \ - $(TESTS) - -test_challenger_db_postgres_SOURCES = \ - test_challenger_db.c -test_challenger_db_postgres_LDFLAGS = \ - $(top_builddir)/src/util/libchallengerutil.la \ - libchallengerdb.la \ - -lgnunetutil \ - -lgnunetpq \ - -ltalerutil \ - $(XLIB) - -AM_TESTS_ENVIRONMENT=export CHALLENGER_PREFIX=$${CHALLENGER_PREFIX:-@libdir@};export PATH=$${CHALLENGER_PREFIX:-@prefix@}/bin:$$PATH; -TESTS = \ - test_challenger_db-postgres - -EXTRA_DIST = \ - $(sqlinputs) \ - $(pkgcfg_DATA) \ - $(sql_DATA) \ - test_challenger_db_postgres.conf \ - pg_template.h pg_template.c \ - pg_template.sh diff --git a/src/challengerdb/Makefile.sql b/src/challengerdb/Makefile.sql @@ -0,0 +1,13 @@ +procedures.sql: procedures.sql.in challenger_do_*.sql + chmod +w $@ || true + gcc -E -P -undef - < procedures.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@ + chmod ugo-w $@ + + +CLEANFILES = \ + procedures.sql + +all: ${CLEANFILES} + +clean: + rm ${CLEANFILES} diff --git a/src/challengerdb/meson.build b/src/challengerdb/meson.build @@ -0,0 +1,104 @@ +# This file is in the public domain + +install_data( + 'challenger_db_postgres.conf', + install_dir: pkgcfgdir + ) + + +sqldir = get_option('datadir') / 'challenger' / 'sql' + +# FIXME possibly provide this output in the tgz through dist script +run_command('make', '-f', 'Makefile.sql', 'all', check: true) + +sql_DATA = [ + 'versioning.sql', + 'procedures.sql', + 'challenger-0001.sql', + 'challenger-0002.sql', + 'drop.sql', +] + +install_data(sources: sql_DATA, install_dir: sqldir) + +# This makes meson copy the files into the build directory for testing +foreach f : sql_DATA + configure_file(input: f, output: f, copy: true) +endforeach + + + +libchallengerdb_SOURCES = [ + 'address_get.c', + 'client_add.c', + 'client_modify.c', + 'client_delete.c', + 'client_check.c', + 'create_tables.c', + 'drop_tables.c', + 'gc.c', + 'info_get_token.c', + 'token_add_token.c', + 'setup_nonce.c', + 'preflight.c', + 'pg.c', + 'authorize_start.c', + 'challenge_set_address_and_pin.c', + 'validate_solve_pin.c', + 'validation_get.c', + 'validation_get_pkce.c', +] +libchallengerdb = library( + 'challengerdb', + libchallengerdb_SOURCES, + soversion: solibversions['libchallengerdb']['soversion'], + version: solibversions['libchallengerdb']['soversion'], + install_rpath: rpath_option, + dependencies: [ + libchallengerutil_dep, + talerpq_dep, + gnunetutil_dep, + gnunetpq_dep, + pq_dep, + ], + include_directories: [incdir, configuration_inc], + install: true, + install_dir: get_option('libdir'), +) + +libchallengerdb_dep = declare_dependency(link_with: libchallengerdb) +pkg.generate( + libchallengerdb, + url: 'https://taler.net', + description: 'GNU Taler challenger DB library', +) + +executable( + 'challenger-dbinit', + ['challenger-dbinit.c'], + dependencies: [libchallengerutil_dep, libchallengerdb_dep, gnunetutil_dep, talerutil_dep], + include_directories: [incdir, configuration_inc], + install: true, +) + +configure_file( + input: 'test_challenger_db_postgres.conf', + output: 'test_challenger_db_postgres.conf', + copy: true, +) + +test_challenger_db_postgres = executable( + 'test_challenger_db-postgres', + ['test_challenger_db.c'], + dependencies: [gnunetutil_dep, libchallengerutil_dep, libchallengerdb_dep, gnunetpq_dep, talerutil_dep], + include_directories: [incdir, configuration_inc], + build_by_default: false, + install: false, +) +test( + 'test_challenger_db-postgres', + test_challenger_db_postgres, + workdir: meson.current_build_dir(), + suite: ['challengerdb'], + is_parallel: false, +) diff --git a/src/include/Makefile.am b/src/include/Makefile.am @@ -1,23 +0,0 @@ -# This Makefile.am is in the public domain - -challengerincludedir = $(includedir)/challenger - -challengerinclude_HEADERS = \ - challenger_util.h - -EXTRA_DIST = \ - platform.h \ - challenger_database_lib.h \ - challenger-database/address_get.h \ - challenger-database/authorize_start.h \ - challenger-database/challenge_set_address_and_pin.h \ - challenger-database/client_add.h \ - challenger-database/client_check.h \ - challenger-database/client_delete.h \ - challenger-database/client_modify.h \ - challenger-database/info_get_token.h \ - challenger-database/setup_nonce.h \ - challenger-database/token_add_token.h \ - challenger-database/validate_solve_pin.h \ - challenger-database/validation_get.h \ - challenger-database/validation_get_pkce.h diff --git a/src/include/meson.build b/src/include/meson.build @@ -0,0 +1,6 @@ +# This file is in the public domain + +install_data( + 'challenger_util.h', + install_dir: get_option('includedir') / 'challenger' + ) diff --git a/src/meson.build b/src/meson.build @@ -0,0 +1,5 @@ +# This Makefile is in the public domain +subdir('include') +subdir('util') +subdir('challengerdb') +subdir('challenger') diff --git a/src/util/Makefile.am b/src/util/Makefile.am @@ -1,38 +0,0 @@ -# This Makefile.am is in the public domain -AM_CPPFLAGS = -I$(top_srcdir)/src/include $(LIBGCRYPT_CFLAGS) - -if USE_COVERAGE - AM_CFLAGS = --coverage -O0 - XLIB = -lgcov -endif - - -pkgcfgdir = $(prefix)/share/challenger/config.d/ - -pkgcfg_DATA = \ - paths.conf - -bin_PROGRAMS = \ - challenger-config - -challenger_config_SOURCES = \ - challenger-config.c -challenger_config_LDADD = \ - libchallengerutil.la \ - -lgnunetutil \ - $(XLIB) - -EXTRA_DIST = \ - $(pkgcfg_DATA) - -lib_LTLIBRARIES = \ - libchallengerutil.la - -libchallengerutil_la_SOURCES = \ - os_installation.c -libchallengerutil_la_LIBADD = \ - -lgnunetutil \ - $(XLIB) -libchallengerutil_la_LDFLAGS = \ - -version-info 0:1:0 \ - -export-dynamic -no-undefined diff --git a/src/util/meson.build b/src/util/meson.build @@ -0,0 +1,40 @@ +# This file is in the public domain + +configure_file( + input: 'paths.conf', + output: 'paths.conf', + configuration: cdata, + install: true, + install_dir: pkgcfgdir, +) + +libchallengerutil = library( + 'challengerutil', + ['os_installation.c'], + soversion: solibversions['libchallengerutil']['soversion'], + version: solibversions['libchallengerutil']['soversion'], + install_rpath: rpath_option, + dependencies: [ + gnunetutil_dep, + ], + include_directories: [incdir, configuration_inc], + install: true, + install_dir: get_option('libdir'), +) + +libchallengerutil_dep = declare_dependency(link_with: libchallengerutil) +pkg.generate( + libchallengerutil, + url: 'https://taler.net', + description: 'GNU Taler challenger utilities library', +) + +executable( + 'challenger-config', + ['challenger-config.c'], + dependencies: [libchallengerutil_dep, gnunetutil_dep], + include_directories: [incdir, configuration_inc], + install: true, +) + +