Thu, 12 Oct 2023 00:00:35 +0200
replace most of the build system with uwproj
1.1 --- a/.hgignore Sun Sep 03 09:10:16 2023 +0200 1.2 +++ b/.hgignore Thu Oct 12 00:00:35 2023 +0200 1.3 @@ -1,10 +1,5 @@ 1.4 -syntax:regexp 1.5 -^nbproject/ 1.6 -^build/ 1.7 -/core$ 1.8 -DS_Store$ 1.9 -^stamp-h 1.10 -/test-suite.log$ 1.11 -^ucx-.*\.tar.gz$ 1.12 -^.idea/ 1.13 -^cmake-build- 1.14 +nbproject/ 1.15 +.idea/ 1.16 +build/ 1.17 +dist/ 1.18 +config.mk
2.1 --- a/CMakeLists.txt Sun Sep 03 09:10:16 2023 +0200 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,62 +0,0 @@ 2.4 -cmake_minimum_required(VERSION 3.14) 2.5 -project(ucx VERSION 3.0 DESCRIPTION "UAP Common Extensions" LANGUAGES C) 2.6 - 2.7 -# Configuration 2.8 -cmake_policy(SET CMP0077 NEW) 2.9 -set(CMAKE_C_STANDARD 11) 2.10 -set(CMAKE_C_STANDARD_REQUIRED 11) 2.11 - 2.12 -option(GCC_MORE_WARNINGS "Enable -Wall -Wextra -pedantic when using gcc." OFF) 2.13 -if (GCC_MORE_WARNINGS AND CMAKE_COMPILER_IS_GNUCC) 2.14 - add_compile_options(-Wall -Wextra -pedantic) 2.15 -endif() 2.16 - 2.17 -# Library 2.18 -add_subdirectory(src) 2.19 - 2.20 -# Tests 2.21 -include(CheckLanguage) 2.22 -check_language(CXX) 2.23 -if (CMAKE_CXX_COMPILER) 2.24 - enable_language(CXX) 2.25 - enable_testing() 2.26 - add_subdirectory(tests) 2.27 -else () 2.28 - message(STATUS "No C++ compiler found - tests are not compiled.") 2.29 -endif () 2.30 - 2.31 -# Web Documentation 2.32 -add_subdirectory(docs/src) 2.33 - 2.34 -# API Documentation 2.35 -message(CHECK_START "Seaching for Doxygen") 2.36 -find_package(Doxygen) 2.37 -if(DOXYGEN_FOUND) 2.38 - message(CHECK_PASS "found.") 2.39 -else() 2.40 - message(CHECK_FAIL "not found - documentation will not be generated.") 2.41 -endif() 2.42 -option(BUILD_API_DOC "Create API documentation." ON) 2.43 - 2.44 -if(BUILD_API_DOC AND DOXYGEN_FOUND) 2.45 - set(DOXY_INPUT ${CMAKE_SOURCE_DIR}/src/cx) 2.46 - set(DOXY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/docs) 2.47 - set(DOXY_PROJECT_LOGO ${CMAKE_SOURCE_DIR}/uaplogo.png) 2.48 - 2.49 - configure_file(${CMAKE_SOURCE_DIR}/cmake_infile.doxygen ${CMAKE_BINARY_DIR}/Doxyfile) 2.50 - 2.51 - add_custom_target(docs-api-21 2.52 - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/docs/api-2.1 ${CMAKE_BINARY_DIR}/docs/web/api-2.1 2.53 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 2.54 - COMMENT "Copying UCX 2.1 API documentation.") 2.55 - 2.56 - add_custom_target(docs-api 2.57 - COMMAND ${DOXYGEN_EXECUTABLE} 2.58 - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 2.59 - COMMENT "Generating API documentation with Doxygen.") 2.60 - 2.61 - add_custom_target(docs-all DEPENDS docs-html docs-api docs-api-21) 2.62 -else() 2.63 - add_custom_target(docs-all DEPENDS docs-html) 2.64 -endif() 2.65 -
3.1 --- a/Doxyfile Sun Sep 03 09:10:16 2023 +0200 3.2 +++ b/Doxyfile Thu Oct 12 00:00:35 2023 +0200 3.3 @@ -68,7 +68,7 @@ 3.4 # entered, it will be relative to the location where doxygen was started. If 3.5 # left blank the current directory will be used. 3.6 3.7 -OUTPUT_DIRECTORY = docs 3.8 +OUTPUT_DIRECTORY = build/docs 3.9 3.10 # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 3.11 # sub-directories (in 2 levels) under the output directory of each output format
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/Makefile Thu Oct 12 00:00:35 2023 +0200 4.3 @@ -0,0 +1,72 @@ 4.4 +# Copyright 2023 Mike Becker. All rights reserved. 4.5 +# 4.6 +# Redistribution and use in source and binary forms, with or without 4.7 +# modification, are permitted provided that the following conditions are met: 4.8 +# 4.9 +# 1. Redistributions of source code must retain the above copyright 4.10 +# notice, this list of conditions and the following disclaimer. 4.11 +# 4.12 +# 2. Redistributions in binary form must reproduce the above copyright 4.13 +# notice, this list of conditions and the following disclaimer in the 4.14 +# documentation and/or other materials provided with the distribution. 4.15 +# 4.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 4.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 4.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 4.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 4.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 4.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 4.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 4.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4.26 + 4.27 +include config.mk 4.28 + 4.29 +all: compile 4.30 + 4.31 +install: 4.32 + @cd src && $(MAKE) -s install 4.33 + 4.34 +dist: FORCE 4.35 + $(MKDIR) $(DIST_DIR)/libucx 4.36 + $(COPYALL) CHANGELOG configure COPYING Doxyfile Makefile README \ 4.37 + uaplogo.png docs make src tests $(DIST_DIR)/libucx/ 4.38 + @cd $(DIST_DIR) && tar -czf libucx-src-$(VERSION).tar.gz -Hustar libucx 4.39 + @echo "[ Dist created: $(DIST_DIR)/libucx-src-$(VERSION).tar.gz ]" 4.40 + 4.41 +clean: 4.42 + $(RMDIR) $(BUILD_DIR) 4.43 + 4.44 +dist-clean: 4.45 + $(RMDIR) $(DIST_DIR) 4.46 + $(RMDIR) $(BUILD_DIR) 4.47 + 4.48 +compile: $(BUILD_DIR) static shared 4.49 + 4.50 +$(BUILD_DIR): 4.51 + $(MKDIR) $@ 4.52 + 4.53 +shared: FORCE 4.54 + @cd src && $(MAKE) OBJ_EXT=.shared.o \ 4.55 + CFLAGS="$(CFLAGS) $(SHLIB_CFLAGS)" \ 4.56 + LDFLAGS="$(LDFLAGS) $(SHLIB_LDFLAGS)" \ 4.57 + shared 4.58 + 4.59 +static: FORCE 4.60 + @cd src && $(MAKE) static 4.61 + 4.62 +check: test-compile FORCE 4.63 + $(BUILD_DIR)/tests/ucxtest 4.64 + 4.65 +test-compile: 4.66 + @(test "$(WITH_TESTS)" = "yes" && cd tests && $(MAKE)) \ 4.67 + || echo "[ Tests disabled - skipped ]" 4.68 + 4.69 +docs: FORCE 4.70 + @(test "$(WITH_DOCS_API)" = "yes" && cd docs && $(MAKE) all-api) \ 4.71 + || echo "[ Generation of API Docs disabled - skipped ]" 4.72 + @(test "$(WITH_DOCS_HTML)" = "yes" && cd docs && $(MAKE) all-html) \ 4.73 + || echo "[ Generation of HTML Docs disabled - skipped ]" 4.74 + 4.75 +FORCE:
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/configure Thu Oct 12 00:00:35 2023 +0200 5.3 @@ -0,0 +1,756 @@ 5.4 +#!/bin/sh 5.5 + 5.6 +# create temporary directory 5.7 +TEMP_DIR=".tmp-`uname -n`" 5.8 +rm -Rf "$TEMP_DIR" 5.9 +if mkdir -p "$TEMP_DIR"; then 5.10 + : 5.11 +else 5.12 + echo "Cannot create tmp dir $TEMP_DIR" 5.13 + echo "Abort" 5.14 + exit 1 5.15 +fi 5.16 +touch "$TEMP_DIR/options" 5.17 +touch "$TEMP_DIR/features" 5.18 + 5.19 +# define standard variables 5.20 +# also define standard prefix (this is where we will search for config.site) 5.21 +prefix=/usr 5.22 +exec_prefix= 5.23 +bindir= 5.24 +sbindir= 5.25 +libdir= 5.26 +libexecdir= 5.27 +datarootdir= 5.28 +datadir= 5.29 +sysconfdir= 5.30 +sharedstatedir= 5.31 +localstatedir= 5.32 +runstatedir= 5.33 +includedir= 5.34 +infodir= 5.35 +localedir= 5.36 +mandir= 5.37 + 5.38 +# custom variables 5.39 +src_dir=`pwd` 5.40 +DOXYGEN=`command -v doxygen` 5.41 +PANDOC=`command -v pandoc` 5.42 +CMAKE=`command -v cmake` 5.43 + 5.44 +# features 5.45 + 5.46 +# clean abort 5.47 +abort_configure() 5.48 +{ 5.49 + rm -Rf "$TEMP_DIR" 5.50 + exit 1 5.51 +} 5.52 + 5.53 +# help text 5.54 +printhelp() 5.55 +{ 5.56 + echo "Usage: $0 [OPTIONS]..." 5.57 + cat << __EOF__ 5.58 +Installation directories: 5.59 + --prefix=PREFIX path prefix for architecture-independent files 5.60 + [/usr] 5.61 + --exec-prefix=EPREFIX path prefix for architecture-dependent files 5.62 + [PREFIX] 5.63 + 5.64 + --bindir=DIR user executables [EPREFIX/bin] 5.65 + --sbindir=DIR system admin executables [EPREFIX/sbin] 5.66 + --libexecdir=DIR program executables [EPREFIX/libexec] 5.67 + --sysconfdir=DIR system configuration files [PREFIX/etc] 5.68 + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 5.69 + --localstatedir=DIR modifiable single-machine data [PREFIX/var] 5.70 + --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] 5.71 + --libdir=DIR object code libraries [EPREFIX/lib] 5.72 + --includedir=DIR C header files [PREFIX/include] 5.73 + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 5.74 + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 5.75 + --infodir=DIR info documentation [DATAROOTDIR/info] 5.76 + --mandir=DIR man documentation [DATAROOTDIR/man] 5.77 + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 5.78 + 5.79 +Options: 5.80 + --debug add extra compile flags for debug builds 5.81 + --release add extra compile flags for release builds 5.82 + --with-tests=(yes|no) 5.83 + --with-docs=(all|html|api|none) 5.84 + 5.85 +__EOF__ 5.86 +} 5.87 + 5.88 +# 5.89 +# parse arguments 5.90 +# 5.91 +BUILD_TYPE="default" 5.92 +for ARG in "$@" 5.93 +do 5.94 + case "$ARG" in 5.95 + "--prefix="*) prefix=${ARG#--prefix=} ;; 5.96 + "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; 5.97 + "--bindir="*) bindir=${ARG#----bindir=} ;; 5.98 + "--sbindir="*) sbindir=${ARG#--sbindir=} ;; 5.99 + "--libdir="*) libdir=${ARG#--libdir=} ;; 5.100 + "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; 5.101 + "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; 5.102 + "--datadir="*) datadir=${ARG#--datadir=} ;; 5.103 + "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; 5.104 + "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; 5.105 + "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; 5.106 + "--includedir="*) includedir=${ARG#--includedir=} ;; 5.107 + "--infodir="*) infodir=${ARG#--infodir=} ;; 5.108 + "--mandir"*) mandir=${ARG#--mandir} ;; 5.109 + "--localedir"*) localedir=${ARG#--localedir} ;; 5.110 + "--help"*) printhelp; abort_configure ;; 5.111 + "--debug") BUILD_TYPE="debug" ;; 5.112 + "--release") BUILD_TYPE="release" ;; 5.113 + "--with-tests="*) OPT_WITH_TESTS=${ARG#--with-tests=} ;; 5.114 + "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;; 5.115 + "-"*) echo "unknown option: $ARG"; abort_configure ;; 5.116 + esac 5.117 +done 5.118 + 5.119 + 5.120 + 5.121 +# set defaults for dir variables 5.122 +: ${exec_prefix:="$prefix"} 5.123 +: ${bindir:='${exec_prefix}/bin'} 5.124 +: ${sbindir:='${exec_prefix}/sbin'} 5.125 +: ${libdir:='${exec_prefix}/lib'} 5.126 +: ${libexecdir:='${exec_prefix}/libexec'} 5.127 +: ${datarootdir:='${prefix}/share'} 5.128 +: ${datadir:='${datarootdir}'} 5.129 +: ${sysconfdir:='${prefix}/etc'} 5.130 +: ${sharedstatedir:='${prefix}/com'} 5.131 +: ${localstatedir:='${prefix}/var'} 5.132 +: ${runstatedir:='${localstatedir}/run'} 5.133 +: ${includedir:='${prefix}/include'} 5.134 +: ${infodir:='${datarootdir}/info'} 5.135 +: ${mandir:='${datarootdir}/man'} 5.136 +: ${localedir:='${datarootdir}/locale'} 5.137 + 5.138 +# check if a config.site exists and load it 5.139 +if [ -n "$CONFIG_SITE" ]; then 5.140 + # CONFIG_SITE may contain space separated file names 5.141 + for cs in $CONFIG_SITE; do 5.142 + printf "loading defaults from $cs... " 5.143 + . "$cs" 5.144 + echo ok 5.145 + done 5.146 +elif [ -f "$prefix/share/config.site" ]; then 5.147 + printf "loading site defaults... " 5.148 + . "$prefix/share/config.site" 5.149 + echo ok 5.150 +elif [ -f "$prefix/etc/config.site" ]; then 5.151 + printf "loading site defaults... " 5.152 + . "$prefix/etc/config.site" 5.153 + echo ok 5.154 +fi 5.155 + 5.156 +# Test for availability of pkg-config 5.157 +PKG_CONFIG=`command -v pkg-config` 5.158 +: ${PKG_CONFIG:="false"} 5.159 + 5.160 +# Simple uname based platform detection 5.161 +# $PLATFORM is used for platform dependent dependency selection 5.162 +OS=`uname -s` 5.163 +OS_VERSION=`uname -r` 5.164 +printf "detect platform... " 5.165 +if [ "$OS" = "SunOS" ]; then 5.166 + PLATFORM="solaris sunos unix svr4" 5.167 +fi 5.168 +if [ "$OS" = "Linux" ]; then 5.169 + PLATFORM="linux unix" 5.170 +fi 5.171 +if [ "$OS" = "FreeBSD" ]; then 5.172 + PLATFORM="freebsd bsd unix" 5.173 +fi 5.174 +if [ "$OS" = "Darwin" ]; then 5.175 + PLATFORM="macos osx bsd unix" 5.176 +fi 5.177 +if echo "$OS" | grep -i "MINGW" > /dev/null; then 5.178 + PLATFORM="windows mingw" 5.179 +fi 5.180 +: ${PLATFORM:="unix"} 5.181 + 5.182 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` 5.183 +echo "$PLATFORM_NAME" 5.184 + 5.185 +isplatform() 5.186 +{ 5.187 + for p in $PLATFORM 5.188 + do 5.189 + if [ "$p" = "$1" ]; then 5.190 + return 0 5.191 + fi 5.192 + done 5.193 + return 1 5.194 +} 5.195 +notisplatform() 5.196 +{ 5.197 + for p in $PLATFORM 5.198 + do 5.199 + if [ "$p" = "$1" ]; then 5.200 + return 1 5.201 + fi 5.202 + done 5.203 + return 0 5.204 +} 5.205 + 5.206 + 5.207 +# generate vars.mk 5.208 +cat > "$TEMP_DIR/vars.mk" << __EOF__ 5.209 +prefix="$prefix" 5.210 +exec_prefix="$exec_prefix" 5.211 +bindir="$bindir" 5.212 +sbindir="$sbindir" 5.213 +libdir="$libdir" 5.214 +libexecdir="$libexecdir" 5.215 +datarootdir="$datarootdir" 5.216 +datadir="$datadir" 5.217 +sysconfdir="$sysconfdir" 5.218 +sharedstatedir="$sharedstatedir" 5.219 +localstatedir="$localstatedir" 5.220 +runstatedir="$runstatedir" 5.221 +includedir="$includedir" 5.222 +infodir="$infodir" 5.223 +mandir="$mandir" 5.224 +localedir="$localedir" 5.225 +src_dir="$src_dir" 5.226 +DOXYGEN="$DOXYGEN" 5.227 +PANDOC="$PANDOC" 5.228 +CMAKE="$CMAKE" 5.229 +__EOF__ 5.230 + 5.231 +# toolchain detection utilities 5.232 +. make/toolchain.sh 5.233 + 5.234 +# 5.235 +# DEPENDENCIES 5.236 +# 5.237 + 5.238 +# check languages 5.239 +lang_c= 5.240 +lang_cpp= 5.241 +if detect_cpp_compiler ; then 5.242 + lang_cpp=1 5.243 +fi 5.244 +if detect_c_compiler ; then 5.245 + lang_c=1 5.246 +fi 5.247 + 5.248 +# create buffer for make variables required by dependencies 5.249 +echo > "$TEMP_DIR/make.mk" 5.250 + 5.251 +test_pkg_config() 5.252 +{ 5.253 + if "$PKG_CONFIG" --exists "$1" ; then : 5.254 + else return 1 ; fi 5.255 + if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : 5.256 + else return 1 ; fi 5.257 + if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : 5.258 + else return 1 ; fi 5.259 + if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : 5.260 + else return 1 ; fi 5.261 + return 0 5.262 +} 5.263 + 5.264 +dependency_error_pandoc() 5.265 +{ 5.266 + printf "checking for pandoc... " 5.267 + # dependency pandoc 5.268 + while true 5.269 + do 5.270 + if test -n "$PANDOC" > /dev/null ; then 5.271 + : 5.272 + else 5.273 + break 5.274 + fi 5.275 + echo yes 5.276 + return 1 5.277 + done 5.278 + 5.279 + echo no 5.280 + return 0 5.281 +} 5.282 +dependency_error_cpp() 5.283 +{ 5.284 + printf "checking for cpp... " 5.285 + # dependency cpp 5.286 + while true 5.287 + do 5.288 + if [ -z "$lang_cpp" ] ; then 5.289 + break 5.290 + fi 5.291 + echo yes 5.292 + return 1 5.293 + done 5.294 + 5.295 + echo no 5.296 + return 0 5.297 +} 5.298 +dependency_error_c() 5.299 +{ 5.300 + printf "checking for c... " 5.301 + # dependency c platform="mingw" 5.302 + while true 5.303 + do 5.304 + if notisplatform "mingw"; then 5.305 + break 5.306 + fi 5.307 + if [ -z "$lang_c" ] ; then 5.308 + break 5.309 + fi 5.310 + cat >> $TEMP_DIR/make.mk << __EOF__ 5.311 +# Dependency: c 5.312 +AR=ar 5.313 +ARFLAGS=r 5.314 +STLIB_EXT=.lib 5.315 +SHLIB_EXT=.dll 5.316 + 5.317 +__EOF__ 5.318 + echo yes 5.319 + return 1 5.320 + done 5.321 + 5.322 + # dependency c platform="macos" 5.323 + while true 5.324 + do 5.325 + if notisplatform "macos"; then 5.326 + break 5.327 + fi 5.328 + if [ -z "$lang_c" ] ; then 5.329 + break 5.330 + fi 5.331 + cat >> $TEMP_DIR/make.mk << __EOF__ 5.332 +# Dependency: c 5.333 +AR=ar 5.334 +ARFLAGS=r 5.335 +STLIB_EXT=.a 5.336 +SHLIB_EXT=.dylib 5.337 + 5.338 +__EOF__ 5.339 + echo yes 5.340 + return 1 5.341 + done 5.342 + 5.343 + # dependency c platform="unix" 5.344 + while true 5.345 + do 5.346 + if notisplatform "unix"; then 5.347 + break 5.348 + fi 5.349 + if [ -z "$lang_c" ] ; then 5.350 + break 5.351 + fi 5.352 + cat >> $TEMP_DIR/make.mk << __EOF__ 5.353 +# Dependency: c 5.354 +AR=ar 5.355 +ARFLAGS=r 5.356 +STLIB_EXT=.a 5.357 +SHLIB_EXT=.so 5.358 + 5.359 +__EOF__ 5.360 + echo yes 5.361 + return 1 5.362 + done 5.363 + 5.364 + echo no 5.365 + return 0 5.366 +} 5.367 +dependency_error_file_tools() 5.368 +{ 5.369 + printf "checking for file-tools... " 5.370 + # dependency file-tools 5.371 + while true 5.372 + do 5.373 + cat >> $TEMP_DIR/make.mk << __EOF__ 5.374 +# Dependency: file-tools 5.375 +MKDIR=mkdir -p 5.376 +RMDIR=rm -f -R 5.377 +COPYFILE=cp 5.378 +COPYALL=cp -R 5.379 + 5.380 +__EOF__ 5.381 + echo yes 5.382 + return 1 5.383 + done 5.384 + 5.385 + echo no 5.386 + return 0 5.387 +} 5.388 +dependency_error_cmake() 5.389 +{ 5.390 + printf "checking for cmake... " 5.391 + # dependency cmake 5.392 + while true 5.393 + do 5.394 + if test -n "$CMAKE" > /dev/null ; then 5.395 + : 5.396 + else 5.397 + break 5.398 + fi 5.399 + echo yes 5.400 + return 1 5.401 + done 5.402 + 5.403 + echo no 5.404 + return 0 5.405 +} 5.406 +dependency_error_doxygen() 5.407 +{ 5.408 + printf "checking for doxygen... " 5.409 + # dependency doxygen 5.410 + while true 5.411 + do 5.412 + if test -n "$DOXYGEN" > /dev/null ; then 5.413 + : 5.414 + else 5.415 + break 5.416 + fi 5.417 + echo yes 5.418 + return 1 5.419 + done 5.420 + 5.421 + echo no 5.422 + return 0 5.423 +} 5.424 + 5.425 + 5.426 + 5.427 + 5.428 +# start collecting dependency information 5.429 +echo > "$TEMP_DIR/flags.mk" 5.430 + 5.431 +DEPENDENCIES_FAILED= 5.432 +ERROR=0 5.433 +# unnamed dependencies 5.434 +TEMP_CFLAGS= 5.435 +TEMP_CXXFLAGS= 5.436 +TEMP_LDFLAGS= 5.437 +while true 5.438 +do 5.439 + while true 5.440 + do 5.441 + 5.442 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 5.443 +# library version 5.444 +VERSION="3.0.0" 5.445 + 5.446 +# build directory structure !! do not change or override !! 5.447 +BUILD_DIR=${src_dir}/build 5.448 +DOCS_DIR=${src_dir}/build/docs 5.449 +DIST_DIR=${src_dir}/dist 5.450 + 5.451 +__EOF__ 5.452 + break 5.453 + done 5.454 + break 5.455 +done 5.456 + 5.457 +# add general dependency flags to flags.mk 5.458 +echo "# general flags" >> "$TEMP_DIR/flags.mk" 5.459 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 5.460 + echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 5.461 +fi 5.462 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 5.463 + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 5.464 +fi 5.465 +if [ -n "${TEMP_LDFLAGS}" ]; then 5.466 + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 5.467 +fi 5.468 + 5.469 +# 5.470 +# OPTION VALUES 5.471 +# 5.472 +checkopt_with_tests_yes() 5.473 +{ 5.474 + VERR=0 5.475 + if dependency_error_cpp ; then 5.476 + VERR=1 5.477 + fi 5.478 + if dependency_error_cmake ; then 5.479 + VERR=1 5.480 + fi 5.481 + if [ $VERR -ne 0 ]; then 5.482 + return 1 5.483 + fi 5.484 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 5.485 +WITH_TESTS=yes 5.486 + 5.487 +__EOF__ 5.488 + return 0 5.489 +} 5.490 +checkopt_with_tests_no() 5.491 +{ 5.492 + VERR=0 5.493 + if [ $VERR -ne 0 ]; then 5.494 + return 1 5.495 + fi 5.496 + return 0 5.497 +} 5.498 +checkopt_with_docs_all() 5.499 +{ 5.500 + VERR=0 5.501 + if dependency_error_pandoc ; then 5.502 + VERR=1 5.503 + fi 5.504 + if dependency_error_doxygen ; then 5.505 + VERR=1 5.506 + fi 5.507 + if [ $VERR -ne 0 ]; then 5.508 + return 1 5.509 + fi 5.510 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 5.511 +# Documentation 5.512 +WITH_DOCS_API=yes 5.513 +WITH_DOCS_HTML=yes 5.514 + 5.515 +__EOF__ 5.516 + return 0 5.517 +} 5.518 +checkopt_with_docs_html() 5.519 +{ 5.520 + VERR=0 5.521 + if dependency_error_pandoc ; then 5.522 + VERR=1 5.523 + fi 5.524 + if [ $VERR -ne 0 ]; then 5.525 + return 1 5.526 + fi 5.527 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 5.528 +# Documentation 5.529 +WITH_DOCS_HTML=yes 5.530 + 5.531 +__EOF__ 5.532 + return 0 5.533 +} 5.534 +checkopt_with_docs_api() 5.535 +{ 5.536 + VERR=0 5.537 + if dependency_error_doxygen ; then 5.538 + VERR=1 5.539 + fi 5.540 + if [ $VERR -ne 0 ]; then 5.541 + return 1 5.542 + fi 5.543 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 5.544 +# Documentation 5.545 +WITH_DOCS_API=yes 5.546 + 5.547 +__EOF__ 5.548 + return 0 5.549 +} 5.550 +checkopt_with_docs_none() 5.551 +{ 5.552 + VERR=0 5.553 + if [ $VERR -ne 0 ]; then 5.554 + return 1 5.555 + fi 5.556 + return 0 5.557 +} 5.558 + 5.559 +# 5.560 +# TARGETS 5.561 +# 5.562 + 5.563 +echo >> "$TEMP_DIR/flags.mk" 5.564 +echo "configuring global target" 5.565 +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" 5.566 +TEMP_CFLAGS= 5.567 +TEMP_CXXFLAGS= 5.568 +TEMP_LDFLAGS= 5.569 + 5.570 +if dependency_error_c; then 5.571 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED c " 5.572 + ERROR=1 5.573 +fi 5.574 +if dependency_error_file_tools; then 5.575 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED file_tools " 5.576 + ERROR=1 5.577 +fi 5.578 + 5.579 +# Features 5.580 + 5.581 +# Option: --with-tests 5.582 +if [ -z "$OPT_WITH_TESTS" ]; then 5.583 + echo "auto-detecting option 'with-tests'" 5.584 + SAVED_ERROR="$ERROR" 5.585 + SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 5.586 + ERROR=1 5.587 + while true 5.588 + do 5.589 + if checkopt_with_tests_yes ; then 5.590 + echo " with-tests: yes" >> "$TEMP_DIR/options" 5.591 + ERROR=0 5.592 + break 5.593 + fi 5.594 + if checkopt_with_tests_no ; then 5.595 + echo " with-tests: no" >> "$TEMP_DIR/options" 5.596 + ERROR=0 5.597 + break 5.598 + fi 5.599 + break 5.600 + done 5.601 + if [ $ERROR -ne 0 ]; then 5.602 + SAVED_ERROR=1 5.603 + SAVED_DEPENDENCIES_FAILED="option 'with-tests' $SAVED_DEPENDENCIES_FAILED" 5.604 + fi 5.605 + ERROR="$SAVED_ERROR" 5.606 + DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" 5.607 +else 5.608 + echo "checking option with-tests = $OPT_WITH_TESTS" 5.609 + if false; then 5.610 + false 5.611 + elif [ "$OPT_WITH_TESTS" = "yes" ]; then 5.612 + echo " with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options 5.613 + if checkopt_with_tests_yes ; then 5.614 + : 5.615 + else 5.616 + ERROR=1 5.617 + DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED" 5.618 + fi 5.619 + elif [ "$OPT_WITH_TESTS" = "no" ]; then 5.620 + echo " with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options 5.621 + if checkopt_with_tests_no ; then 5.622 + : 5.623 + else 5.624 + ERROR=1 5.625 + DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED" 5.626 + fi 5.627 + fi 5.628 +fi 5.629 +# Option: --with-docs 5.630 +if [ -z "$OPT_WITH_DOCS" ]; then 5.631 + echo "auto-detecting option 'with-docs'" 5.632 + SAVED_ERROR="$ERROR" 5.633 + SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 5.634 + ERROR=1 5.635 + while true 5.636 + do 5.637 + if checkopt_with_docs_all ; then 5.638 + echo " with-docs: all" >> "$TEMP_DIR/options" 5.639 + ERROR=0 5.640 + break 5.641 + fi 5.642 + if checkopt_with_docs_html ; then 5.643 + echo " with-docs: html" >> "$TEMP_DIR/options" 5.644 + ERROR=0 5.645 + break 5.646 + fi 5.647 + if checkopt_with_docs_api ; then 5.648 + echo " with-docs: api" >> "$TEMP_DIR/options" 5.649 + ERROR=0 5.650 + break 5.651 + fi 5.652 + if checkopt_with_docs_none ; then 5.653 + echo " with-docs: none" >> "$TEMP_DIR/options" 5.654 + ERROR=0 5.655 + break 5.656 + fi 5.657 + break 5.658 + done 5.659 + if [ $ERROR -ne 0 ]; then 5.660 + SAVED_ERROR=1 5.661 + SAVED_DEPENDENCIES_FAILED="option 'with-docs' $SAVED_DEPENDENCIES_FAILED" 5.662 + fi 5.663 + ERROR="$SAVED_ERROR" 5.664 + DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" 5.665 +else 5.666 + echo "checking option with-docs = $OPT_WITH_DOCS" 5.667 + if false; then 5.668 + false 5.669 + elif [ "$OPT_WITH_DOCS" = "all" ]; then 5.670 + echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options 5.671 + if checkopt_with_docs_all ; then 5.672 + : 5.673 + else 5.674 + ERROR=1 5.675 + DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" 5.676 + fi 5.677 + elif [ "$OPT_WITH_DOCS" = "html" ]; then 5.678 + echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options 5.679 + if checkopt_with_docs_html ; then 5.680 + : 5.681 + else 5.682 + ERROR=1 5.683 + DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" 5.684 + fi 5.685 + elif [ "$OPT_WITH_DOCS" = "api" ]; then 5.686 + echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options 5.687 + if checkopt_with_docs_api ; then 5.688 + : 5.689 + else 5.690 + ERROR=1 5.691 + DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" 5.692 + fi 5.693 + elif [ "$OPT_WITH_DOCS" = "none" ]; then 5.694 + echo " with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options 5.695 + if checkopt_with_docs_none ; then 5.696 + : 5.697 + else 5.698 + ERROR=1 5.699 + DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED" 5.700 + fi 5.701 + fi 5.702 +fi 5.703 + 5.704 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 5.705 + echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 5.706 +fi 5.707 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 5.708 + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 5.709 +fi 5.710 +if [ "$BUILD_TYPE" = "debug" ]; then 5.711 + if [ -n "$lang_c" ]; then 5.712 + echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 5.713 + fi 5.714 + if [ -n "$lang_cpp" ]; then 5.715 + echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 5.716 + fi 5.717 +fi 5.718 +if [ "$BUILD_TYPE" = "release" ]; then 5.719 + if [ -n "$lang_c" ]; then 5.720 + echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 5.721 + fi 5.722 + if [ -n "$lang_cpp" ]; then 5.723 + echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 5.724 + fi 5.725 +fi 5.726 +if [ -n "${TEMP_LDFLAGS}" ]; then 5.727 + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 5.728 +fi 5.729 + 5.730 + 5.731 +# final result 5.732 +if [ $ERROR -ne 0 ]; then 5.733 + echo 5.734 + echo "Error: Unresolved dependencies" 5.735 + echo "$DEPENDENCIES_FAILED" 5.736 + abort_configure 5.737 +fi 5.738 + 5.739 +echo "configure finished" 5.740 +echo 5.741 +echo "Build Config:" 5.742 +echo " PREFIX: $prefix" 5.743 +echo " TOOLCHAIN: $TOOLCHAIN_NAME" 5.744 +echo "Options:" 5.745 +cat "$TEMP_DIR/options" 5.746 +echo 5.747 + 5.748 +# generate the config.mk file 5.749 +cat > "$TEMP_DIR/config.mk" << __EOF__ 5.750 +# 5.751 +# config.mk generated by configure 5.752 +# 5.753 + 5.754 +__EOF__ 5.755 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk" 5.756 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk 5.757 +rm -Rf "$TEMP_DIR" 5.758 + 5.759 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/docs/Makefile Thu Oct 12 00:00:35 2023 +0200 6.3 @@ -0,0 +1,58 @@ 6.4 +# Copyright 2023 Mike Becker. All rights reserved. 6.5 +# 6.6 +# Redistribution and use in source and binary forms, with or without 6.7 +# modification, are permitted provided that the following conditions are met: 6.8 +# 6.9 +# 1. Redistributions of source code must retain the above copyright 6.10 +# notice, this list of conditions and the following disclaimer. 6.11 +# 6.12 +# 2. Redistributions in binary form must reproduce the above copyright 6.13 +# notice, this list of conditions and the following disclaimer in the 6.14 +# documentation and/or other materials provided with the distribution. 6.15 +# 6.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 6.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 6.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 6.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 6.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 6.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 6.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 6.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 6.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6.26 + 6.27 +include ../config.mk 6.28 + 6.29 +PAGES = index features install license modules-ucx2 6.30 +DOCS_HTML = $(PAGES:%=$(DOCS_DIR)/web/%.html) 6.31 +DOCS_CSS = $(DOCS_DIR)/web/ucx.css 6.32 + 6.33 +all: all-html all-api 6.34 + 6.35 +all-html: $(DOCS_DIR)/web $(DOCS_HTML) $(DOCS_CSS) FORCE 6.36 + @echo "[ HTML Docs Generated ]" 6.37 + 6.38 +all-api: $(DOCS_DIR)/web $(DOCS_DIR)/web/api-2.1 $(DOCS_DIR)/web/api FORCE 6.39 + @echo "[ API Docs Generated ]" 6.40 + 6.41 +$(DOCS_DIR)/web/api-2.1: api-2.1 FORCE 6.42 + $(COPYALL) $< $@ 6.43 + 6.44 +$(DOCS_DIR)/web/api: FORCE 6.45 + cd $(src_dir); $(DOXYGEN) 6.46 + 6.47 +$(DOCS_DIR)/web: 6.48 + $(MKDIR) $@ 6.49 + 6.50 +$(DOCS_CSS): src/ucx.css 6.51 + $(COPYFILE) $< $@ 6.52 + 6.53 +$(DOCS_DIR)/web/modules-ucx2.html: src/modules-ucx2.md 6.54 + $(PANDOC) -c ucx.css -B src/header-ucx2.html -A src/footer.html \ 6.55 + -T 'UAP Common Extensions' -o $@ $< 6.56 + 6.57 +$(DOCS_DIR)/web/%.html: src/%.md 6.58 + $(PANDOC) -c ucx.css -B src/header.html -A src/footer.html \ 6.59 + -T 'UAP Common Extensions' -o $@ $< 6.60 + 6.61 +FORCE:
7.1 --- a/docs/src/CMakeLists.txt Sun Sep 03 09:10:16 2023 +0200 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,75 +0,0 @@ 7.4 -# 7.5 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 7.6 -# 7.7 -# Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. 7.8 -# 7.9 -# Redistribution and use in source and binary forms, with or without 7.10 -# modification, are permitted provided that the following conditions are met: 7.11 -# 7.12 -# 1. Redistributions of source code must retain the above copyright 7.13 -# notice, this list of conditions and the following disclaimer. 7.14 -# 7.15 -# 2. Redistributions in binary form must reproduce the above copyright 7.16 -# notice, this list of conditions and the following disclaimer in the 7.17 -# documentation and/or other materials provided with the distribution. 7.18 -# 7.19 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 7.20 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 7.21 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 7.22 -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 7.23 -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 7.24 -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 7.25 -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 7.26 -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 7.27 -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 7.28 -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 7.29 -# POSSIBILITY OF SUCH DAMAGE. 7.30 -# 7.31 - 7.32 -set(PANDOC_DESTDIR ${CMAKE_BINARY_DIR}/docs/web) 7.33 -set(PANDOC_ARGS -c ucx.css -B header.html -A footer.html -T 'UAP Common Extensions') 7.34 -set(PANDOC_SRC index.md license.md install.md features.md) 7.35 -set(LOGO_PATH ../../uaplogo.png) 7.36 - 7.37 -if (NOT EXISTS ${PANDOC_EXECUTABLE}) 7.38 - find_program(PANDOC_EXECUTABLE pandoc) 7.39 - if(NOT EXISTS ${PANDOC_EXECUTABLE}) 7.40 - message(STATUS "Pandoc not found, docs-html target will not be generated.") 7.41 - return() 7.42 - endif() 7.43 -endif() 7.44 - 7.45 -message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.") 7.46 -file(MAKE_DIRECTORY ${PANDOC_DESTDIR}) 7.47 - 7.48 -# UCX 3.0 documentation 7.49 -foreach(source_file ${PANDOC_SRC}) 7.50 - string(REPLACE .md .html dest_file ${source_file}) 7.51 - string(PREPEND dest_file "${PANDOC_DESTDIR}/") 7.52 - list(APPEND PANDOC_DEST ${dest_file}) 7.53 - add_custom_command( 7.54 - OUTPUT ${dest_file} 7.55 - COMMAND ${PANDOC_EXECUTABLE} ${PANDOC_ARGS} -o ${dest_file} ${source_file} 7.56 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 7.57 - MAIN_DEPENDENCY ${source_file} 7.58 - DEPENDS header.html footer.html 7.59 - ) 7.60 -endforeach() 7.61 - 7.62 -# UCX 2.1 documentation 7.63 -add_custom_target(docs-html-21 7.64 - COMMAND ${PANDOC_EXECUTABLE} -c ucx.css -B header-ucx2.html -A footer.html 7.65 - -T 'UAP Common Extensions' -o ${PANDOC_DESTDIR}/modules-ucx2.html modules-ucx2.md 7.66 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 7.67 - DEPENDS modules-ucx2.md header-ucx2.html footer.html 7.68 - COMMENT "Adding UCX 2.1 HTML documentation." 7.69 -) 7.70 - 7.71 -# Collect all HTML documentation 7.72 -add_custom_target(docs-html 7.73 - COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css 7.74 - COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png 7.75 - DEPENDS ${PANDOC_DEST} docs-html-21 7.76 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 7.77 - COMMENT "Generating HTML documentation with pandoc." 7.78 -)
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/make/cc.mk Thu Oct 12 00:00:35 2023 +0200 8.3 @@ -0,0 +1,14 @@ 8.4 +# 8.5 +# cc toolchain config 8.6 +# 8.7 + 8.8 +CFLAGS = 8.9 +CXXFLAGS = 8.10 +DEBUG_CC_FLAGS = -g 8.11 +DEBUG_CXX_FLAGS = -g 8.12 +RELEASE_CC_FLAGS = -O3 -DNDEBUG 8.13 +RELEASE_CXX_FLAGS = -O3 -DNDEBUG 8.14 +LDFLAGS = 8.15 + 8.16 +SHLIB_CFLAGS = -fPIC 8.17 +SHLIB_LDFLAGS = -shared 8.18 \ No newline at end of file
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/make/clang.mk Thu Oct 12 00:00:35 2023 +0200 9.3 @@ -0,0 +1,14 @@ 9.4 +# 9.5 +# gcc toolchain config 9.6 +# 9.7 + 9.8 +CFLAGS = 9.9 +CXXFLAGS = 9.10 +DEBUG_CC_FLAGS = -g -Wall -Wextra -pedantic 9.11 +DEBUG_CXX_FLAGS = -g -Wall -Wextra -pedantic 9.12 +RELEASE_CC_FLAGS = -O3 -DNDEBUG 9.13 +RELEASE_CXX_FLAGS = -O3 -DNDEBUG 9.14 +LDFLAGS = 9.15 + 9.16 +SHLIB_CFLAGS = -fPIC 9.17 +SHLIB_LDFLAGS = -shared 9.18 \ No newline at end of file
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/make/configure.vm Thu Oct 12 00:00:35 2023 +0200 10.3 @@ -0,0 +1,640 @@ 10.4 +#!/bin/sh 10.5 + 10.6 +# create temporary directory 10.7 +TEMP_DIR=".tmp-`uname -n`" 10.8 +rm -Rf "$TEMP_DIR" 10.9 +if mkdir -p "$TEMP_DIR"; then 10.10 + : 10.11 +else 10.12 + echo "Cannot create tmp dir $TEMP_DIR" 10.13 + echo "Abort" 10.14 + exit 1 10.15 +fi 10.16 +touch "$TEMP_DIR/options" 10.17 +touch "$TEMP_DIR/features" 10.18 + 10.19 +# define standard variables 10.20 +# also define standard prefix (this is where we will search for config.site) 10.21 +prefix=/usr 10.22 +exec_prefix= 10.23 +bindir= 10.24 +sbindir= 10.25 +libdir= 10.26 +libexecdir= 10.27 +datarootdir= 10.28 +datadir= 10.29 +sysconfdir= 10.30 +sharedstatedir= 10.31 +localstatedir= 10.32 +runstatedir= 10.33 +includedir= 10.34 +infodir= 10.35 +localedir= 10.36 +mandir= 10.37 + 10.38 +# custom variables 10.39 +#foreach( $var in $vars ) 10.40 +#if( $var.exec ) 10.41 +${var.varName}=`${var.value}` 10.42 +#else 10.43 +${var.varName}="${var.value}" 10.44 +#end 10.45 +#end 10.46 + 10.47 +# features 10.48 +#foreach( $feature in $features ) 10.49 +#if( ${feature.auto} ) 10.50 +${feature.varName}=auto 10.51 +#end 10.52 +#end 10.53 + 10.54 +# clean abort 10.55 +abort_configure() 10.56 +{ 10.57 + rm -Rf "$TEMP_DIR" 10.58 + exit 1 10.59 +} 10.60 + 10.61 +# help text 10.62 +printhelp() 10.63 +{ 10.64 + echo "Usage: $0 [OPTIONS]..." 10.65 + cat << __EOF__ 10.66 +Installation directories: 10.67 + --prefix=PREFIX path prefix for architecture-independent files 10.68 + [/usr] 10.69 + --exec-prefix=EPREFIX path prefix for architecture-dependent files 10.70 + [PREFIX] 10.71 + 10.72 + --bindir=DIR user executables [EPREFIX/bin] 10.73 + --sbindir=DIR system admin executables [EPREFIX/sbin] 10.74 + --libexecdir=DIR program executables [EPREFIX/libexec] 10.75 + --sysconfdir=DIR system configuration files [PREFIX/etc] 10.76 + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 10.77 + --localstatedir=DIR modifiable single-machine data [PREFIX/var] 10.78 + --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] 10.79 + --libdir=DIR object code libraries [EPREFIX/lib] 10.80 + --includedir=DIR C header files [PREFIX/include] 10.81 + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 10.82 + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] 10.83 + --infodir=DIR info documentation [DATAROOTDIR/info] 10.84 + --mandir=DIR man documentation [DATAROOTDIR/man] 10.85 + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 10.86 + 10.87 +#if( $options.size() > 0 ) 10.88 +Options: 10.89 + --debug add extra compile flags for debug builds 10.90 + --release add extra compile flags for release builds 10.91 +#foreach( $opt in $options ) 10.92 + --${opt.argument}=${opt.valuesString} 10.93 +#end 10.94 + 10.95 +#end 10.96 +#if( $features.size() > 0 ) 10.97 +Optional Features: 10.98 +#foreach( $feature in $features ) 10.99 +#if( $feature.auto ) 10.100 + --disable-${feature.arg} 10.101 +#else 10.102 + --enable-${feature.arg} 10.103 +#end 10.104 +#end 10.105 + 10.106 +#end 10.107 +__EOF__ 10.108 +} 10.109 + 10.110 +# 10.111 +# parse arguments 10.112 +# 10.113 +BUILD_TYPE="default" 10.114 +#set( $D = '$' ) 10.115 +for ARG in "$@" 10.116 +do 10.117 + case "$ARG" in 10.118 + "--prefix="*) prefix=${D}{ARG#--prefix=} ;; 10.119 + "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; 10.120 + "--bindir="*) bindir=${D}{ARG#----bindir=} ;; 10.121 + "--sbindir="*) sbindir=${D}{ARG#--sbindir=} ;; 10.122 + "--libdir="*) libdir=${D}{ARG#--libdir=} ;; 10.123 + "--libexecdir="*) libexecdir=${D}{ARG#--libexecdir=} ;; 10.124 + "--datarootdir="*) datarootdir=${D}{ARG#--datarootdir=} ;; 10.125 + "--datadir="*) datadir=${D}{ARG#--datadir=} ;; 10.126 + "--sysconfdir="*) sysconfdir=${D}{ARG#--sysconfdir=} ;; 10.127 + "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;; 10.128 + "--localstatedir="*) localstatedir=${D}{ARG#--localstatedir=} ;; 10.129 + "--includedir="*) includedir=${D}{ARG#--includedir=} ;; 10.130 + "--infodir="*) infodir=${D}{ARG#--infodir=} ;; 10.131 + "--mandir"*) mandir=${D}{ARG#--mandir} ;; 10.132 + "--localedir"*) localedir=${D}{ARG#--localedir} ;; 10.133 + "--help"*) printhelp; abort_configure ;; 10.134 + "--debug") BUILD_TYPE="debug" ;; 10.135 + "--release") BUILD_TYPE="release" ;; 10.136 + #foreach( $opt in $options ) 10.137 + "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;; 10.138 + #end 10.139 + #foreach( $feature in $features ) 10.140 + "--enable-${feature.arg}") ${feature.varName}=on ;; 10.141 + "--disable-${feature.arg}") unset ${feature.varName} ;; 10.142 + #end 10.143 + "-"*) echo "unknown option: $ARG"; abort_configure ;; 10.144 + esac 10.145 +done 10.146 + 10.147 +## Begin unparsed content. ** 10.148 +#[[ 10.149 + 10.150 +# set defaults for dir variables 10.151 +: ${exec_prefix:="$prefix"} 10.152 +: ${bindir:='${exec_prefix}/bin'} 10.153 +: ${sbindir:='${exec_prefix}/sbin'} 10.154 +: ${libdir:='${exec_prefix}/lib'} 10.155 +: ${libexecdir:='${exec_prefix}/libexec'} 10.156 +: ${datarootdir:='${prefix}/share'} 10.157 +: ${datadir:='${datarootdir}'} 10.158 +: ${sysconfdir:='${prefix}/etc'} 10.159 +: ${sharedstatedir:='${prefix}/com'} 10.160 +: ${localstatedir:='${prefix}/var'} 10.161 +: ${runstatedir:='${localstatedir}/run'} 10.162 +: ${includedir:='${prefix}/include'} 10.163 +: ${infodir:='${datarootdir}/info'} 10.164 +: ${mandir:='${datarootdir}/man'} 10.165 +: ${localedir:='${datarootdir}/locale'} 10.166 + 10.167 +# check if a config.site exists and load it 10.168 +if [ -n "$CONFIG_SITE" ]; then 10.169 + # CONFIG_SITE may contain space separated file names 10.170 + for cs in $CONFIG_SITE; do 10.171 + printf "loading defaults from $cs... " 10.172 + . "$cs" 10.173 + echo ok 10.174 + done 10.175 +elif [ -f "$prefix/share/config.site" ]; then 10.176 + printf "loading site defaults... " 10.177 + . "$prefix/share/config.site" 10.178 + echo ok 10.179 +elif [ -f "$prefix/etc/config.site" ]; then 10.180 + printf "loading site defaults... " 10.181 + . "$prefix/etc/config.site" 10.182 + echo ok 10.183 +fi 10.184 + 10.185 +# Test for availability of pkg-config 10.186 +PKG_CONFIG=`command -v pkg-config` 10.187 +: ${PKG_CONFIG:="false"} 10.188 + 10.189 +# Simple uname based platform detection 10.190 +# $PLATFORM is used for platform dependent dependency selection 10.191 +OS=`uname -s` 10.192 +OS_VERSION=`uname -r` 10.193 +printf "detect platform... " 10.194 +if [ "$OS" = "SunOS" ]; then 10.195 + PLATFORM="solaris sunos unix svr4" 10.196 +fi 10.197 +if [ "$OS" = "Linux" ]; then 10.198 + PLATFORM="linux unix" 10.199 +fi 10.200 +if [ "$OS" = "FreeBSD" ]; then 10.201 + PLATFORM="freebsd bsd unix" 10.202 +fi 10.203 +if [ "$OS" = "Darwin" ]; then 10.204 + PLATFORM="macos osx bsd unix" 10.205 +fi 10.206 +if echo "$OS" | grep -i "MINGW" > /dev/null; then 10.207 + PLATFORM="windows mingw" 10.208 +fi 10.209 +: ${PLATFORM:="unix"} 10.210 + 10.211 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` 10.212 +echo "$PLATFORM_NAME" 10.213 + 10.214 +isplatform() 10.215 +{ 10.216 + for p in $PLATFORM 10.217 + do 10.218 + if [ "$p" = "$1" ]; then 10.219 + return 0 10.220 + fi 10.221 + done 10.222 + return 1 10.223 +} 10.224 +notisplatform() 10.225 +{ 10.226 + for p in $PLATFORM 10.227 + do 10.228 + if [ "$p" = "$1" ]; then 10.229 + return 1 10.230 + fi 10.231 + done 10.232 + return 0 10.233 +} 10.234 +]]# 10.235 +## End of unparsed content ** 10.236 + 10.237 +# generate vars.mk 10.238 +cat > "$TEMP_DIR/vars.mk" << __EOF__ 10.239 +prefix="$prefix" 10.240 +exec_prefix="$exec_prefix" 10.241 +bindir="$bindir" 10.242 +sbindir="$sbindir" 10.243 +libdir="$libdir" 10.244 +libexecdir="$libexecdir" 10.245 +datarootdir="$datarootdir" 10.246 +datadir="$datadir" 10.247 +sysconfdir="$sysconfdir" 10.248 +sharedstatedir="$sharedstatedir" 10.249 +localstatedir="$localstatedir" 10.250 +runstatedir="$runstatedir" 10.251 +includedir="$includedir" 10.252 +infodir="$infodir" 10.253 +mandir="$mandir" 10.254 +localedir="$localedir" 10.255 +#foreach( $var in $vars ) 10.256 +${var.varName}="${D}${var.varName}" 10.257 +#end 10.258 +__EOF__ 10.259 + 10.260 +# toolchain detection utilities 10.261 +. make/toolchain.sh 10.262 + 10.263 +# 10.264 +# DEPENDENCIES 10.265 +# 10.266 + 10.267 +# check languages 10.268 +lang_c= 10.269 +lang_cpp= 10.270 +#foreach( $lang in $languages ) 10.271 +if detect_${lang}_compiler ; then 10.272 + lang_${lang}=1 10.273 +fi 10.274 +#end 10.275 + 10.276 +# create buffer for make variables required by dependencies 10.277 +echo > "$TEMP_DIR/make.mk" 10.278 + 10.279 +test_pkg_config() 10.280 +{ 10.281 + if "$PKG_CONFIG" --exists "$1" ; then : 10.282 + else return 1 ; fi 10.283 + if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : 10.284 + else return 1 ; fi 10.285 + if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : 10.286 + else return 1 ; fi 10.287 + if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : 10.288 + else return 1 ; fi 10.289 + return 0 10.290 +} 10.291 + 10.292 +#foreach( $dependency in $namedDependencies ) 10.293 +dependency_error_${dependency.id}() 10.294 +{ 10.295 + printf "checking for ${dependency.name}... " 10.296 + #foreach( $sub in $dependency.subdependencies ) 10.297 + # dependency $sub.fullName 10.298 + while true 10.299 + do 10.300 + #if( $sub.platform ) 10.301 + if notisplatform "${sub.platform}"; then 10.302 + break 10.303 + fi 10.304 + #end 10.305 + #foreach( $np in $sub.notList ) 10.306 + if isplatform "${np}"; then 10.307 + break 10.308 + fi 10.309 + #end 10.310 + #foreach( $lang in $sub.lang ) 10.311 + if [ -z "$lang_${lang}" ] ; then 10.312 + break 10.313 + fi 10.314 + #end 10.315 + #if( $sub.pkgconfig.size() > 0 ) 10.316 + if [ -z "$PKG_CONFIG" ]; then 10.317 + break 10.318 + fi 10.319 + #end 10.320 + #foreach( $test in $sub.tests ) 10.321 + if $test > /dev/null ; then 10.322 + : 10.323 + else 10.324 + break 10.325 + fi 10.326 + #end 10.327 + #foreach( $pkg in $sub.pkgconfig ) 10.328 + if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then 10.329 + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" 10.330 + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" 10.331 + else 10.332 + break 10.333 + fi 10.334 + #end 10.335 + #foreach( $flags in $sub.flags ) 10.336 + #if( $flags.exec ) 10.337 + if tmp_flags=`$flags.value` ; then 10.338 + TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" 10.339 + else 10.340 + break 10.341 + fi 10.342 + #else 10.343 + TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" 10.344 + #end 10.345 + #end 10.346 + #if ( $sub.make.length() > 0 ) 10.347 + cat >> $TEMP_DIR/make.mk << __EOF__ 10.348 +# Dependency: $dependency.name 10.349 +$sub.make 10.350 +__EOF__ 10.351 + #end 10.352 + echo yes 10.353 + return 1 10.354 + done 10.355 + 10.356 + #end 10.357 + echo no 10.358 + return 0 10.359 +} 10.360 +#end 10.361 + 10.362 + 10.363 + 10.364 + 10.365 +# start collecting dependency information 10.366 +echo > "$TEMP_DIR/flags.mk" 10.367 + 10.368 +DEPENDENCIES_FAILED= 10.369 +ERROR=0 10.370 +#if( $dependencies.size() > 0 ) 10.371 +# unnamed dependencies 10.372 +TEMP_CFLAGS= 10.373 +TEMP_CXXFLAGS= 10.374 +TEMP_LDFLAGS= 10.375 +#foreach( $dependency in $dependencies ) 10.376 +while true 10.377 +do 10.378 + #if( $dependency.platform ) 10.379 + if notisplatform "${dependency.platform}"; then 10.380 + break 10.381 + fi 10.382 + #end 10.383 + #foreach( $np in $dependency.notList ) 10.384 + if isplatform "${np}"; then 10.385 + break 10.386 + fi 10.387 + #end 10.388 + while true 10.389 + do 10.390 + #foreach( $lang in $dependency.lang ) 10.391 + if [ -z "$lang_${lang}" ] ; then 10.392 + ERROR=1 10.393 + break 10.394 + fi 10.395 + #end 10.396 + #if( $dependency.pkgconfig.size() > 0 ) 10.397 + if [ -z "$PKG_CONFIG" ]; then 10.398 + ERROR=1 10.399 + break 10.400 + fi 10.401 + #end 10.402 + #foreach( $pkg in $dependency.pkgconfig ) 10.403 + printf "checking for pkg-config package $pkg.name... " 10.404 + if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then 10.405 + echo yes 10.406 + TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`" 10.407 + TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`" 10.408 + else 10.409 + echo no 10.410 + ERROR=1 10.411 + break 10.412 + fi 10.413 + #end 10.414 + 10.415 + #foreach( $flags in $dependency.flags ) 10.416 + #if( $flags.exec ) 10.417 + $flags.value > /dev/null 10.418 + if tmp_flags=`$flags.value` ; then 10.419 + TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags" 10.420 + else 10.421 + ERROR=1 10.422 + break 10.423 + fi 10.424 + #else 10.425 + TEMP_$flags.varName="$TEMP_$flags.varName $flags.value" 10.426 + #end 10.427 + #end 10.428 + #if ( $dependency.make.length() > 0 ) 10.429 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 10.430 +$dependency.make 10.431 +__EOF__ 10.432 + #end 10.433 + break 10.434 + done 10.435 + break 10.436 +done 10.437 +#end 10.438 + 10.439 +# add general dependency flags to flags.mk 10.440 +echo "# general flags" >> "$TEMP_DIR/flags.mk" 10.441 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 10.442 + echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 10.443 +fi 10.444 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 10.445 + echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 10.446 +fi 10.447 +if [ -n "${TEMP_LDFLAGS}" ]; then 10.448 + echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 10.449 +fi 10.450 +#end 10.451 + 10.452 +# 10.453 +# OPTION VALUES 10.454 +# 10.455 +#foreach( $opt in $options ) 10.456 +#foreach( $val in $opt.values ) 10.457 +${val.func}() 10.458 +{ 10.459 + VERR=0 10.460 + #foreach( $dep in $val.dependencies ) 10.461 + if dependency_error_$dep ; then 10.462 + VERR=1 10.463 + fi 10.464 + #end 10.465 + if [ $VERR -ne 0 ]; then 10.466 + return 1 10.467 + fi 10.468 + #foreach( $def in $val.defines ) 10.469 + TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}" 10.470 + TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}" 10.471 + #end 10.472 + #if( $val.hasMake() ) 10.473 + cat >> "$TEMP_DIR/make.mk" << __EOF__ 10.474 +$val.make 10.475 +__EOF__ 10.476 + #end 10.477 + return 0 10.478 +} 10.479 +#end 10.480 +#end 10.481 + 10.482 +# 10.483 +# TARGETS 10.484 +# 10.485 + 10.486 +#foreach( $target in $targets ) 10.487 +echo >> "$TEMP_DIR/flags.mk" 10.488 +#if ( $target.name ) 10.489 +echo "configuring target: $target.name" 10.490 +echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk" 10.491 +#else 10.492 +echo "configuring global target" 10.493 +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" 10.494 +#end 10.495 +TEMP_CFLAGS= 10.496 +TEMP_CXXFLAGS= 10.497 +TEMP_LDFLAGS= 10.498 + 10.499 +#foreach( $dependency in $target.dependencies ) 10.500 +if dependency_error_$dependency; then 10.501 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " 10.502 + ERROR=1 10.503 +fi 10.504 +#end 10.505 + 10.506 +# Features 10.507 +#foreach( $feature in $target.features ) 10.508 +if [ -n "${D}${feature.varName}" ]; then 10.509 +#foreach( $dependency in $feature.dependencies ) 10.510 + # check dependency 10.511 + if dependency_error_$dependency ; then 10.512 + # "auto" features can fail and are just disabled in this case 10.513 + if [ "${D}${feature.varName}" = "auto" ]; then 10.514 + DISABLE_${feature.varName}=1 10.515 + else 10.516 + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} " 10.517 + ERROR=1 10.518 + fi 10.519 + fi 10.520 +#end 10.521 + if [ -n "$DISABLE_${feature.varName}" ]; then 10.522 + unset ${feature.varName} 10.523 + fi 10.524 +fi 10.525 +#end 10.526 + 10.527 +#foreach( $opt in $target.options ) 10.528 +# Option: --${opt.argument} 10.529 +if [ -z "${D}${opt.varName}" ]; then 10.530 + echo "auto-detecting option '${opt.argument}'" 10.531 + SAVED_ERROR="$ERROR" 10.532 + SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 10.533 + ERROR=1 10.534 + while true 10.535 + do 10.536 + #foreach( $optdef in $opt.defaults ) 10.537 + #if( $optdef.platform ) 10.538 + if isplatform "$optdef.platform"; then 10.539 + #end 10.540 + if $optdef.func ; then 10.541 + echo " ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options" 10.542 + ERROR=0 10.543 + break 10.544 + fi 10.545 + #if( $optdef.platform ) 10.546 + fi 10.547 + #end 10.548 + #end 10.549 + break 10.550 + done 10.551 + if [ $ERROR -ne 0 ]; then 10.552 + SAVED_ERROR=1 10.553 + SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED" 10.554 + fi 10.555 + ERROR="$SAVED_ERROR" 10.556 + DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" 10.557 +else 10.558 + echo "checking option ${opt.argument} = ${D}${opt.varName}" 10.559 + if false; then 10.560 + false 10.561 + #foreach( $optval in $opt.values ) 10.562 + elif [ "${D}${opt.varName}" = "${optval.value}" ]; then 10.563 + echo " ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options 10.564 + if $optval.func ; then 10.565 + : 10.566 + else 10.567 + ERROR=1 10.568 + DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED" 10.569 + fi 10.570 + #end 10.571 + fi 10.572 +fi 10.573 +#end 10.574 + 10.575 +if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 10.576 + echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 10.577 +fi 10.578 +if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 10.579 + echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 10.580 +fi 10.581 +if [ "$BUILD_TYPE" = "debug" ]; then 10.582 + if [ -n "$lang_c" ]; then 10.583 + echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 10.584 + fi 10.585 + if [ -n "$lang_cpp" ]; then 10.586 + echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 10.587 + fi 10.588 +fi 10.589 +if [ "$BUILD_TYPE" = "release" ]; then 10.590 + if [ -n "$lang_c" ]; then 10.591 + echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" 10.592 + fi 10.593 + if [ -n "$lang_cpp" ]; then 10.594 + echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" 10.595 + fi 10.596 +fi 10.597 +if [ -n "${TEMP_LDFLAGS}" ]; then 10.598 + echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" 10.599 +fi 10.600 + 10.601 +#end 10.602 + 10.603 +# final result 10.604 +if [ $ERROR -ne 0 ]; then 10.605 + echo 10.606 + echo "Error: Unresolved dependencies" 10.607 + echo "$DEPENDENCIES_FAILED" 10.608 + abort_configure 10.609 +fi 10.610 + 10.611 +echo "configure finished" 10.612 +echo 10.613 +echo "Build Config:" 10.614 +echo " PREFIX: $prefix" 10.615 +echo " TOOLCHAIN: $TOOLCHAIN_NAME" 10.616 +#if ( $options.size() > 0 ) 10.617 +echo "Options:" 10.618 +cat "$TEMP_DIR/options" 10.619 +#end 10.620 +#if ( $features.size() > 0 ) 10.621 +echo "Features:" 10.622 +#foreach( $feature in $features ) 10.623 +if [ -n "${D}${feature.varName}" ]; then 10.624 +echo " $feature.name: on" 10.625 +else 10.626 +echo " $feature.name: off" 10.627 +fi 10.628 +#end 10.629 +#end 10.630 +echo 10.631 + 10.632 +# generate the config.mk file 10.633 +cat > "$TEMP_DIR/config.mk" << __EOF__ 10.634 +# 10.635 +# config.mk generated by configure 10.636 +# 10.637 + 10.638 +__EOF__ 10.639 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk" 10.640 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk 10.641 +rm -Rf "$TEMP_DIR" 10.642 + 10.643 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/make/gcc.mk Thu Oct 12 00:00:35 2023 +0200 11.3 @@ -0,0 +1,14 @@ 11.4 +# 11.5 +# gcc toolchain config 11.6 +# 11.7 + 11.8 +CFLAGS = 11.9 +CXXFLAGS = 11.10 +DEBUG_CC_FLAGS = -g -Wall -Wextra -pedantic 11.11 +DEBUG_CXX_FLAGS = -g -Wall -Wextra -pedantic 11.12 +RELEASE_CC_FLAGS = -O3 -DNDEBUG 11.13 +RELEASE_CXX_FLAGS = -O3 -DNDEBUG 11.14 +LDFLAGS = 11.15 + 11.16 +SHLIB_CFLAGS = -fPIC 11.17 +SHLIB_LDFLAGS = -shared 11.18 \ No newline at end of file
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/make/project.xml Thu Oct 12 00:00:35 2023 +0200 12.3 @@ -0,0 +1,119 @@ 12.4 +<?xml version="1.0" encoding="UTF-8"?> 12.5 +<project xmlns="http://unixwork.de/uwproj"> 12.6 + <config> 12.7 + <var name="src_dir" exec="true">pwd</var> 12.8 + <var name="DOXYGEN" exec="true">command -v doxygen</var> 12.9 + <var name="PANDOC" exec="true">command -v pandoc</var> 12.10 + <var name="CMAKE" exec="true">command -v cmake</var> 12.11 + </config> 12.12 + 12.13 + <dependency> 12.14 + <make> 12.15 +# library version 12.16 +VERSION="3.0.0" 12.17 + 12.18 +# build directory structure !! do not change or override !! 12.19 +BUILD_DIR=${src_dir}/build 12.20 +DOCS_DIR=${src_dir}/build/docs 12.21 +DIST_DIR=${src_dir}/dist 12.22 + </make> 12.23 + </dependency> 12.24 + 12.25 + <dependency name="file-tools"> 12.26 + <make> 12.27 +MKDIR=mkdir -p 12.28 +RMDIR=rm -f -R 12.29 +COPYFILE=cp 12.30 +COPYALL=cp -R 12.31 + </make> 12.32 + </dependency> 12.33 + 12.34 + <dependency name="c" platform="mingw"> 12.35 + <lang>c</lang> 12.36 + <make> 12.37 +AR=ar 12.38 +ARFLAGS=r 12.39 +STLIB_EXT=.lib 12.40 +SHLIB_EXT=.dll 12.41 + </make> 12.42 + </dependency> 12.43 + 12.44 + <dependency name="c" platform="macos"> 12.45 + <lang>c</lang> 12.46 + <make> 12.47 +AR=ar 12.48 +ARFLAGS=r 12.49 +STLIB_EXT=.a 12.50 +SHLIB_EXT=.dylib 12.51 + </make> 12.52 + </dependency> 12.53 + 12.54 + <dependency name="c" platform="unix"> 12.55 + <lang>c</lang> 12.56 + <make> 12.57 +AR=ar 12.58 +ARFLAGS=r 12.59 +STLIB_EXT=.a 12.60 +SHLIB_EXT=.so 12.61 + </make> 12.62 + </dependency> 12.63 + 12.64 + <dependency name="cpp"> 12.65 + <lang>cpp</lang> 12.66 + </dependency> 12.67 + 12.68 + <dependency name="cmake"> 12.69 + <test>test -n "$CMAKE"</test> 12.70 + </dependency> 12.71 + 12.72 + <dependency name="doxygen"> 12.73 + <test>test -n "$DOXYGEN"</test> 12.74 + </dependency> 12.75 + 12.76 + <dependency name="pandoc"> 12.77 + <test>test -n "$PANDOC"</test> 12.78 + </dependency> 12.79 + 12.80 + <target> 12.81 + <option arg="with-tests"> 12.82 + <value str="yes"> 12.83 + <dependencies>cpp,cmake</dependencies> 12.84 + <make>WITH_TESTS=yes</make> 12.85 + </value> 12.86 + <value str="no"/> 12.87 + <default value="yes"/> 12.88 + <default value="no"/> 12.89 + </option> 12.90 + <option arg="with-docs"> 12.91 + <value str="all"> 12.92 + <dependencies>pandoc,doxygen</dependencies> 12.93 + <make> 12.94 +# Documentation 12.95 +WITH_DOCS_API=yes 12.96 +WITH_DOCS_HTML=yes 12.97 + </make> 12.98 + </value> 12.99 + <value str="html"> 12.100 + <dependencies>pandoc</dependencies> 12.101 + <make> 12.102 +# Documentation 12.103 +WITH_DOCS_HTML=yes 12.104 + </make> 12.105 + </value> 12.106 + <value str="api"> 12.107 + <dependencies>doxygen</dependencies> 12.108 + <make> 12.109 +# Documentation 12.110 +WITH_DOCS_API=yes 12.111 + </make> 12.112 + </value> 12.113 + <value str="none"/> 12.114 + <default value="all"/> 12.115 + <default value="html"/> 12.116 + <default value="api"/> 12.117 + <default value="none"/> 12.118 + </option> 12.119 + <dependencies>c,file-tools</dependencies> 12.120 + </target> 12.121 +</project> 12.122 +
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/make/suncc.mk Thu Oct 12 00:00:35 2023 +0200 13.3 @@ -0,0 +1,15 @@ 13.4 +# 13.5 +# suncc toolchain 13.6 +# 13.7 + 13.8 +CFLAGS = 13.9 +CXXFLAGS = 13.10 +DEBUG_CC_FLAGS = -g 13.11 +DEBUG_CXX_FLAGS = -g 13.12 +RELEASE_CC_FLAGS = -O3 -DNDEBUG 13.13 +RELEASE_CXX_FLAGS = -O3 -DNDEBUG 13.14 +LDFLAGS = 13.15 + 13.16 +SHLIB_CFLAGS = -Kpic 13.17 +SHLIB_LDFLAGS = -G 13.18 +
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/make/toolchain.sh Thu Oct 12 00:00:35 2023 +0200 14.3 @@ -0,0 +1,186 @@ 14.4 +#!/bin/sh 14.5 +# 14.6 +# toolchain detection 14.7 +# 14.8 + 14.9 +C_COMPILERS="gcc clang suncc cc" 14.10 +CPP_COMPILERS="g++ clang++ sunCC CC" 14.11 +unset TOOLCHAIN_NAME 14.12 +unset TOOLCHAIN_CC 14.13 +unset TOOLCHAIN_CXX 14.14 + 14.15 +check_c_compiler() 14.16 +{ 14.17 + cat > "$TEMP_DIR/test.c" << __EOF__ 14.18 +/* test file */ 14.19 +#include <stdio.h> 14.20 +int main(int argc, char **argv) { 14.21 +#if defined(__clang__) 14.22 + printf("clang\n"); 14.23 +#elif defined(__GNUC__) 14.24 + printf("gcc\n"); 14.25 +#elif defined(__sun) 14.26 + printf("suncc\n"); 14.27 +#else 14.28 + printf("unknown\n"); 14.29 +#endif 14.30 + return 0; 14.31 +} 14.32 +__EOF__ 14.33 + rm -f "$TEMP_DIR/checkcc" 14.34 + $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null 14.35 +} 14.36 + 14.37 +check_cpp_compiler() 14.38 +{ 14.39 + cat > "$TEMP_DIR/test.cpp" << __EOF__ 14.40 +/* test file */ 14.41 +#include <iostream> 14.42 +int main(int argc, char **argv) { 14.43 +#if defined(__clang__) 14.44 + std::cout << "clang" << std::endl; 14.45 +#elif defined(__GNUC__) 14.46 + std::cout << "gcc" << std::endl; 14.47 +#elif defined(__sun) 14.48 + std::cout << "suncc" << std::endl; 14.49 +#else 14.50 + std::cout << "cc" << std::endl; 14.51 +#endif 14.52 + return 0; 14.53 +} 14.54 +__EOF__ 14.55 + rm -f "$TEMP_DIR/checkcc" 14.56 + $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null 14.57 +} 14.58 + 14.59 +create_libtest_source() 14.60 +{ 14.61 + # $1: filename 14.62 + # $2: optional include 14.63 + cat > "$TEMP_DIR/$1" << __EOF__ 14.64 +/* libtest file */ 14.65 +int main(int argc, char **argv) { 14.66 + return 0; 14.67 +} 14.68 +__EOF__ 14.69 + if [ -n "$2" ]; then 14.70 + echo "#include <$2>" >> "$TEMP_DIR/$1" 14.71 + fi 14.72 +} 14.73 + 14.74 +check_c_lib() 14.75 +{ 14.76 + # $1: libname 14.77 + # $2: optional include 14.78 + if [ -z "$TOOLCHAIN_CC" ]; then 14.79 + return 1 14.80 + fi 14.81 + create_libtest_source "test.c" "$2" 14.82 + rm -f "$TEMP_DIR/checklib" 14.83 + $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null 14.84 +} 14.85 + 14.86 +check_cpp_lib() 14.87 +{ 14.88 + # $1: libname 14.89 + # $2: optional include 14.90 + if [ -z "$TOOLCHAIN_CXX" ]; then 14.91 + return 1 14.92 + fi 14.93 + create_libtest_source "test.cpp" "$2" 14.94 + rm -f "$TEMP_DIR/checklib" 14.95 + $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null 14.96 +} 14.97 + 14.98 +check_lib() 14.99 +{ 14.100 + # $1: libname 14.101 + # $2: optional include 14.102 + if [ -n "$TOOLCHAIN_CC" ]; then 14.103 + check_c_lib "$1" "$2" 14.104 + elif [ -n "$TOOLCHAIN_CXX" ]; then 14.105 + check_cpp_lib "$1" "$2" 14.106 + fi 14.107 +} 14.108 + 14.109 +detect_c_compiler() 14.110 +{ 14.111 + if [ -n "$TOOLCHAIN_CC" ]; then 14.112 + return 0 14.113 + fi 14.114 + printf "detect C compiler... " 14.115 + if [ -n "$CC" ]; then 14.116 + if check_c_compiler "$CC"; then 14.117 + TOOLCHAIN_CC=$CC 14.118 + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 14.119 + echo "$CC" 14.120 + return 0 14.121 + else 14.122 + echo "$CC is not a working C compiler" 14.123 + return 1 14.124 + fi 14.125 + else 14.126 + for COMP in $C_COMPILERS 14.127 + do 14.128 + if check_c_compiler "$COMP"; then 14.129 + TOOLCHAIN_CC=$COMP 14.130 + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 14.131 + echo "$COMP" 14.132 + return 0 14.133 + fi 14.134 + done 14.135 + echo "not found" 14.136 + return 1 14.137 + fi 14.138 +} 14.139 + 14.140 +detect_cpp_compiler() 14.141 +{ 14.142 + if [ -n "$TOOLCHAIN_CXX" ]; then 14.143 + return 0 14.144 + fi 14.145 + printf "detect C++ compiler... " 14.146 + 14.147 + if [ -n "$CXX" ]; then 14.148 + if check_cpp_compiler "$CXX"; then 14.149 + TOOLCHAIN_CXX=$CXX 14.150 + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 14.151 + echo "$CXX" 14.152 + return 0 14.153 + else 14.154 + echo "$CXX is not a working C++ compiler" 14.155 + return 1 14.156 + fi 14.157 + else 14.158 + for COMP in $CPP_COMPILERS 14.159 + do 14.160 + if check_cpp_compiler "$COMP"; then 14.161 + TOOLCHAIN_CXX=$COMP 14.162 + TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 14.163 + echo "$COMP" 14.164 + return 0 14.165 + fi 14.166 + done 14.167 + echo "${TOOLCHAIN_CXX:-"not found"}" 14.168 + return 1 14.169 + fi 14.170 +} 14.171 + 14.172 +write_toolchain_defaults() 14.173 +{ 14.174 + echo "# toolchain" >> "$1" 14.175 + if [ -n "$TOOLCHAIN_CC" ]; then 14.176 + echo "CC = ${TOOLCHAIN_CC}" >> "$1" 14.177 + fi 14.178 + if [ -n "$TOOLCHAIN_CXX" ]; then 14.179 + echo "CXX = ${TOOLCHAIN_CXX}" >> "$1" 14.180 + fi 14.181 + echo >> "$1" 14.182 + if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then 14.183 + cat "make/${TOOLCHAIN_NAME}.mk" >> "$1" 14.184 + elif [ -f "make/cc.mk" ]; then 14.185 + cat "make/cc.mk" >> "$1" 14.186 + else 14.187 + echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete." 14.188 + fi 14.189 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/make/uwproj.xsd Thu Oct 12 00:00:35 2023 +0200 15.3 @@ -0,0 +1,281 @@ 15.4 +<?xml version="1.0" encoding="UTF-8"?> 15.5 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 15.6 + xmlns="http://unixwork.de/uwproj" 15.7 + targetNamespace="http://unixwork.de/uwproj" 15.8 + elementFormDefault="qualified" 15.9 + version="0.1" 15.10 +> 15.11 + <xs:element name="project" type="ProjectType"/> 15.12 + 15.13 + <xs:complexType name="ProjectType"> 15.14 + <xs:annotation> 15.15 + <xs:documentation> 15.16 + The root element of an uwproj project. 15.17 + Consists of an optional <code>config</code> element 15.18 + and an arbitrary number of <code>dependency</code> 15.19 + and <code>target</code> elements. 15.20 + </xs:documentation> 15.21 + </xs:annotation> 15.22 + <xs:sequence> 15.23 + <xs:element name="config" type="ConfigType" minOccurs="0"/> 15.24 + <xs:element name="dependency" type="DependencyType" minOccurs="0" maxOccurs="unbounded"/> 15.25 + <xs:element name="target" type="TargetType" minOccurs="0" maxOccurs="unbounded"/> 15.26 + </xs:sequence> 15.27 + </xs:complexType> 15.28 + 15.29 + <xs:complexType name="ConfigType"> 15.30 + <xs:annotation> 15.31 + <xs:documentation> 15.32 + The configuration section. 15.33 + Consists of an arbitrary number of <code>var</code> elements. 15.34 + </xs:documentation> 15.35 + </xs:annotation> 15.36 + <xs:sequence> 15.37 + <xs:element name="var" type="ConfigVarType" minOccurs="0" maxOccurs="unbounded"/> 15.38 + </xs:sequence> 15.39 + </xs:complexType> 15.40 + 15.41 + <xs:complexType name="ConfigVarType"> 15.42 + <xs:annotation> 15.43 + <xs:documentation> 15.44 + The definition of a configuration variable. 15.45 + <p> 15.46 + Configuration variables are supposed to be used in the configure script and are also 15.47 + written to the resulting config file (in contrast to make variables, which are only 15.48 + written to the config file). 15.49 + The <code>name</code> attribute is mandatory, the value is defined by the text body of the element. 15.50 + The optional Boolean <code>exec</code> attribute (false by default) controls, whether the entire 15.51 + definition is automatically executed under command substitution. 15.52 + </p> 15.53 + </xs:documentation> 15.54 + </xs:annotation> 15.55 + <xs:simpleContent> 15.56 + <xs:extension base="xs:string"> 15.57 + <xs:attribute name="name" type="xs:string" use="required"/> 15.58 + <xs:attribute name="exec" type="xs:boolean" default="false"/> 15.59 + </xs:extension> 15.60 + </xs:simpleContent> 15.61 + </xs:complexType> 15.62 + 15.63 + <xs:complexType name="PkgConfigType"> 15.64 + <xs:annotation> 15.65 + <xs:documentation> 15.66 + Instructs configure to invoke <code>pkg-config</code>, if present on the system, to determine 15.67 + compiler and linker flags. The text body of this element defines the package name to search. 15.68 + To constrain the allowed versions, use the attributes <code>atleast, exact, max</code>. 15.69 + </xs:documentation> 15.70 + </xs:annotation> 15.71 + <xs:simpleContent> 15.72 + <xs:extension base="xs:string"> 15.73 + <xs:attribute name="atleast" type="xs:string"/> 15.74 + <xs:attribute name="exact" type="xs:string"/> 15.75 + <xs:attribute name="max" type="xs:string"/> 15.76 + </xs:extension> 15.77 + </xs:simpleContent> 15.78 + </xs:complexType> 15.79 + 15.80 + <xs:simpleType name="LangType"> 15.81 + <xs:annotation> 15.82 + <xs:documentation> 15.83 + Requests a compiler for the specified language. Allowed values are 15.84 + c, cpp. 15.85 + </xs:documentation> 15.86 + </xs:annotation> 15.87 + <xs:restriction base="xs:string"> 15.88 + <xs:enumeration value="c"/> 15.89 + <xs:enumeration value="cpp"/> 15.90 + </xs:restriction> 15.91 + </xs:simpleType> 15.92 + 15.93 + <xs:complexType name="DependencyType"> 15.94 + <xs:annotation> 15.95 + <xs:documentation> 15.96 + Declares a dependency. 15.97 + <p> 15.98 + If the optional <code>name</code> attribute is omitted, the dependency is global 15.99 + and must be satisfied, otherwise configuration shall fail. 15.100 + A <em>named dependency</em> can be referenced by a target (or is implicitly referenced 15.101 + by the default target, if no targets are specified). 15.102 + Multiple declarations for the same named dependency may exist, in which case each declaration 15.103 + is checked one after another, until one block is satisfied. The result of the first satisfied 15.104 + dependency declaration is supposed to be applied to the config file. 15.105 + </p> 15.106 + <p> 15.107 + The optional <code>platform</code> attribute may specify a <em>single</em> platform identifier and 15.108 + the optional <code>not</code> attribute may specify a comma-separated list of platform identifiers. 15.109 + The configure script shall skip this dependency declaration if the detected platform is not 15.110 + matching the filter specification of these attributes. 15.111 + </p> 15.112 + </xs:documentation> 15.113 + </xs:annotation> 15.114 + <xs:choice minOccurs="0" maxOccurs="unbounded"> 15.115 + <xs:element name="lang" type="LangType"/> 15.116 + <xs:element name="cflags" type="FlagsType"/> 15.117 + <xs:element name="cxxflags" type="FlagsType"/> 15.118 + <xs:element name="ldflags" type="FlagsType"/> 15.119 + <xs:element name="pkgconfig" type="PkgConfigType"/> 15.120 + <xs:element name="test" type="xs:string"> 15.121 + <xs:annotation> 15.122 + <xs:documentation> 15.123 + Specifies a custom command that shall be executed to test whether this dependency is satisfied. 15.124 + </xs:documentation> 15.125 + </xs:annotation> 15.126 + </xs:element> 15.127 + <xs:element name="make" type="MakeVarType"/> 15.128 + </xs:choice> 15.129 + <xs:attribute name="name" type="xs:string"/> 15.130 + <xs:attribute name="platform" type="xs:string"/> 15.131 + <xs:attribute name="not" type="xs:string"/> 15.132 + </xs:complexType> 15.133 + 15.134 + <xs:complexType name="FlagsType"> 15.135 + <xs:annotation> 15.136 + <xs:documentation> 15.137 + Instructs configure to append the contents of the element's body to the respective flags variable. 15.138 + If the optional <code>exec</code> flag is set to <code>true</code>, the contents are supposed to be 15.139 + executed under command substitution <em>at configuration time</em> before they are applied. 15.140 + </xs:documentation> 15.141 + </xs:annotation> 15.142 + <xs:simpleContent> 15.143 + <xs:extension base="xs:string"> 15.144 + <xs:attribute name="exec" type="xs:boolean" default="false"/> 15.145 + </xs:extension> 15.146 + </xs:simpleContent> 15.147 + </xs:complexType> 15.148 + 15.149 + <xs:complexType name="TargetType"> 15.150 + <xs:annotation> 15.151 + <xs:documentation> 15.152 + Declares a build target that is supposed to be configured. 15.153 + <p> 15.154 + If no build target is declared explicitly, an implicit default 15.155 + target is generated, which has the <code>alldependencies</code> 15.156 + flag set. 15.157 + </p> 15.158 + <p> 15.159 + The optional <code>name</code> attribute is also used to generate a prefix 15.160 + for the compiler and linker flags variables. 15.161 + Furthermore, a target may consist of an arbitrary number of <code>feature</code>, 15.162 + <code>option</code>, and <code>define</code> elements. 15.163 + Named dependencies can be listed (separated by comma) in the <code>dependencies</code> 15.164 + element. If this target shall use <em>all</em> available named dependencies, the empty 15.165 + element <code>alldependencies</code> can be used as a shortcut. 15.166 + </p> 15.167 + </xs:documentation> 15.168 + </xs:annotation> 15.169 + <xs:choice minOccurs="0" maxOccurs="unbounded"> 15.170 + <xs:element name="feature" type="FeatureType"/> 15.171 + <xs:element name="option" type="OptionType"/> 15.172 + <xs:element name="define" type="DefineType"/> 15.173 + <xs:element name="dependencies" type="DependenciesType"/> 15.174 + <xs:element name="alldependencies"> 15.175 + <xs:complexType/> 15.176 + </xs:element> 15.177 + </xs:choice> 15.178 + <xs:attribute name="name" type="xs:string"/> 15.179 + </xs:complexType> 15.180 + 15.181 + <xs:complexType name="FeatureType"> 15.182 + <xs:annotation> 15.183 + <xs:documentation> 15.184 + Declares an optional feature, that can be enabled during configuration, if all 15.185 + <code>dependencies</code> are satisfied. 15.186 + If a feature is enabled, all <code>define</code> and <code>make</code> definitions are 15.187 + supposed to be applied to the config file. 15.188 + In case the optional <code>default</code> attribute is set to true, the feature is enabled by default 15.189 + and is supposed to be automatically disabled (without error) when the dependencies are not satisfied. 15.190 + The name that is supposed to be used for the --enable and --disable arguments can be optionally 15.191 + specified with the <code>arg</code> attribute. Otherwise, the <code>name</code> is used by default. 15.192 + </xs:documentation> 15.193 + </xs:annotation> 15.194 + <xs:choice minOccurs="0" maxOccurs="unbounded"> 15.195 + <xs:group ref="TargetDataGroup"/> 15.196 + </xs:choice> 15.197 + <xs:attribute name="name" type="xs:string" use="required"/> 15.198 + <xs:attribute name="arg" type="xs:string"/> 15.199 + <xs:attribute name="default" type="xs:boolean" default="false"/> 15.200 + </xs:complexType> 15.201 + 15.202 + <xs:complexType name="OptionType"> 15.203 + <xs:annotation> 15.204 + <xs:documentation> 15.205 + Declares a configuration option. 15.206 + The option argument name is specified with the <code>arg</code> attribute. 15.207 + Then, the children of this element specify possible <code>values</code> by defining the conditions 15.208 + (in terms of dependencies) and effects (in terms of defines and make variables) of each value. 15.209 + Finally, a set of <code>default</code>s is specified which supposed to automagically select the most 15.210 + appropriate value for a specific platform under the available dependencies (in case the option is not 15.211 + explicitly specified by using the command line argument). 15.212 + </xs:documentation> 15.213 + </xs:annotation> 15.214 + <xs:sequence> 15.215 + <xs:element name="value" type="OptionValueType" minOccurs="0" maxOccurs="unbounded"/> 15.216 + <xs:element name="default" type="OptionDefaultType" minOccurs="0" maxOccurs="unbounded"/> 15.217 + </xs:sequence> 15.218 + <xs:attribute name="arg" type="xs:string" use="required"/> 15.219 + </xs:complexType> 15.220 + 15.221 + <xs:complexType name="OptionValueType"> 15.222 + <xs:annotation> 15.223 + <xs:documentation> 15.224 + Declares a possible value for the option (in the <code>str</code> attribute) and 15.225 + the conditions (<code>dependencies</code>) and effects, the value has. 15.226 + </xs:documentation> 15.227 + </xs:annotation> 15.228 + <xs:choice minOccurs="0" maxOccurs="unbounded"> 15.229 + <xs:group ref="TargetDataGroup"/> 15.230 + </xs:choice> 15.231 + <xs:attribute name="str" type="xs:string" use="required"/> 15.232 + </xs:complexType> 15.233 + 15.234 + <xs:complexType name="OptionDefaultType"> 15.235 + <xs:annotation> 15.236 + <xs:documentation> 15.237 + Specifies a default value for this option. Multiple default values can be specified, in which case 15.238 + they are checked one after another for availability. With the optional <code>platform</code> attribute, 15.239 + the default value can be constrained to a <em>single</em> specific platform and is supposed to be 15.240 + skipped by configure, when this platform is not detected. 15.241 + </xs:documentation> 15.242 + </xs:annotation> 15.243 + <xs:attribute name="value" type="xs:string" use="required"/> 15.244 + <xs:attribute name="platform" type="xs:string"/> 15.245 + </xs:complexType> 15.246 + 15.247 + <xs:group name="TargetDataGroup"> 15.248 + <xs:choice> 15.249 + <xs:element name="define" type="DefineType" minOccurs="0" maxOccurs="unbounded"/> 15.250 + <xs:element name="dependencies" type="DependenciesType" minOccurs="0" maxOccurs="unbounded"/> 15.251 + <xs:element name="make" type="MakeVarType" minOccurs="0" maxOccurs="unbounded"/> 15.252 + </xs:choice> 15.253 + </xs:group> 15.254 + 15.255 + <xs:complexType name="DefineType"> 15.256 + <xs:annotation> 15.257 + <xs:documentation> 15.258 + Specifies C/C++ pre-processor definitions that are supposed to 15.259 + be appended to the compiler flags, if supported. 15.260 + (Note: for example, Fortran also supports C/C++ style pre-processor definitions under 15.261 + certain circumstances) 15.262 + </xs:documentation> 15.263 + </xs:annotation> 15.264 + <xs:attribute name="name" type="xs:string" use="required"/> 15.265 + <xs:attribute name="value" type="xs:string"/> 15.266 + </xs:complexType> 15.267 + 15.268 + <xs:simpleType name="DependenciesType"> 15.269 + <xs:annotation> 15.270 + <xs:documentation>A comma-separated list of named dependencies.</xs:documentation> 15.271 + </xs:annotation> 15.272 + <xs:restriction base="xs:string"/> 15.273 + </xs:simpleType> 15.274 + 15.275 + <xs:simpleType name="MakeVarType"> 15.276 + <xs:annotation> 15.277 + <xs:documentation> 15.278 + The text contents in the body of this element are supposed to be appended literally 15.279 + to the config file without prior processing. 15.280 + </xs:documentation> 15.281 + </xs:annotation> 15.282 + <xs:restriction base="xs:string"/> 15.283 + </xs:simpleType> 15.284 +</xs:schema> 15.285 \ No newline at end of file
16.1 --- a/src/CMakeLists.txt Sun Sep 03 09:10:16 2023 +0200 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,51 +0,0 @@ 16.4 -set(sources 16.5 - utils.c 16.6 - allocator.c 16.7 - string.c 16.8 - list.c 16.9 - array_list.c 16.10 - linked_list.c 16.11 - buffer.c 16.12 - map.c 16.13 - hash_key.c 16.14 - hash_map.c 16.15 - mempool.c 16.16 - printf.c 16.17 - compare.c 16.18 -) 16.19 -set(headers 16.20 - cx/common.h 16.21 - cx/utils.h 16.22 - cx/string.h 16.23 - cx/allocator.h 16.24 - cx/iterator.h 16.25 - cx/collection.h 16.26 - cx/list.h 16.27 - cx/array_list.h 16.28 - cx/linked_list.h 16.29 - cx/buffer.h 16.30 - cx/map.h 16.31 - cx/hash_key.h 16.32 - cx/hash_map.h 16.33 - cx/mempool.h 16.34 - cx/printf.h 16.35 - cx/compare.h 16.36 - ) 16.37 - 16.38 -add_library(ucx SHARED ${sources}) 16.39 -add_library(ucx_static STATIC ${sources}) 16.40 - 16.41 -target_include_directories(ucx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 16.42 -target_include_directories(ucx_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 16.43 - 16.44 -set_target_properties(ucx PROPERTIES SOVERSION 4 VERSION 4.0.0) 16.45 -set_target_properties(ucx_static PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) 16.46 - 16.47 -# it is sufficient to specify the headers for one of the targets 16.48 -set_target_properties(ucx PROPERTIES PUBLIC_HEADER "${headers}") 16.49 - 16.50 -include(GNUInstallDirs) 16.51 -install(TARGETS ucx ucx_static 16.52 - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 16.53 - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 16.54 - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cx) 16.55 \ No newline at end of file
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/src/Makefile Thu Oct 12 00:00:35 2023 +0200 17.3 @@ -0,0 +1,107 @@ 17.4 +# Copyright 2023 Mike Becker. All rights reserved. 17.5 +# 17.6 +# Redistribution and use in source and binary forms, with or without 17.7 +# modification, are permitted provided that the following conditions are met: 17.8 +# 17.9 +# 1. Redistributions of source code must retain the above copyright 17.10 +# notice, this list of conditions and the following disclaimer. 17.11 +# 17.12 +# 2. Redistributions in binary form must reproduce the above copyright 17.13 +# notice, this list of conditions and the following disclaimer in the 17.14 +# documentation and/or other materials provided with the distribution. 17.15 +# 17.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 17.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 17.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 17.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17.26 + 17.27 +include ../config.mk 17.28 + 17.29 +SRC = allocator.c array_list.c buffer.c compare.c hash_key.c hash_map.c \ 17.30 + linked_list.c list.c map.c mempool.c printf.c string.c utils.c 17.31 + 17.32 +OBJ_EXT=.o 17.33 +OBJ=$(SRC:%.c=$(BUILD_DIR)/%$(OBJ_EXT)) 17.34 + 17.35 +static: $(BUILD_DIR)/libucx$(STLIB_EXT) 17.36 + 17.37 +shared: $(BUILD_DIR)/libucx$(SHLIB_EXT) 17.38 + 17.39 +$(BUILD_DIR)/libucx$(STLIB_EXT): $(OBJ) 17.40 + $(AR) $(ARFLAGS) $@ $^ 17.41 + 17.42 +$(BUILD_DIR)/libucx$(SHLIB_EXT): $(OBJ) 17.43 + $(CC) $(LDFLAGS) -o $@ $^ 17.44 + 17.45 +install: 17.46 + @echo "[ not supported yet ]" 17.47 + 17.48 + 17.49 +$(BUILD_DIR)/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h 17.50 + echo "Compiling $<" 17.51 + $(CC) -o $@ $(CFLAGS) -c $< 17.52 + 17.53 +$(BUILD_DIR)/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \ 17.54 + cx/common.h cx/collection.h cx/allocator.h cx/iterator.h 17.55 + echo "Compiling $<" 17.56 + $(CC) -o $@ $(CFLAGS) -c $< 17.57 + 17.58 +$(BUILD_DIR)/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h cx/allocator.h \ 17.59 + cx/utils.h 17.60 + echo "Compiling $<" 17.61 + $(CC) -o $@ $(CFLAGS) -c $< 17.62 + 17.63 +$(BUILD_DIR)/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h 17.64 + echo "Compiling $<" 17.65 + $(CC) -o $@ $(CFLAGS) -c $< 17.66 + 17.67 +$(BUILD_DIR)/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h 17.68 + echo "Compiling $<" 17.69 + $(CC) -o $@ $(CFLAGS) -c $< 17.70 + 17.71 +$(BUILD_DIR)/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h cx/common.h \ 17.72 + cx/collection.h cx/allocator.h cx/iterator.h cx/string.h cx/hash_key.h \ 17.73 + cx/utils.h 17.74 + echo "Compiling $<" 17.75 + $(CC) -o $@ $(CFLAGS) -c $< 17.76 + 17.77 +$(BUILD_DIR)/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h cx/common.h \ 17.78 + cx/list.h cx/collection.h cx/allocator.h cx/iterator.h cx/utils.h 17.79 + echo "Compiling $<" 17.80 + $(CC) -o $@ $(CFLAGS) -c $< 17.81 + 17.82 +$(BUILD_DIR)/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \ 17.83 + cx/allocator.h cx/iterator.h 17.84 + echo "Compiling $<" 17.85 + $(CC) -o $@ $(CFLAGS) -c $< 17.86 + 17.87 +$(BUILD_DIR)/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \ 17.88 + cx/allocator.h cx/iterator.h cx/string.h cx/hash_key.h 17.89 + echo "Compiling $<" 17.90 + $(CC) -o $@ $(CFLAGS) -c $< 17.91 + 17.92 +$(BUILD_DIR)/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h cx/allocator.h \ 17.93 + cx/utils.h 17.94 + echo "Compiling $<" 17.95 + $(CC) -o $@ $(CFLAGS) -c $< 17.96 + 17.97 +$(BUILD_DIR)/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h cx/string.h \ 17.98 + cx/allocator.h 17.99 + echo "Compiling $<" 17.100 + $(CC) -o $@ $(CFLAGS) -c $< 17.101 + 17.102 +$(BUILD_DIR)/string$(OBJ_EXT): string.c cx/string.h cx/common.h cx/allocator.h \ 17.103 + cx/utils.h 17.104 + echo "Compiling $<" 17.105 + $(CC) -o $@ $(CFLAGS) -c $< 17.106 + 17.107 +$(BUILD_DIR)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h 17.108 + echo "Compiling $<" 17.109 + $(CC) -o $@ $(CFLAGS) -c $< 17.110 +
18.1 --- a/tests/CMakeLists.txt Sun Sep 03 09:10:16 2023 +0200 18.2 +++ b/tests/CMakeLists.txt Thu Oct 12 00:00:35 2023 +0200 18.3 @@ -1,5 +1,10 @@ 18.4 -# Use C++ for Testing 18.5 +cmake_minimum_required(VERSION 3.14) 18.6 +project(ucxtest VERSION 3.0 DESCRIPTION "UAP Common Extensions - Tests") 18.7 + 18.8 +# Configuration 18.9 +cmake_policy(SET CMP0077 NEW) 18.10 set(CMAKE_CXX_STANDARD 17) 18.11 +enable_testing() 18.12 18.13 # Load Google Test Framework 18.14 option(INSTALL_GTEST "By default googletest shall not be installed." OFF) 18.15 @@ -31,5 +36,5 @@ 18.16 selftest.cpp 18.17 util_allocator.cpp 18.18 ) 18.19 -target_link_libraries(ucxtest PRIVATE ucx_static gtest_main) 18.20 +target_link_libraries(ucxtest ${CMAKE_BINARY_DIR}/../libucx${STLIB_EXT} gtest_main) 18.21 gtest_discover_tests(ucxtest)
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/tests/Makefile Thu Oct 12 00:00:35 2023 +0200 19.3 @@ -0,0 +1,35 @@ 19.4 +# Copyright 2023 Mike Becker. All rights reserved. 19.5 +# 19.6 +# Redistribution and use in source and binary forms, with or without 19.7 +# modification, are permitted provided that the following conditions are met: 19.8 +# 19.9 +# 1. Redistributions of source code must retain the above copyright 19.10 +# notice, this list of conditions and the following disclaimer. 19.11 +# 19.12 +# 2. Redistributions in binary form must reproduce the above copyright 19.13 +# notice, this list of conditions and the following disclaimer in the 19.14 +# documentation and/or other materials provided with the distribution. 19.15 +# 19.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 19.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 19.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19.26 + 19.27 +include ../config.mk 19.28 + 19.29 +TEST_DIR=$(BUILD_DIR)/tests 19.30 + 19.31 +all: $(TEST_DIR) $(BUILD_DIR)/libucx.a 19.32 + cd $(TEST_DIR) && $(CMAKE) -DSTLIB_EXT="$(STLIB_EXT)" "$(src_dir)/tests" && $(CMAKE) --build . 19.33 + @echo "[ Tests complete ]" 19.34 + 19.35 +# do not define libucx.a target - if it wasn't build, we simply fail! 19.36 + 19.37 +$(TEST_DIR): 19.38 + $(MKDIR) $@ 19.39 \ No newline at end of file