From ecfc610acff6a9359ae5e7f0b225c5b26b189591 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 20 Sep 2021 21:07:54 +0200 Subject: Use 2-clause BSD-license for all source files. --- LICENSE | 29 ++++ ctor.cc | 3 + examples/ctor.cc | 159 ++++++++++++++++++ examples/subdir/cppbuild.cc | 75 --------- examples/subdir/ctor.cc | 78 +++++++++ src/build.cc | 3 + src/build.h | 2 + src/configure.cc | 3 + src/configure.cc.bak | 387 ++++++++++++++++++++++++++++++++++++++++++++ src/configure.h | 2 + src/execute.cc | 3 + src/execute.h | 2 + src/libctor.cc | 3 + src/libctor.h | 2 + src/rebuild.cc | 3 + src/rebuild.h | 2 + src/settings.h | 2 + src/task.cc | 3 + src/task.h | 2 + src/task_ar.cc | 3 + src/task_ar.h | 2 + src/task_cc.cc | 3 + src/task_cc.h | 2 + src/task_ld.cc | 3 + src/task_ld.h | 2 + src/task_so.cc | 3 + src/task_so.h | 2 + src/tasks.cc | 3 + src/tasks.h | 2 + src/unittest.cc | 3 + src/unittest.h | 3 + test/ctor.cc | 3 + 32 files changed, 722 insertions(+), 75 deletions(-) create mode 100644 LICENSE create mode 100644 examples/ctor.cc delete mode 100644 examples/subdir/cppbuild.cc create mode 100644 examples/subdir/ctor.cc create mode 100644 src/configure.cc.bak diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..455b71e --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +The copyright in this software is being made available under the 2-clauses +BSD License, included below. This software may be subject to other third +party and contributor rights, including patent rights, and no such rights +are granted under this license. + +Copyright (c) 2021, Bent Bisballe Nyeng (deva@aasimon.org) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/ctor.cc b/ctor.cc index 2e63f77..a7c52bf 100644 --- a/ctor.cc +++ b/ctor.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "libctor.h" namespace diff --git a/examples/ctor.cc b/examples/ctor.cc new file mode 100644 index 0000000..1a02e90 --- /dev/null +++ b/examples/ctor.cc @@ -0,0 +1,159 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. +#include "libctor.h" + +namespace +{ +BuildConfigurations myConfigs() +{ + return + { + { + .type = TargetType::Executable, + .target = "plugingui", + .sources = { + "drumgizmo/zita-resampler/libs/cresampler.cc", + "drumgizmo/zita-resampler/libs/resampler-table.cc", + "drumgizmo/zita-resampler/libs/resampler.cc", + "drumgizmo/zita-resampler/libs/vresampler.cc", + "drumgizmo/hugin/hugin.c", + "drumgizmo/pugixml/src/pugixml.cpp", + }, + .depends = { + "libplugingui.so", + }, + .cxxflags = { + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-Idrumgizmo/getoptpp", + "-Idrumgizmo/", + "-Idrumgizmo/hugin", + "-Idrumgizmo/plugingui/", + "-Idrumgizmo/src/", + "-Idrumgizmo/zita-resampler/libs", + "-Idrumgizmo/pugixml/src", + }, + .cflags = { + "-g", + //"-O3", + "-Wall", + "-Werror", + }, + .ldflags = { + "-lm", + "-lX11", + "-lXext", + "-lsndfile", + "-pthread", + } + }, + }; +} + +BuildConfigurations myConfigs2() +{ + return + { + { + .type = TargetType::DynamicLibrary, + .target = "libplugingui.so", + .sources = { + "drumgizmo/plugingui/abouttab.cc", + "drumgizmo/plugingui/bleedcontrolframecontent.cc", + "drumgizmo/plugingui/button.cc", + "drumgizmo/plugingui/button_base.cc", + "drumgizmo/plugingui/checkbox.cc", + "drumgizmo/plugingui/colour.cc", + "drumgizmo/plugingui/combobox.cc", + "drumgizmo/plugingui/dialog.cc", + "drumgizmo/plugingui/diskstreamingframecontent.cc", + "drumgizmo/plugingui/drumkitframecontent.cc", + "drumgizmo/plugingui/drumkittab.cc", + "drumgizmo/plugingui/eventhandler.cc", + "drumgizmo/plugingui/filebrowser.cc", + "drumgizmo/plugingui/font.cc", + "drumgizmo/plugingui/frame.cc", + "drumgizmo/plugingui/helpbutton.cc", + "drumgizmo/plugingui/humaniservisualiser.cc", + "drumgizmo/plugingui/humanizerframecontent.cc", + "drumgizmo/plugingui/image.cc", + "drumgizmo/plugingui/imagecache.cc", + "drumgizmo/plugingui/knob.cc", + "drumgizmo/plugingui/label.cc", + "drumgizmo/plugingui/layout.cc", + "drumgizmo/plugingui/led.cc", + "drumgizmo/plugingui/lineedit.cc", + "drumgizmo/plugingui/listbox.cc", + "drumgizmo/plugingui/listboxbasic.cc", + "drumgizmo/plugingui/listboxthin.cc", + "drumgizmo/plugingui/maintab.cc", + "drumgizmo/plugingui/mainwindow.cc", + "drumgizmo/plugingui/nativewindow_x11.cc", + "drumgizmo/plugingui/painter.cc", + "drumgizmo/plugingui/pixelbuffer.cc", + "drumgizmo/plugingui/pluginconfig.cc", + "drumgizmo/plugingui/powerbutton.cc", + "drumgizmo/plugingui/powerwidget.cc", + "drumgizmo/plugingui/progressbar.cc", + "drumgizmo/plugingui/resamplingframecontent.cc", + "drumgizmo/plugingui/resource.cc", + "drumgizmo/plugingui/resource_data.cc", + "drumgizmo/plugingui/sampleselectionframecontent.cc", + "drumgizmo/plugingui/scrollbar.cc", + "drumgizmo/plugingui/slider.cc", + "drumgizmo/plugingui/stackedwidget.cc", + "drumgizmo/plugingui/statusframecontent.cc", + "drumgizmo/plugingui/tabbutton.cc", + "drumgizmo/plugingui/tabwidget.cc", + "drumgizmo/plugingui/testmain.cc", + "drumgizmo/plugingui/textedit.cc", + "drumgizmo/plugingui/texture.cc", + "drumgizmo/plugingui/texturedbox.cc", + "drumgizmo/plugingui/timingframecontent.cc", + "drumgizmo/plugingui/toggle.cc", + "drumgizmo/plugingui/tooltip.cc", + "drumgizmo/plugingui/uitranslation.cc", + "drumgizmo/plugingui/utf8.cc", + "drumgizmo/plugingui/verticalline.cc", + "drumgizmo/plugingui/visualizerframecontent.cc", + "drumgizmo/plugingui/voicelimitframecontent.cc", + "drumgizmo/plugingui/widget.cc", + "drumgizmo/plugingui/window.cc", + "drumgizmo/plugingui/lodepng/lodepng.cpp", + }, + .depends = { + "src.a", + }, + .cxxflags = { + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-Idrumgizmo/getoptpp", + "-Idrumgizmo/", + "-Idrumgizmo/hugin", + "-Idrumgizmo/plugingui/", + "-Idrumgizmo/src/", + "-Idrumgizmo/zita-resampler/libs", + "-Idrumgizmo/pugixml/src", + }, + .cflags = {}, + .ldflags = {} + } + }; +} + +//int a = reg(__FILE__, myConfigs); +//int b = reg(__FILE__, myConfigs2); +} + +// Convenience macro +REG(myConfigs); +REG(myConfigs2); diff --git a/examples/subdir/cppbuild.cc b/examples/subdir/cppbuild.cc deleted file mode 100644 index 5e5af02..0000000 --- a/examples/subdir/cppbuild.cc +++ /dev/null @@ -1,75 +0,0 @@ -#include "../libctor.h" - -namespace -{ -BuildConfigurations myConfigs() -{ - return - { - { - .target = "src.a", - .sources = { - "../drumgizmo/src/audiocache.cc", - "../drumgizmo/src/audiocacheeventhandler.cc", - "../drumgizmo/src/audiocachefile.cc", - "../drumgizmo/src/audiocacheidmanager.cc", - "../drumgizmo/src/audiofile.cc", - "../drumgizmo/src/audioinputengine.cc", - "../drumgizmo/src/audioinputenginemidi.cc", - "../drumgizmo/src/audiooutputengine.cc", - "../drumgizmo/src/bytesizeparser.cc", - "../drumgizmo/src/channel.cc", - "../drumgizmo/src/channelmixer.cc", - "../drumgizmo/src/configfile.cc", - "../drumgizmo/src/configparser.cc", - "../drumgizmo/src/dgxmlparser.cc", - "../drumgizmo/src/directory.cc", - "../drumgizmo/src/domloader.cc", - "../drumgizmo/src/drumgizmo.cc", - "../drumgizmo/src/drumgizmoconf.cc", - "../drumgizmo/src/drumkit.cc", - "../drumgizmo/src/drumkitloader.cc", - "../drumgizmo/src/events.cc", - "../drumgizmo/src/events_ds.cc", - "../drumgizmo/src/inputprocessor.cc", - "../drumgizmo/src/instrument.cc", - "../drumgizmo/src/latencyfilter.cc", - "../drumgizmo/src/midimapparser.cc", - "../drumgizmo/src/midimapper.cc", - "../drumgizmo/src/path.cc", - "../drumgizmo/src/powerlist.cc", - "../drumgizmo/src/powermap.cc", - "../drumgizmo/src/powermapfilter.cc", - "../drumgizmo/src/random.cc", - "../drumgizmo/src/sample.cc", - "../drumgizmo/src/sample_selection.cc", - "../drumgizmo/src/sem.cc", - "../drumgizmo/src/staminafilter.cc", - "../drumgizmo/src/thread.cc", - "../drumgizmo/src/translation.cc", - "../drumgizmo/src/velocityfilter.cc", - "../drumgizmo/src/versionstr.cc", - "../drumgizmo/src/zrwrapper.cc", - }, - .cxxflags = { - "-fPIC", - "-DUI_X11", - "-O3", - "-g", - "-Wall", - "-Werror", - "-std=c++11", - "-I../drumgizmo/getoptpp", - "-I../drumgizmo/", - "-I../drumgizmo/hugin", - "-I../drumgizmo/plugingui/", - "-I ../drumgizmo/src/", - "-I ../drumgizmo/zita-resampler/libs", - "-I ../drumgizmo/pugixml/src", - }, - } - }; -} - -int a = reg(__FILE__, myConfigs); -} diff --git a/examples/subdir/ctor.cc b/examples/subdir/ctor.cc new file mode 100644 index 0000000..b5f5885 --- /dev/null +++ b/examples/subdir/ctor.cc @@ -0,0 +1,78 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. +#include "../libctor.h" + +namespace +{ +BuildConfigurations myConfigs() +{ + return + { + { + .target = "src.a", + .sources = { + "../drumgizmo/src/audiocache.cc", + "../drumgizmo/src/audiocacheeventhandler.cc", + "../drumgizmo/src/audiocachefile.cc", + "../drumgizmo/src/audiocacheidmanager.cc", + "../drumgizmo/src/audiofile.cc", + "../drumgizmo/src/audioinputengine.cc", + "../drumgizmo/src/audioinputenginemidi.cc", + "../drumgizmo/src/audiooutputengine.cc", + "../drumgizmo/src/bytesizeparser.cc", + "../drumgizmo/src/channel.cc", + "../drumgizmo/src/channelmixer.cc", + "../drumgizmo/src/configfile.cc", + "../drumgizmo/src/configparser.cc", + "../drumgizmo/src/dgxmlparser.cc", + "../drumgizmo/src/directory.cc", + "../drumgizmo/src/domloader.cc", + "../drumgizmo/src/drumgizmo.cc", + "../drumgizmo/src/drumgizmoconf.cc", + "../drumgizmo/src/drumkit.cc", + "../drumgizmo/src/drumkitloader.cc", + "../drumgizmo/src/events.cc", + "../drumgizmo/src/events_ds.cc", + "../drumgizmo/src/inputprocessor.cc", + "../drumgizmo/src/instrument.cc", + "../drumgizmo/src/latencyfilter.cc", + "../drumgizmo/src/midimapparser.cc", + "../drumgizmo/src/midimapper.cc", + "../drumgizmo/src/path.cc", + "../drumgizmo/src/powerlist.cc", + "../drumgizmo/src/powermap.cc", + "../drumgizmo/src/powermapfilter.cc", + "../drumgizmo/src/random.cc", + "../drumgizmo/src/sample.cc", + "../drumgizmo/src/sample_selection.cc", + "../drumgizmo/src/sem.cc", + "../drumgizmo/src/staminafilter.cc", + "../drumgizmo/src/thread.cc", + "../drumgizmo/src/translation.cc", + "../drumgizmo/src/velocityfilter.cc", + "../drumgizmo/src/versionstr.cc", + "../drumgizmo/src/zrwrapper.cc", + }, + .cxxflags = { + "-fPIC", + "-DUI_X11", + "-O3", + "-g", + "-Wall", + "-Werror", + "-std=c++11", + "-I../drumgizmo/getoptpp", + "-I../drumgizmo/", + "-I../drumgizmo/hugin", + "-I../drumgizmo/plugingui/", + "-I ../drumgizmo/src/", + "-I ../drumgizmo/zita-resampler/libs", + "-I ../drumgizmo/pugixml/src", + }, + } + }; +} + +int a = reg(__FILE__, myConfigs); +} diff --git a/src/build.cc b/src/build.cc index 4cec3b9..1b70c5b 100644 --- a/src/build.cc +++ b/src/build.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "build.h" #include diff --git a/src/build.h b/src/build.h index 0c4c3fd..1db3f5c 100644 --- a/src/build.h +++ b/src/build.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/configure.cc b/src/configure.cc index 1598251..b3517dc 100644 --- a/src/configure.cc +++ b/src/configure.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "configure.h" #include diff --git a/src/configure.cc.bak b/src/configure.cc.bak new file mode 100644 index 0000000..bcbeea9 --- /dev/null +++ b/src/configure.cc.bak @@ -0,0 +1,387 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. +#include "configure.h" + +#include +#include +#include + +#include + +#include "settings.h" +#include "execute.h" +#include "libcppbuild.h" +#include "tasks.h" + +std::filesystem::path configurationFile("configuration.cc"); +std::filesystem::path configHeaderFile("config.h"); + +const std::map default_configuration{}; +const std::map& __attribute__((weak)) configuration() +{ + return default_configuration; +} + +bool hasConfiguration(const std::string& key) +{ + const auto& c = configuration(); + return c.find(key) != c.end(); +} + +const std::string& getConfiguration(const std::string& key, + const std::string& defaultValue) +{ + const auto& c = configuration(); + if(hasConfiguration(key)) + { + return c.at(key); + } + + return defaultValue; +} + + +/* +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print `checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for `--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or `..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [/usr/local] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, `make install' will install all the files in +`/usr/local/bin', `/usr/local/lib' etc. You can specify +an installation prefix other than `/usr/local' using `--prefix', +for instance `--prefix=$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/drumgizmo] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files + --enable-gui=backend Use specified gui backend. Can be x11, win32, cocoa, + pugl-x11, pugl-win32, pugl-cocoa or auto + [default=auto] + --enable-custom-channel-count=count + Compile with specified number of output channels + [default=16] + --enable-lv2 Compile the LV2 plugin [default=no] + --enable-vst Compile the VST plugin [default=no] + --enable-cli Compile the command line interface [default=yes] + --disable-input-dummy Disable input dummy plugin [default=enabled] + --disable-input-test Disable input test plugin [default=enabled] + --disable-input-jackmidi + Disable input jackmidi plugin [default=enabled] + --disable-input-alsamidi + Disable input alsamidi plugin [default=enabled] + --disable-input-midifile + Disable input midifile plugin [default=enabled] + --disable-input-oss Disable input oss plugin [enabled by default on + FreeBSD, disabled otherwise] + --disable-output-dummy Disable output dummy plugin [default=enabled] + --disable-output-jackaudio + Disable output jack plugin [default=enabled] + --disable-output-alsa Disable output alsa plugin [default=enabled] + --disable-output-wavfile + Disable output wavfile plugin [default=enabled] + --disable-output-oss Disable output oss plugin [enabled by default on + FreeBSD, disabled otherwise] + --enable-sse=level Enable SSE Level 1, 2, 3 or auto [default=auto] + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-debug Build with debug support + --with-nls Build with nls support (default nls enabled) + --with-test Build unit tests + --with-lv2dir=DIR Use DIR as the lv2 plugin directory + [default=LIBDIR/lv2] + --with-vst-sources Point this to the vstsdk24 directory + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + OBJC Objective C compiler command + OBJCFLAGS Objective C compiler flags + OBJCXX Objective C++ compiler command + OBJCXXFLAGS Objective C++ compiler flags + CC C compiler command + CFLAGS C compiler flags + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + CPP C preprocessor + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + X11_CFLAGS C compiler flags for X11, overriding pkg-config + X11_LIBS linker flags for X11, overriding pkg-config + XEXT_CFLAGS C compiler flags for XEXT, overriding pkg-config + XEXT_LIBS linker flags for XEXT, overriding pkg-config + LV2_CFLAGS C compiler flags for LV2, overriding pkg-config + LV2_LIBS linker flags for LV2, overriding pkg-config + SMF_CFLAGS C compiler flags for SMF, overriding pkg-config + SMF_LIBS linker flags for SMF, overriding pkg-config + SNDFILE_CFLAGS + C compiler flags for SNDFILE, overriding pkg-config + SNDFILE_LIBS + linker flags for SNDFILE, overriding pkg-config + JACK_CFLAGS C compiler flags for JACK, overriding pkg-config + JACK_LIBS linker flags for JACK, overriding pkg-config + ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config + ALSA_LIBS linker flags for ALSA, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +*/ +int configure(int argc, char* argv[]) +{ + Settings settings; + + settings.builddir = "build"; + + std::string cmd_str; + for(int i = 0; i < argc; ++i) + { + if(i > 0) + { + cmd_str += " "; + } + cmd_str += argv[i]; + } + + dg::Options opt; + int key{256}; + + std::string build_arch; + std::string build_path; + std::string host_arch; + std::string host_path; + + opt.add("build-dir", required_argument, 'b', + "Set output directory for build files (default: '" + + settings.builddir + "').", + [&]() { + settings.builddir = optarg; + return 0; + }); + + opt.add("verbose", no_argument, 'v', + "Be verbose. Add multiple times for more verbosity.", + [&]() { + settings.verbose++; + return 0; + }); + + opt.add("build", required_argument, key++, + "Configure for building on specified architecture.", + [&]() { + build_arch = optarg; + return 0; + }); + + opt.add("build-path", required_argument, key++, + "Set path to build tool-chain.", + [&]() { + build_path = optarg; + return 0; + }); + + opt.add("host", required_argument, key++, + "Cross-compile to build programs to run on specified architecture.", + [&]() { + host_arch = optarg; + return 0; + }); + + opt.add("host-path", required_argument, key++, + "Set path to cross-compile tool-chain.", + [&]() { + host_path = optarg; + return 0; + }); + + opt.add("help", no_argument, 'h', + "Print this help text.", + [&]() { + std::cout << "configure usage stuff\n"; + opt.help(); + exit(0); + return 0; + }); + + opt.process(argc, argv); + + if(host_arch.empty()) + { + host_arch = build_arch; + } + + auto tasks = getTasks(settings); + + bool needs_cpp{false}; + bool needs_c{false}; + bool needs_ar{false}; + bool needs_asm{false}; + for(const auto& task :tasks) + { + switch(task->sourceLanguage()) + { + case Language::Auto: + std::cerr << "TargetLanguage not deduced!\n"; + exit(1); + break; + case Language::C: + needs_cpp = false; + break; + case Language::Cpp: + needs_c = true; + break; + case Language::Asm: + needs_asm = true; + break; + } + } + + // CC=clang + // CXX=clang++ + + std::string path_env = std::getenv("PATH"); + std::cout << path_env << "\n"; + + std::vector paths; + + { + std::stringstream ss(path_env); + std::string path; + while (std::getline(ss, path, ':')) + { + paths.push_back(path); + } + } + for(const auto& path_str : paths) + { + std::filesystem::path path(path_str); + auto gcc = path / "gcc"; + if(std::filesystem::exists(gcc)) + { + std::cout << "Found file gcc in path: " << path << "\n"; + auto perms = std::filesystem::status(gcc).permissions(); + if((perms & std::filesystem::perms::owner_exec) != std::filesystem::perms::none) + { + std::cout << " - executable by owner\n"; + } + if((perms & std::filesystem::perms::group_exec) != std::filesystem::perms::none) + { + std::cout << " - executable by group\n"; + } + if((perms & std::filesystem::perms::others_exec) != std::filesystem::perms::none) + { + std::cout << " - executable by others\n"; + } + } + } + exit(0); + + { + std::ofstream istr(configurationFile); + istr << "#include \"libcppbuild.h\"\n\n"; + istr << "const std::map& configuration()\n"; + istr << "{\n"; + istr << " static std::map c =\n"; + istr << " {\n"; + istr << " { \"cmd\", \"" << cmd_str << "\" },\n"; + istr << " { \"" << cfg::builddir << "\", \"" << settings.builddir << "\" },\n"; + istr << " { \"" << cfg::target_cc << "\", \"/usr/bin/gcc\" },\n"; + istr << " { \"" << cfg::target_cpp << "\", \"/usr/bin/g++\" },\n"; + istr << " { \"" << cfg::target_ar << "\", \"/usr/bin/ar\" },\n"; + istr << " { \"" << cfg::target_ld << "\", \"/usr/bin/ld\" },\n"; + istr << " { \"" << cfg::host_cc << "\", \"/usr/bin/gcc\" },\n"; + istr << " { \"" << cfg::host_cpp << "\", \"/usr/bin/g++\" },\n"; + istr << " { \"" << cfg::host_ar << "\", \"/usr/bin/ar\" },\n"; + istr << " { \"" << cfg::host_ld << "\", \"/usr/bin/ld\" },\n"; + istr << " };\n"; + istr << " return c;\n"; + istr << "}\n"; + } + + { + std::ofstream istr(configHeaderFile); + istr << "#pragma once\n\n"; + istr << "#define HAS_FOO 1\n"; + istr << "//#define HAS_BAR 1\n"; + } + + return 0; +} diff --git a/src/configure.h b/src/configure.h index 95b6765..de1b7e0 100644 --- a/src/configure.h +++ b/src/configure.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/execute.cc b/src/execute.cc index 414ce70..610ccdd 100644 --- a/src/execute.cc +++ b/src/execute.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "execute.h" #include diff --git a/src/execute.h b/src/execute.h index f284230..c750a83 100644 --- a/src/execute.h +++ b/src/execute.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/libctor.cc b/src/libctor.cc index e166e51..4d0d6d9 100644 --- a/src/libctor.cc +++ b/src/libctor.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include #include #include diff --git a/src/libctor.h b/src/libctor.h index 4ad0e32..70c62a8 100644 --- a/src/libctor.h +++ b/src/libctor.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/rebuild.cc b/src/rebuild.cc index 5559349..353beb0 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "rebuild.h" #include diff --git a/src/rebuild.h b/src/rebuild.h index 1b29bbd..906d089 100644 --- a/src/rebuild.h +++ b/src/rebuild.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/settings.h b/src/settings.h index 6b8729f..d71717a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/task.cc b/src/task.cc index 4cdfa5e..1c6c233 100644 --- a/src/task.cc +++ b/src/task.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "task.h" #include diff --git a/src/task.h b/src/task.h index 4461612..78dc904 100644 --- a/src/task.h +++ b/src/task.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/task_ar.cc b/src/task_ar.cc index 51d609e..e920571 100644 --- a/src/task_ar.cc +++ b/src/task_ar.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "task_ar.h" #include diff --git a/src/task_ar.h b/src/task_ar.h index bfa21a2..abdc3ae 100644 --- a/src/task_ar.h +++ b/src/task_ar.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include "task.h" diff --git a/src/task_cc.cc b/src/task_cc.cc index 0f85bf6..8256c70 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "task_cc.h" #include diff --git a/src/task_cc.h b/src/task_cc.h index 0ce4947..10813a7 100644 --- a/src/task_cc.h +++ b/src/task_cc.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include "task.h" diff --git a/src/task_ld.cc b/src/task_ld.cc index 4eb64f4..1b5665e 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "task_ld.h" #include diff --git a/src/task_ld.h b/src/task_ld.h index f56f00d..730975a 100644 --- a/src/task_ld.h +++ b/src/task_ld.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include "task.h" diff --git a/src/task_so.cc b/src/task_so.cc index 519085a..5623bcf 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "task_so.h" #include diff --git a/src/task_so.h b/src/task_so.h index 864d108..1e65694 100644 --- a/src/task_so.h +++ b/src/task_so.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include "task.h" diff --git a/src/tasks.cc b/src/tasks.cc index 3113564..a52b0be 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "tasks.h" #include diff --git a/src/tasks.h b/src/tasks.h index c5b326e..54591a4 100644 --- a/src/tasks.h +++ b/src/tasks.h @@ -1,4 +1,6 @@ // -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/src/unittest.cc b/src/unittest.cc index d2d5167..ade2d0a 100644 --- a/src/unittest.cc +++ b/src/unittest.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include "unittest.h" #include diff --git a/src/unittest.h b/src/unittest.h index 144dbdb..7eef0e2 100644 --- a/src/unittest.h +++ b/src/unittest.h @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #pragma once #include diff --git a/test/ctor.cc b/test/ctor.cc index caa00ee..8080d61 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +// Distributed under the BSD 2-Clause License. +// See accompanying file LICENSE for details. #include namespace -- cgit v1.2.3