commit 9a4d40a79d0fa7b8d56b7a0a6f2791297b962b08 Author: tastytea Date: Wed Apr 17 00:17:26 2019 +0200 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d186017 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required (VERSION 3.2) +project(gitea2rss + VERSION 0.0.0 + LANGUAGES CXX +) + +include(GNUInstallDirs) +find_package(PkgConfig REQUIRED) +pkg_check_modules(JSONCPP REQUIRED jsoncpp) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic -ftrapv \ +-fsanitize=undefined -g -Og -fno-omit-frame-pointer") + +include_directories(${PROJECT_BINARY_DIR}) + +include_directories(${JSONCPP_INCLUDE_DIRS}) +link_directories(${JSONCPP_LIBRARY_DIRS}) + +# Write version in header +configure_file( + "${PROJECT_SOURCE_DIR}/src/version.hpp.in" + "${PROJECT_BINARY_DIR}/version.hpp" +) + +file(GLOB sources src/*.cpp) +add_executable(${PROJECT_NAME} "${sources}") +target_link_libraries(${PROJECT_NAME} ${JSONCPP_LIBRARIES}) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) + +set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"") +if (WITH_MAN) + add_custom_command( + OUTPUT "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" + DEPENDS "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.1.adoc" + COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh + ARGS ${PROJECT_VERSION}) + add_custom_target(run ALL DEPENDS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.1") + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +endif() diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..31476d8 --- /dev/null +++ b/README.adoc @@ -0,0 +1,3 @@ += gitea2rss + +*gitea2rss* turns https://gitea.io[Gitea] releases into RSS feeds. diff --git a/build_manpage.sh b/build_manpage.sh new file mode 100755 index 0000000..72b8ce4 --- /dev/null +++ b/build_manpage.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +name="gitea2rss" + +if [ -n "${1}" ]; then + dir="$(dirname ${0})" + version=${1} + cp -vf "${dir}/${name}.1.adoc" . + sed -Ei "s/(Revision: +)[0-9]+\.[0-9]\.[0-9]/\1${version}/" "${name}.1.adoc" + a2x --doctype manpage --format manpage --no-xmllint "${name}.1.adoc" +else + echo "usage: ${0} VERSION" >&2 +fi diff --git a/gitea2rss.1.adoc b/gitea2rss.1.adoc new file mode 100644 index 0000000..c7634da --- /dev/null +++ b/gitea2rss.1.adoc @@ -0,0 +1,27 @@ += gitea2rss(1) +:doctype: manpage +:Author: tastytea +:Email: tastytea@tastytea.de +:Date: 2019-04-17 +:Revision: 0.0.0 +:man source: gitea2rss +:man version: {revision} +:man manual: General Commands Manual + +== NAME + +gitea2rss - Turns Gitea releases into RSS feeds. + +== SYNOPSIS + +*gitea2rss* _URL of Gitea project_ + +== EXAMPLES + +gitea2rss https://example.com/user/repo + +== REPORTING BUGS + +Bugtracker: https://schlomp.space/tastytea/gitea2rss/issues + +E-mail: tastytea@tastytea.de diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c7b4077 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,31 @@ +/* This file is part of gitea2rss. + * Copyright © 2019 tastytea + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +using std::cout; +using std::cerr; +using std::endl; + +int main(int argc, char *argv[]) +{ + if (argc < 2) + { + cerr << "usage: " << argv[0] << " URL of Gitea project\n"; + return 1; + } + return 0; +} diff --git a/src/version.hpp.in b/src/version.hpp.in new file mode 100644 index 0000000..cec7915 --- /dev/null +++ b/src/version.hpp.in @@ -0,0 +1,9 @@ +#ifndef VERSION_HPP +#define VERSION_HPP + +namespace global +{ + static constexpr char version[] = "@PROJECT_VERSION@"; +} + +#endif // VERSION_HPP