~nabijaczleweli/klapki

9be7f909e3b0a78e3077b8aab610a1c87219118c — наб 1 year, 11 days ago 3347140
It builds
13 files changed, 342 insertions(+), 21 deletions(-)

M .build.yml -rwxr-xr-x => -rw-r--r--
A .clang-format
M .gitignore
A .gitmodules
A Makefile
M README.md
A configMakefile
A ext/fmt
M klapki.sublime-project
A src/config.cpp
A src/config.hpp
A src/main.cpp
A src/ops.hpp
M .build.yml => .build.yml +7 -20
@@ 1,20 1,7 @@
#image: debian/bullseye
#packages:
#  - ronn
#  - curl
#secrets:
#  - 8d4dfb87-e056-4f68-abae-0da7ba5d4398
#tasks:
#  - build: |
#      cd html-readme
#      awk '/BUILD_YML_PLACEHOLDER/ {print "_PRE"; while(getline < ".build.yml") print; print "__PRE"; next}  //' html-readme.md | \
#      ronn -f | \
#      sed -e 's;^__PRE$;</pre>;' -e 's;^_PRE$;<pre>;' > ~/README.html
#  - readme: |
#      set +x  # Avoid echoing the token
#      curl -H "Content-Type: text/html"                      \
#           -H "Authorization: Bearer $(cat ~/.readme-token)" \
#           -XPUT                                             \
#           --data-binary @README.html                        \
#           'https://git.sr.ht/api/repos/html-readme/readme' &&
#      echo "README set"
image: debian/bullseye
packages:
  - clang
tasks:
  - build: |
      cd klapki
      make

A .clang-format => .clang-format +23 -0
@@ 0,0 1,23 @@
---
Language                                       : Cpp
BasedOnStyle                                   : LLVM
AlignAfterOpenBracket                          : true
AlignEscapedNewlinesLeft                       : true
AlignConsecutiveAssignments                    : true
AllowShortFunctionsOnASingleLine               : Inline
AlwaysBreakTemplateDeclarations                : true
ColumnLimit                                    : 160
ConstructorInitializerIndentWidth              : 6
IndentCaseLabels                               : true
MaxEmptyLinesToKeep                            : 2
KeepEmptyLinesAtTheStartOfBlocks               : false
NamespaceIndentation                           : All
PointerAlignment                               : Middle
SpacesBeforeTrailingComments                   : 2
IndentWidth                                    : 2
TabWidth                                       : 2
UseTab                                         : ForIndentation
SpaceBeforeParens                              : Never
FixNamespaceComments                           : false
...


M .gitignore => .gitignore +2 -0
@@ 11,6 11,8 @@
!*.md
!src
!src/**
!ext
!ext/**
!tests
!tests/**
!test-data

A .gitmodules => .gitmodules +4 -0
@@ 0,0 1,4 @@
[submodule "ext/fmt"]
	path = ext/fmt
	url = https://github.com/fmtlib/fmt
	branch = 7.0.3

A Makefile => Makefile +102 -0
@@ 0,0 1,102 @@
# The MIT License (MIT)

# Copyright (c) 2020 nabijaczleweli

# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


include configMakefile


LDDLLS := fmt
LDAR := $(LNCXXAR) $(foreach l,fmt,-L$(BLDDIR)$(l)) $(foreach dll,$(LDDLLS),-l$(dll))
INCAR := $(foreach l,$(foreach l,fmt,$(l)/include) jsonpp,-isystemext/$(l)) $(foreach l,,-isystem$(BLDDIR)$(l)/include)
VERAR := $(foreach l,BARBERSANDREBARBS CEREAL CIMPOLER_META CPP_LOCALISER CPR FMT JSONPP SEED11 SEMVER WHEREAMI_CPP,-D$(l)_VERSION='$($(l)_VERSION)')
SOURCES := $(sort $(wildcard src/*.cpp src/**/*.cpp src/**/**/*.cpp src/**/**/**/*.cpp))
HEADERS := $(sort $(wildcard src/*.hpp src/**/*.hpp src/**/**/*.hpp src/**/**/**/*.hpp))


.PHONY : all clean exe audiere cpp-localiser cpr fmt seed11 semver zstd whereami-cpp


all : fmt exe

clean :
	rm -rf $(OUTDIR)

exe : audiere cpp-localiser cpr seed11 fmt seed11 semver whereami-cpp zstd $(OUTDIR)klapki$(EXE)
fmt : $(BLDDIR)fmt/libfmt$(ARCH)


$(OUTDIR)klapki$(EXE) : $(subst $(SRCDIR),$(OBJDIR),$(subst .cpp,$(OBJ),$(SOURCES)))
	$(CXX) $(CXXAR) -o$@ $^ $(PIC) $(LDAR)

$(BLDDIR)audiere/lib/libaudiere$(DLL) : ext/audiere/CMakeLists.txt
	@mkdir -p $(abspath $(dir $@)../build)
	# FLAC doesn't seem to work on Travis by default so v0v
	cd $(abspath $(dir $@)../build) && $(INCCMAKEAR) $(LNCMAKEAR) $(CMAKE) -DUSE_FLAC=OFF -DCMAKE_INSTALL_PREFIX:PATH="$(abspath $(dir $@)..)" $(abspath $(dir $^)) -GNinja
	cd $(abspath $(dir $@)../build) && $(NINJA) install
	$(if $(OS) | grep Windows_NT,cp $@ $(OUTDIR))

$(BLDDIR)cpp-localiser/libcpp-localiser$(ARCH) : ext/cpp-localiser/Makefile
	$(MAKE) -C$(dir $^) BUILD=$(abspath $(dir $@)) stlib

$(BLDDIR)seed11/libseed11$(ARCH) : $(foreach src,seed11_system_agnostic seed11_$(SEED11_SYSTEM_TYPE) deterministic_unsafe_seed_device,$(BLDDIR)seed11/obj/$(src)$(OBJ))
	$(AR) crs $@ $^

$(BLDDIR)fmt/libfmt$(ARCH) : $(patsubst ext/fmt/src/%.cc,$(BLDDIR)fmt/obj/%$(OBJ),$(wildcard ext/fmt/src/*.cc))
	$(AR) crs $@ $^

$(BLDDIR)semver/libsemver$(ARCH) : $(patsubst ext/semver/src/%.cpp,$(BLDDIR)semver/obj/%$(OBJ),$(wildcard ext/semver/src/*.cpp))
	$(AR) crs $@ $^

$(BLDDIR)semver/include/semver/semver200.h : $(wildcard ext/semver/include/*.h ext/semver/include/*.inl)
	@mkdir -p $(dir $@)
	cp $^ $(dir $@)

$(BLDDIR)whereami-cpp/libwhereami++$(ARCH) : ext/whereami-cpp/Makefile
	$(MAKE) -C$(dir $^) BUILD=$(abspath $(dir $@)) stlib

$(BLDDIR)zstd/libzstd$(ARCH) : $(subst ext/zstd/lib,$(BLDDIR)zstd/obj,$(subst .c,$(OBJ),$(wildcard ext/zstd/lib/common/*.c ext/zstd/lib/compress/*.c ext/zstd/lib/decompress/*.c)))
	@mkdir -p $(dir $@)
	$(AR) crs $@ $^

$(BLDDIR)zstd/include/zstd/zstd.h : $(wildcard ext/zstd/lib/*.h ext/zstd/lib/common/*.h ext/zstd/lib/compress/*.h ext/zstd/lib/decompress/*.h)
	@mkdir -p $(foreach incfile,$(subst ext/zstd/lib,$(BLDDIR)zstd/include/zstd,$^),$(abspath $(dir $(incfile))))
	$(foreach incfile,$^,cp $(incfile) $(subst ext/zstd/lib,$(BLDDIR)zstd/include/zstd,$(incfile));)


$(OBJDIR)%$(OBJ) : $(SRCDIR)%.cpp
	@mkdir -p $(dir $@)
	$(CXX) $(CXXAR) $(INCAR) $(VERAR) -c -o$@ $^

$(BLDDIR)fmt/obj/%$(OBJ) : ext/fmt/src/%.cc
	@mkdir -p $(dir $@)
	$(CXX) $(CXXAR) -Iext/fmt/include -c -o$@ $^

#$(BLDDIR)semver/obj/%$(OBJ) : ext/semver/src/%.cpp
#	@mkdir -p $(dir $@)
#	$(CXX) $(CXXAR) -Iext/semver/include -c -o$@ $^
#
#$(BLDDIR)seed11/obj/%$(OBJ) : ext/seed11/src/%.cpp
#	@mkdir -p $(dir $@)
#	$(CXX) $(CXXAR) -isystemext/seed11/include -c -o$@ $^
#
#$(BLDDIR)zstd/obj/%$(OBJ) : ext/zstd/lib/%.c
#	@mkdir -p $(dir $@)
#	$(CC) $(CCAR) -Iext/zstd/lib -Iext/zstd/lib/common -c -o$@ $^

M README.md => README.md +9 -1
@@ 34,9 34,17 @@ will work on x86_64 and i686.

See the [repository README](//debian.nabijaczleweli.xyz/README) for more information.

## Reporting bugs

There's [the tracker](//todo.sr.ht/~nabijaczleweli/klapki), but also see the list below.

## Contributing

Send a patch inline, as an attachment, or a git link and a ref to pull to [the list](//lists.sr.ht/~nabijaczleweli/klapki). I'm not picky.
Send a patch inline, as an attachment, or a git link and a ref to pull from to [the list](//lists.sr.ht/~nabijaczleweli/klapki) or [me](mailto:nabijaczleweli@nabijaczleweli.xyz) directly. I'm not picky, just include the repo name in the subject prefix.

## Discussing

Please use the tracker or the list.

## Special thanks


A configMakefile => configMakefile +54 -0
@@ 0,0 1,54 @@
# The MIT License (MIT)

# Copyright (c) 2020 nabijaczleweli

# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


EXE :=
DLL := .so
PIC := -fPIC
OS_LD_LIBS :=

ifneq "$(ADDITIONAL_INCLUDE_DIR)" ""
	INCCXXAR := -isystem$(ADDITIONAL_INCLUDE_DIR)
else
	INCCXXAR :=
endif

ifneq "$(ADDITIONAL_LINK_DIR)" ""
	LNCXXAR := -L$(ADDITIONAL_LINK_DIR)
else
	LNCXXAR :=
endif

INCCMAKEAR := CXXFLAGS="$(INCCXXAR)"
LNCMAKEAR := LDFLAGS="$(LNCXXAR)"

OBJ := .o
ARCH := .a
AR := ar
CXXAR := -O3 -fomit-frame-pointer -std=c++17 -pedantic -Wall -Wextra -pipe -pthread $(INCCXXAR) $(PIC)
CCAR := -O3 -fomit-frame-pointer -std=c11 -pipe $(PIC)
STRIP := strip
STRIPAR := --strip-all --remove-section=.comment --remove-section=.note

OUTDIR := out/
BLDDIR := out/build/
OBJDIR := $(BLDDIR)obj/
SRCDIR := src/

A ext/fmt => ext/fmt +1 -0
@@ 0,0 1,1 @@
Subproject commit cd4af11efc9c622896a3e4cb599fa28668ca3d05

M klapki.sublime-project => klapki.sublime-project +5 -0
@@ 37,6 37,11 @@
		},
		{
			"follow_symlinks": true,
			"name": "External code",
			"path": "ext"
		},
		{
			"follow_symlinks": true,
			"name": "Build scripts",
			"path": ".",
			"file_include_patterns": [".build.yml", "*Makefile"],

A src/config.cpp => src/config.cpp +30 -0
@@ 0,0 1,30 @@
// The MIT License (MIT)

// Copyright (c) 2020 nabijaczleweli

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


#include "config.hpp"
#include "fmt/format.h"


klapki::config klapki::read_config(const char ** argv) {
	fmt::print("henlo {}\n", argv[0]);
	return {argv[0], {{}, {}}};
}

A src/config.hpp => src/config.hpp +37 -0
@@ 0,0 1,37 @@
// The MIT License (MIT)

// Copyright (c) 2020 nabijaczleweli

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


#include "ops.hpp"
#include <variant>
#include <vector>
#include <string>


namespace klapki {
	struct config {
		std::string host;

		std::vector<ops::op> ops;
	};

	config read_config(const char ** argv);
}

A src/main.cpp => src/main.cpp +37 -0
@@ 0,0 1,37 @@
// The MIT License (MIT)

// Copyright (c) 2020 nabijaczleweli

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


#include "config.hpp"
#include "fmt/format.h"


namespace klapki {
	static int main(const char ** argv) {
		const auto cfg = read_config(argv);
		fmt::print("yes: {}\n", cfg.ops.size());
		return 0;
	}
}

int main(int, const char ** argv) {
	return klapki::main(argv);
}

A src/ops.hpp => src/ops.hpp +31 -0
@@ 0,0 1,31 @@
// The MIT License (MIT)

// Copyright (c) 2020 nabijaczleweli

// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


#include <variant>
#include <vector>


namespace klapki::ops {
	struct version {};

	using op = std::variant<ops::version>;
}