Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jakub.both/dune-common
  • samuel.burbulla/dune-common
  • patrick.jaap/dune-common
  • tobias.leibner/dune-common
  • alexander.mueller/dune-common
  • pipping/dune-common
  • Xinyun.Li/dune-common
  • felix.schindler/dune-common
  • simon.praetorius/dune-common
  • ani.anciaux-sedrakian/dune-common
  • henrik.stolzmann/dune-common
  • matthew.t.collins/dune-common
  • liam.keegan/dune-common
  • felix.mueller/dune-common
  • ansgar/dune-common
  • dominic/dune-common
  • lars.lubkoll/dune-common
  • exadune/dune-common
  • felix.gruber/dune-common
  • govind.sahai/dune-common
  • michael.sghaier/dune-common
  • core/dune-common
  • kilian.weishaupt/dune-common
  • markus.blatt/dune-common
  • joscha.podlesny/dune-common
  • tobias.meyer.andersen/dune-common
  • andreas.thune/dune-common
  • lars.bilke/dune-common
  • daniel.kienle/dune-common
  • lukas.renelt/dune-common
  • smuething/dune-common
  • stephan.hilb/dune-common
  • tkoch/dune-common
  • nils.dreier/dune-common
  • rene.milk/dune-common
  • lasse.hinrichsen/dune-common
  • yunus.sevinchan/dune-common
  • lisa_julia.nebel/dune-common
  • claus-justus.heine/dune-common
  • lorenzo.cerrone/dune-common
  • eduardo.bueno/dune-common
41 results
Show changes
<!--
SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
-->
DUNE-library
============
......@@ -5,7 +10,7 @@ DUNE, the Distributed and Unified Numerics Environment is a modular toolbox
for solving partial differential equations with grid-based methods.
The main intention is to create slim interfaces allowing an efficient use of
legacy and/or new libraries. Using C++ techniques DUNE allows to use very
legacy and/or new libraries. Using C++ techniques DUNE allows one to use very
different implementation of the same concept (i.e. grid, solver, ...) under
a common interface with a very low overhead.
......@@ -13,7 +18,7 @@ DUNE was designed with flexibility in mind. It supports easy discretization
using methods, like Finite Elements, Finite Volume and also Finite
Differences. Through separation of data structures DUNE allows fast Linear
Algebra like provided in the ISTL module, or usage of external libraries
like blas.
like BLAS.
This package contains the basic DUNE common classes.
......@@ -22,15 +27,23 @@ Dependencies
dune-common depends on the following software packages
- pkg-config
- icc (C/C++) >= 7.0 or GNU C, C++ >=3.4
- CMake >= 3.16
- Compiler (C, C++): GNU >= 10 or Clang >= 13
- Library: GNU libstdc++ >= 10 or Clang libc++ >= 13
Other compilers may also work, but they must support C++20 to the same extent as
the above. For an overview of the C++20 features supported by these versions, see
https://en.cppreference.com/w/cpp/compiler_support. For compiling the Python
bindings, libc++ is not currently supported.
The following software is recommend but optional:
The following software is recommended but optional:
- pkg-config
- MPI (either OpenMPI, lam, or mpich suffice)
- Python >= 3.7 (interpreter and development kit for building the python bindings)
For a full explanation of the DUNE installation process please read
the installation notes [0]. The following introduction is meant for
the [installation notes][installation]. The following introduction is meant for
the impatient.
License
......@@ -40,19 +53,19 @@ The DUNE-library and headers are licensed under version 2 of the GNU
General Public License, with the so-called "runtime exception", as
follows:
As a special exception, you may use the DUNE source files as part
of a software library or application without restriction.
Specifically, if other files instantiate templates or use macros or
inline functions from one or more of the DUNE source files, or you
compile one or more of the DUNE source files and link them with
other files to produce an executable, this does not by itself cause
the resulting executable to be covered by the GNU General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General
Public License.
> As a special exception, you may use the DUNE source files as part
> of a software library or application without restriction.
> Specifically, if other files instantiate templates or use macros or
> inline functions from one or more of the DUNE source files, or you
> compile one or more of the DUNE source files and link them with
> other files to produce an executable, this does not by itself cause
> the resulting executable to be covered by the GNU General Public
> License. This exception does not however invalidate any other
> reasons why the executable file might be covered by the GNU General
> Public License.
This licence clones the one of the libstc++ library. For further
implications of this library please see their licence page [3]
This license clones the one of the libstdc++ library. For further
implications of this library please see their [license page][license]
See the file COPYING for full copying permissions.
......@@ -60,12 +73,15 @@ Installation
------------
Short installation instructions can be found in file INSTALL. For the
full instructions please see [0].
full instructions please see [here][installation].
Links
-----
0. http://www.dune-project.org/doc/installation-notes.html
1. http://www.dune-project.org/download.html
2. http://dune-project.org/doc/buildsystem/buildsystem.pdf
3. http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/license.html
0. https://www.dune-project.org/installation/installation-faq/
1. https://dune-project.org/releases/
2. https://dune-project.org/doc/buildsystem/
3. https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.license
[installation]: https://www.dune-project.org/installation/installation-buildsrc
[license]: https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.license
- nach perl und makedepend suchen (für undefAllMacros.pl)
- doxygen configuration files
- Installation doku in docs
- operator schnittstelle erweitern, damit man mehr Informationen
übergeben kann
Makefile
Makefile.in
semantic.cache
\ No newline at end of file
# $Id$
EXTRA_DIST = inkscape.am webstuff global-rules sourcescheck \
no-check-without-lib latex checklog doxygen
#noinst_DATA = inkscape.am
amdir = $(datadir)/dune-common/am
am_DATA = $(EXTRA_DIST)
include $(top_srcdir)/am/global-rules
# -*- Makefile -*-
# $Id$
LOG_FILE = $(top_srcdir)/check-log.log
LOG_DIR = $(top_srcdir)/check-log
LOG_STORE = $(SHELL) $(DUNE_COMMON_ROOT)/bin/check-log-store $(LOG_FILE) $(LOG_DIR)
LOG_SET_OPTIONS = \
path=`test "$(subdir)" = "." && \
echo "/@PACKAGE_NAME@" || echo "/@PACKAGE_NAME@/$(subdir)"`; \
ppath=`dirname $$path`; \
dir=`basename $$path`
$(DUNE_COMMON_ROOT)/bin/check-log-store: $(DUNE_COMMON_ROOT)/bin/check-log-store.in
cd $(DUNE_COMMON_ROOT)/bin/ && $(MAKE) check-log-store
check-log: $(DUNE_COMMON_ROOT)/bin/check-log-store
check-log:
rm -f $(LOG_FILE)
check-log: check-log-libs
check-log: check-log-build
check-log: check-log-test
check-log: check-log-sources
check-log: check-log-dir
check-log-libs: check-log-libs-recursive
check-log-build: check-log-build-recursive
check-log-test: check-log-test-recursive
check-log-sources: check-log-sources-recursive
check-log-dir: check-log-dir-recursive
check-log-sources-am:
$(LOG_SET_OPTIONS); \
$(MAKE) sourcescheck-am > $(LOG_FILE) 2>&1; \
$(LOG_STORE) "sources" "Makefile.am" "$$path"
check-log-libs-am:
$(LOG_SET_OPTIONS); \
for lib in $(LTLIBRARIES); do \
$(MAKE) $$lib > $(LOG_FILE) 2>&1; \
$(LOG_STORE) "lib" "$$lib" "$$path"; \
done;
check-log-build-am:
$(LOG_SET_OPTIONS); \
for target in $(check_PROGRAMS) $(PROGRAMS); do \
$(MAKE) $$target > $(LOG_FILE) 2>&1; \
$(LOG_STORE) "build" "$$target" "$$path"; \
done;
check-log-test-am:
@LOG () { \
echo "$$1" > $(LOG_FILE).2; \
cat $(LOG_FILE) >> $(LOG_FILE).2; \
mv $(LOG_FILE).2 $(LOG_FILE); \
}; \
$(LOG_SET_OPTIONS); \
for tst in $(TESTS); do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst > $(LOG_FILE) 2>&1; then \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
LOG "ERROR: XPASS ($$tst)"; \
$(LOG_STORE) "run" "$$tst" "$$path" 1 0; \
;; \
*) \
LOG "SUCCESS: PASS ($$tst)"; \
$(LOG_STORE) "run" "$$tst" "$$path" 0 0; \
;; \
esac; \
elif test $$? -ne 77; then \
case " $(XFAIL_TESTS) " in \
*" $$tst "*) \
LOG "SUCCESS: XFAIL ($$tst)"; \
$(LOG_STORE) "run" "$$tst" "$$path" 0 0; \
;; \
*) \
LOG "ERROR: FAIL ($$tst)"; \
$(LOG_STORE) "run" "$$tst" "$$path" 1 0; \
;; \
esac; \
else \
LOG "WARNING: SKIP ($$tst)"; \
$(LOG_STORE) "run" "$$tst" "$$path" 0 1; \
fi; \
done;
check-log-dir-am:
$(LOG_SET_OPTIONS); \
$(LOG_STORE) "dir" "$$dir" "$$ppath"
check-log-libs-recursive \
check-log-build-recursive \
check-log-test-recursive \
check-log-sources-recursive \
check-log-dir-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
.PHONY: check-log \
check-log-lib check-log-lib-am check-log-lib-recursive \
check-log-build check-log-build-am check-log-build-recursive \
check-log-test check-log-test-am check-log-test-recursive \
check-log-sources check-log-sources-am check-log-sources-recursive \
check-log-dir check-log-dir-am check-log-dir-recursive
# -*-makefile-automake-*-
if BUILD_DOCS
DOXYGENTAG = doxygen-tag
DOXYGEN_HTML = html
# EXTRAINSTALL in the html subdirectory
DOXYGENHTMLFILES = *.html *.css *.png *.gif
# DOXYGENDISTFILES = html html/*.html html/*.css html/*.png html/*.gif doxygen-tag
DOXYGENDISTFILES =
DOXYGENINSTALL = $(DOXYGENHTMLFILES) ../doxygen.log
endif
DISTCLEANFILES = doxygen.log doxygen-tag
if DUNEWEB
if WML
# themeing doxygen
DOXYGENHEADER = doxy-header.html
DOXYGENFOOTER = doxy-footer.html
DOXYGENSTYLESHEET = dune-doxy.css
endif
endif
DOXYGENFILES = $(DOXYGEN_HTML) $(DOXYGENHEADER) $(DOXYGENFOOTER)
#we need this in the distribution
if BUILD_DOCS
install-doxygen-data: $(DOXYGEN_HTML)
$(mkinstalldirs) $(DESTDIR)/$(doxygendir); \
dir=$(srcdir); \
if test -d ./html; then dir=.; fi; echo "dir=$$dir"; \
list='$(DOXYGENHTMLFILES)'; \
for p in $$list; do \
$(install_sh_DATA) $$dir/html/$$p $(DESTDIR)/$(doxygendir); \
done
uninstall-doxygen-data:
list='$(DOXYGENHTMLFILES)'; \
for p in $$list; do \
rm -f $(DESTDIR)/$(doxygendir)/$$p; \
done
install-data-local: install-doxygen-data
uninstall-local: uninstall-doxygen-data
endif
# what files does the doxygen-generated stuff depend on (find-syntax)
DOXYGEN_DEPENDON = -name \*.cc -o -name \*.hh -o -name \*.png
# as all doxygen files fill be installed in the html subdirectory
# the BASEDIR has to be adjusted
doxy-header.html: BASEDIR:=$(BASEDIR)/..
doxy-header.html:
# check dependency ourself to be robust
doxygen-tag: FORCE $(DOXYGENHEADER)
set -e; \
if test ! -e doxygen-tag || test x"`find $(top_srcdir) \( $(DOXYGEN_DEPENDON) \) -a -cnewer doxygen-tag -print`" != x ; then \
echo Running doxygen. This may take a while... ; \
$(DOXYGEN) Doxyfile > doxygen.log 2>&1 <&- ; \
touch doxygen-tag ; \
fi
# fi; \
# if ! (test "x$(VPATH)" != "x" && test -e $(srcdir)/doxygen-tag); then \
#
html: doxygen-tag
if WML
# how to install the doxygen documentation
web-install-doxygen:
if test -d $(DUNEWEBDIR) && test -r $(DUNEWEBDIR)/Make.global ; then \
pushd html; \
$(MAKE) -f $(DUNEWEBDIR)/Make.global \
EXTRAINSTALL="$(DOXYGENINSTALL)" CURDIR="$(CURDIR)/@DUNE_MOD_NAME@-html" install ; \
popd; \
fi
endif
web-install: web-install-doxygen web-install-default
clean-local: clean-doxygen
clean-doxygen:
rm -rf html latex $(DOXYGENTAG) *~
# nice trick from the GNU make infopage to force a rule to run
FORCE:
include $(top_srcdir)/am/webstuff
# -*- Makefile -*-
# $Id$
#
# this file should be included into any Makefile.am so that we can
# easily introduce new global rules. DO NOT OVERUSE!
#
# add "sourcescheck"-target testing if all source files are mentioned
include $(top_srcdir)/am/sourcescheck
# check consistency of the headers (see FS#394)
include $(top_srcdir)/am/headercheck
# add "check-log"-target to create automated build logs
include $(top_srcdir)/am/checklog
# -*- Makefile -*-
# $Id: sourcescheck 5183 2008-04-27 17:37:08Z christi $
headercheck_PATTERN = *.hh
headercheck_IGNORE =
hctest.o: hctest.cc
$(CXX) -I$(top_srcdir) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(MPI_CPPFLAGS) $(ALL_PKG_CPPFLAGS) -c -o $@ $<
headercheck:
@if test x"$$HEADER" = "x"; then \
if test x"$$SILENT" = "x"; then \
SILENTSTR='SILENT=1' ; \
fi ; \
$(MAKE) $$SILENTSTR $(AM_MAKEFLAGS) headercheck-recursive; \
else \
if test x"$$SILENT" = "x"; then \
SILENTSTR='SILENT=0' ; \
fi ; \
$(MAKE) $$SILENTSTR $(AM_MAKEFLAGS) headercheck-am; \
fi
headercheck-am:
@if test x"$$HEADER" != "x"; then \
list="$$HEADER"; \
else \
list=`echo $(headercheck_PATTERN)`; \
fi; \
test "$$list" != "$(headercheck_PATTERN)" || exit 0; \
for f in $$list; do \
HEADER="$(subdir)/$$f"; \
test $$SILENT -ne 0 || echo "checking $$HEADER"; \
CCFILE=hctest.cc; \
OFILE=hctest.o; \
LOGFILE=hctest.log; \
rm -f $$CCFILE; \
test -n "$$NO_CONFIG_H" || echo "#include <config.h>" > $$CCFILE; \
echo "#include <$${HEADER}>" >> $$CCFILE; \
echo "#include <$${HEADER}>" >> $$CCFILE; \
echo "int main () {}" >> $$CCFILE; \
make $$OFILE > $$LOGFILE 2>&1; \
SUCCESS=$$?; \
if ! (test $$SUCCESS -eq 0 && test -e $$OFILE); then \
echo "Error in $$HEADER"; \
test $$SILENT -ne 0 || cat $$LOGFILE; \
fi; \
rm -f $$OFILE; \
rm -f $$CCFILE; \
rm -f $$LOGFILE; \
test $$SUCCESS -eq 0 || exit $$SUCCESS; \
done
headercheck-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $(subdir)/$$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
.PHONY: headercheck headercheck-recursive headercheck-am
if INKSCAPE
.svg.png:
$(INKSCAPE) -e $@ $<
endif INKSCAPE
# Rules for latex stuff
# rerun TEX if log-file suggests that
.tex.dvi:
set -e; \
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(TEX) </dev/null $*; \
while grep Rerun $*.log > /dev/null ; do \
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(TEX) </dev/null $* || exit $$?; \
done; \
if grep '^\\bibdata{' *.aux > /dev/null \
&& grep '^\\citation{' *.aux > /dev/null; \
then \
BSTINPUTS=.:$(srcdir):${BSTINPUTS}: BIBINPUTS=.:$(srcdir):${BIBINPUTS}: $(BIBTEX) $* || exit $$?; \
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(TEX) </dev/null $* || exit $$?; \
while grep Rerun $*.log > /dev/null ; do \
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(TEX) </dev/null $* || exit $$?; \
done ; \
fi
.dvi.pdf:
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(DVIPDF) $*
.dvi.ps:
TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(DVIPS) $* -o
# -*- Makefile -*-
# $Id$
# many tests need parts of libdune. Telling the tests to use
# previously build partial libs is possible but difficult to maintain:
# the SUBDIRS have to be very carefully defined for this to work...
# Additionally, testing with a partial lib is unrealistic.
#
# As users may try to use "make check" without a full build we
# generate a meaningful error message instead of silently failing on a
# lib-dependency
# add a new dependency to automake-internal rule
check-am: libcheck
libcheck: libcheck-FORCE
@if test ! -f $(top_builddir)/lib/libdune.la ; then \
echo ; \
echo ' libdune not built, checks will not work yet!' ; \
echo ' Run a full make to fix this' ; \
echo ; \
exit 1; \
fi
libcheck-FORCE:
.PHONY: libcheck libcheck-FORCE
# -*- Makefile -*-
# $Id$
sourcescheck_LIST = $(SOURCES) $(DIST_SOURCES) $(HEADERS) $(DIST_HEADERS) \
$(sourcescheck_NOSOURCES) $(dist_noinst_DATA) $(EXTRA_DIST)
sourcescheck: sourcescheck-recursive
# @(for f in $(sourcescheck_LIST) fnord; do echo $$f; done) | \
# grep '\.[hc][hc]$$' | sort | uniq > header_CHECK.install
sourcescheck-am:
@echo $(sourcescheck_LIST) | tr ' ' '\n' | \
grep '\.[hcm][hc4]$$' | sort | uniq > header_CHECK.install
@ls | \
grep '\.[hcm][hc4]$$' | sort | uniq > header_CHECK.present
@RESULT=0; \
if diff header_CHECK.* | grep ^[\<\>] -q; then \
echo "==== WARNING ===="; \
echo -n "Directory: "; pwd; \
echo "Files present but not installed:"; \
diff -u header_CHECK.install header_CHECK.present | \
grep -v ^+++ | grep ^+; \
echo "Files listed for install but not present:"; \
diff -u header_CHECK.install header_CHECK.present | \
grep -v ^--- | grep ^-; \
echo "==== END ===="; \
RESULT=1; \
fi; \
rm -f header_CHECK.install header_CHECK.present; \
exit $$RESULT
sourcescheck-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
.PHONY: sourcescheck sourcescheck-recursive sourcescheck-am
# -*-makefile-*-
ACLOCAL_AMFLAGS=@ACLOCAL_AMFLAGS@
DUNECONTROL=@DUNE_COMMON_ROOT@/bin/dunecontrol
all-am: dependencies.m4
@DUNE_MOD_NAME@.m4: dune.module
cd $(srcdir) && $(DUNECONTROL) --only=@DUNE_MOD_NAME@ m4create
moduledir = $(libdir)/dunecontrol/@DUNE_MOD_NAME@
module_DATA = dune.module
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = @DUNE_MOD_NAME@.pc
# -*- makefile -*-
# $Id$
## rules to create HTML-pages from wml-files with additional magic to
## possibly use the layout of the Dune-homepage
# if DUNEWEBDIR is set to the dune-web directory the layout and
# install-stuff from that place will be used
# CURDIR should be defined in the same way as in dune-web
# pass files through wrapper
# pass variables to wmlwrap via environment
if WML
.wml.html:
export DUNEWEBDIR=$(DUNEWEBDIR); \
export BASEDIR=$(BASEDIR); \
sh $(DUNE_COMMON_ROOT)/bin/wmlwrap -I $(srcdir) $< -o $@
web-install-default: all
if test -d $(DUNEWEBDIR) && test -r $(DUNEWEBDIR)/Make.global ; then \
for DIR in $(SUBDIRS) ; do \
$(MAKE) -C $$DIR web-install || exit 1; \
done ; \
$(MAKE) -f $(DUNEWEBDIR)/Make.global \
EXTRAINSTALL="$(EXTRAINSTALL)" CURDIR="$(CURDIR)" install ; \
fi
endif
web-install: web-install-default
Makefile
Makefile.in
.deps
semantic.cache
check-log-store
wmlwrap
\ No newline at end of file
# SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
install(PROGRAMS
dune-add-spdx
dune-ctest
duneproject
dunecontrol
dunepackaging.py
dune-git-whitespace-hook
DESTINATION ${CMAKE_INSTALL_BINDIR})
# $Id$
# put scripts into dist-tarball
EXTRA_DIST = duneproject wmlwrap dunecontrol \
dunemodules.inc mpi-config
# ... and install some
bin_SCRIPTS = duneproject dunemodules.inc dunecontrol mpi-config
include $(top_srcdir)/am/global-rules
#!/bin/bash
#
# patch the include statement into all Makefile.am files
#
set -e
# always start in $top_srcdir
if ! test -f configure.ac; then
echo "Wrong Directory"
echo "run from \$top_srcdir"
exit 1
fi
# list of files to patch
FILES=`find . -name Makefile.am`
# snippet to patch into Makefile.am
SNIP='include $(top_srcdir)/am/sourcescheck'
# create the grep regexp from the snip
REGEXP="^$(echo $SNIP | sed -e 's/[\$\/\(\)]/./g')\$"
# enable / disable verbose mode
VERBOSE=0
for f in $FILES; do
# only patch files that don't have the patch yet
if ! grep -q "$REGEXP" $f; then
echo patching $f
# normalize end of file
while test "$(tail -1 $f)" != ""; do
echo >> $f
done
echo $SNIP >> $f
else
if test x$VERBOSE = x1; then
echo $f already patched
fi
fi
done
#!/bin/sh
set -e
# DB format
#
# <tag> <revision> <host> <mode> <module> <path> <errors> <warnings> <log>
# parameter:
# $(LOG_FILE) $(LOG_DIR) "build" "$$target" "$$path"
host="@hostid@"
tag="@tag@"
revision="@revision@"
logfile="$1"
logdir="$2"
mode="$3"
module="$4"
path="$5"
errors="$6"
warnings="$7"
test -d $logdir || mkdir $logdir
storelog=`tempfile -d $logdir`
trap "rm -f $storelog" EXIT
if true; then
echo "TAG: $tag"
echo "REVISION: $revision"
echo "HOST: $host"
echo "MODE: $mode"
echo "MODULE: $module"
echo "PATH: $path"
if test "x$errors" != x; then
echo "ERRORS: $errors"
fi
if test "x$warnings" != x; then
echo "WARNINGS: $warnings"
fi
echo "LOG:"
cat $logfile
fi > $storelog
trap - EXIT
#! /usr/bin/env python3
# SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
import argparse
import dataclasses
import errno
import logging
import re
# REUSE-IgnoreStart
parser = argparse.ArgumentParser(
description='add SPDX header to DUNE project modules'
)
parser.add_argument(
'--license', '-l', dest='license',
help='SPDX license name',
default='LicenseRef-GPL-2.0-only-with-DUNE-exception',
)
parser.add_argument(
'--copyright', '-c', dest='copyright',
help='copyright information',
default='Copyright © DUNE Project contributors, see file LICENSE.md in module root',
)
parser.add_argument(
'--like', dest='like',
help='handle files like a file named like this',
),
parser.add_argument(
'--log', dest='log',
help='set log level',
),
parser.add_argument(
'files', nargs='+',
help='files to add copyright and license headers to',
)
@dataclasses.dataclass
class Rule:
pattern: str
prefix: str = ""
suffix: str = ""
line_prefix: str = ""
line_suffix: str = ""
use_license_file: bool = False
skip_lines: re.Pattern = None
def match(self, filename) -> bool:
return bool(re.search(self.pattern, filename))
rules = [
Rule(
pattern=r"\.(?:c|cc|cc\.in|h|hh|hh\.in|ct|ht|t|geo)$|config\.h\.cmake$",
line_prefix="// ",
),
Rule(
pattern=r"\.(?:rst|rst\.in)$",
prefix="::\n",
line_prefix=" ",
suffix="\n",
),
Rule(
pattern=r"\.bib$",
line_prefix="@Comment ",
suffix="\n",
),
Rule(
pattern=r"\.dgf$",
line_prefix="% ",
skip_lines=re.compile("^DGF"),
),
Rule(
pattern=r"\.tex$",
line_prefix="% ",
suffix="\n",
),
Rule(
pattern=r"(?:\.amc|\.cmake|\.cmake\.in|\.gitignore|\.ini|\.pc\.in"
r"|\.pl|\.py|\.py\.in|\.sh|\.toml|\.toml\.in|\.yml"
r"|CMakeLists.txt|Doxylocal|dune.module|MANIFEST\.in)$",
line_prefix="# ",
suffix="\n",
),
Rule(
pattern=r"/doxygen/.*\.txt$",
line_prefix="// ",
suffix="\n",
),
Rule(
pattern=r"(?:\.md|INSTALL)$",
prefix="<!--\n",
suffix="-->\n\n",
),
Rule(
pattern=r"\.(?:cel|eps|fig|pdf|png|svg|vrt)$",
use_license_file=True,
),
Rule(
# gmsh's MSH file format support comments via unknown sections
# ($Comment ... $EndComment), but DUNE does not handle that.
# Reference: https://gmsh.info/doc/texinfo/gmsh.html#MSH-file-format
pattern=r"\.msh",
use_license_file=True,
),
]
skip_lines = re.compile(r'-\*-|vi(?:m)?:|^#!')
class Notice:
def __init__(self, copyright, license):
self.copyright = f'SPDX-FileCopyrightInfo: {copyright}'
self.license = f'SPDX-License-Identifier: {license}'
def match(self, lines) -> bool:
pattern = re.compile(f'(?:{re.escape(self.copyright)}|{re.escape(self.license)})')
return any(pattern.search(line) for line in lines)
def rule_for_file(filename) -> Rule:
for rule in rules:
if rule.match(filename):
return rule
return None
def line_for_notice(lines, rule: Rule) -> int:
for index, line in enumerate(lines):
if not skip_lines.search(line) \
and (rule.skip_lines is None or not rule.skip_lines.search(line)):
return index
return len(lines)
def apply_rule_to_file(filename, rule: Rule, notice: Notice):
if rule.use_license_file:
try:
with open(f"{filename}.license", "xt") as fh:
logging.debug(f"{filename}: create separate .license file")
print(notice.copyright, file=fh)
print(notice.license, file=fh)
except OSError as e:
if e.errno == errno.EEXIST:
logging.info(f"{filename}: separate .license file already exists")
else:
raise
else:
with open(filename, "rt") as fh:
lines = fh.readlines()
if notice.match(lines):
logging.info(f"{filename}: already contains a notice")
return
index = line_for_notice(lines, rule)
logging.debug(f"{filename}: Will insert notice at line {index}")
if rule.suffix:
lines.insert(index, rule.suffix)
lines.insert(index, f"{rule.line_prefix}{notice.license}{rule.line_suffix}\n")
lines.insert(index, f"{rule.line_prefix}{notice.copyright}{rule.line_suffix}\n")
if rule.prefix:
lines.insert(index, rule.prefix)
with open(filename, "wt") as fh:
print(*lines, sep='', end='', file=fh)
if __name__ == '__main__':
args = parser.parse_args()
if args.log:
logging.basicConfig(level=getattr(logging, args.log.upper()))
notice = Notice(args.copyright, args.license)
for filename in args.files:
logging.debug(f"Processing {filename}")
if args.like:
rule = rule_for_file(args.like)
else:
rule = rule_for_file(filename)
if rule is None:
logging.warning(f"{filename}: No rule found for this file. Add a rule or try --like.")
continue
apply_rule_to_file(filename, rule, notice)
# add-spdx() {
# local file line_prefix prefix suffix
# local copying_file="LICENSE.md"
# local license="LicenseRef-GPL-2.0-only-with-DUNE-exception"
# xxlicense="LGPL-2.1-or-later"
# for file in "$@"; do
# prefix=""
# line_prefix=""
# suffix=""
# license_file="${file}"
# case "${file}" in
# *.cc|*.hh|*config.h.cmake|*.cc.in|*.ct|*.ht|*.t) line_prefix="// " ;;
# */doxygen/*.txt) line_prefix="// "; suffix=$'\n' ;;
# *CMakeLists.txt|*.py|*.gitignore|*.yml|*Doxylocal|*.toml|*.pc.in|*dune.module|*.cmake|*.ini) line_prefix="# "; suffix=$'\n' ;;
# *.md|*INSTALL) prefix=$'<!--\n'; suffix=$'\n-->\n' ;;
# *.tex) line_prefix="% "; suffix=$'\n' ;;
# *.svg|*.png|*.eps|*.pdf) license_file="${file}.license"; file="" ;;
# esac
#
# ed ${file} <<EOT
# 0i
# ${prefix}${line_prefix}SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file ${copying_file} in module root
# ${line_prefix}SPDX-License-Identifier: ${license}${suffix}
# .
# w ${license_file}
# q
# EOT
# done
# }
# REUSE-IgnoreEnd