From 44388020aa696238daff956fd06d8470c3e9dcf2 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 11 Feb 2023 15:47:10 +0100 Subject: Added debian infrastructure --- Makefile | 23 +++++++++++++++++++ XMakefile | 7 ++++++ debian/README.Debian | 19 +++++++++++++++ debian/changelog | 5 ++++ debian/compat | 1 + debian/control | 14 +++++++++++ debian/copyright | 4 ++++ debian/rules | 4 ++++ debian/source/format | 1 + main.cpp | 7 ++++++ xmake.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ xmake.h | 4 ++++ 12 files changed, 154 insertions(+) create mode 100644 Makefile create mode 100644 XMakefile create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 main.cpp create mode 100644 xmake.cpp create mode 100644 xmake.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..92fc9a8 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +PROJECTNAME=xmake + +SRC=main.cpp xmake.cpp + +OBJ=$(SRC:.cpp=.o) + +all: $(PROJECTNAME) + +$(PROJECTNAME): $(OBJ) + $(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ + +install: + mkdir -p $(DESTDIR)/usr/bin + cp $(PROJECTNAME) $(DESTDIR)/usr/bin/ + +clean: + -rm -f *.o $(PROJECTNAME) + +.PHONY: clean install all + diff --git a/XMakefile b/XMakefile new file mode 100644 index 0000000..ac3a34e --- /dev/null +++ b/XMakefile @@ -0,0 +1,7 @@ + + + xmake + xmake.cpp + main.cpp + + diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..4da4a5b --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,19 @@ +xmake for Debian +================ + +This package is the Debian version of xmake. + +It is a build system with XML based config files. + + +Usage +----- + +Run "xmake" like "make" to build programs with an XMakefile. + + +Contact +------- + +Reichwein IT + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..d94dedf --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +xmake (1.0) unstable; urgency=medium + + * Initial release + + -- Roland Reichwein Sat, 05 Nov 2022 13:34:57 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..c27819e --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: xmake +Section: devel +Priority: optional +Maintainer: Roland Reichwein +Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, llvm | g++-9, lld | g++-9, pkg-config, libfmt-dev, googletest, gcovr, libreichwein-dev +Standards-Version: 4.5.0 +Homepage: http://www.reichwein.it/xmake/ + +Package: xmake +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Homepage: http://www.reichwein.it/xmake/ +Description: Buildsystem + XMake is a buildsystem with automatically resolved dependencies. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a50fc15 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,4 @@ +Author: Roland Reichwein , 2023 + +Both upstream source code and Debian packaging is available +under the conditions of CC0 1.0 Universal diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2d33f6a --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..964a3bb --- /dev/null +++ b/main.cpp @@ -0,0 +1,7 @@ +#include "xmake.h" + +int main(int argc, char* argv[]) +{ + return xmake(argc, argv); +} + diff --git a/xmake.cpp b/xmake.cpp new file mode 100644 index 0000000..9d953cc --- /dev/null +++ b/xmake.cpp @@ -0,0 +1,65 @@ +#include "xmake.h" + +#include +#include +#include +#include + +#include +#include +#include + +namespace fs = std::filesystem; +namespace bp = boost::process; +namespace pt = boost::property_tree; +using namespace std::string_literals; + +namespace { + const fs::path XMakefile{"XMakefile"}; + + void usage() + { + std::cout << "Usage: xmake " << std::endl; + } +} + +int xmake(int argc, char* argv[]) +{ + try { + pt::ptree ptree; + pt::read_xml(XMakefile, ptree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace); + + std::string action{"default"}; + + if (argc == 1) { // default action + } else if (argc == 2) { + action = argv[1]; + } else { + std::cerr << "Invalid arguments." << std::endl; + usage; + exit(1); + } + + if (action == "default"s || action == "build") { // build + } else if (action == "clean") { + } else if (action == "install") { + } else if (action == "rebuild") { + } else if (action == "run") { + } else { + std::cerr << "Invalid action: " << action << std::endl; + usage; + exit(1); + } + + // TODO: clearlist + // TODO: dependencies + // TODO: buildlist + + } catch (const std::exception& ex) { + std::cerr << "Error: " << ex.what() << std::endl; + return 1; + } + + return 0; +} + diff --git a/xmake.h b/xmake.h new file mode 100644 index 0000000..6c402cf --- /dev/null +++ b/xmake.h @@ -0,0 +1,4 @@ +#pragma once + +int xmake(int argc, char* argv[]); + -- cgit v1.2.3