Added ebuild for 0.6.1, added possibility to generate DEB and RPM packages

This commit is contained in:
tastytea 2018-03-08 11:07:41 +01:00
parent 90c2941b5d
commit 9c15b4bc4a
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 127 additions and 11 deletions

View File

@ -36,7 +36,7 @@ set_target_properties(mastodon-cpp PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${mastodon-cpp_VERSION_MAJOR}
)
target_link_libraries(mastodon-cpp ssl crypto ${CURL_LIBRARIES} curlpp)
target_link_libraries(mastodon-cpp ${CURL_LIBRARIES} curlpp)
install(TARGETS mastodon-cpp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${PROJECT_SOURCE_DIR}/src/mastodon-cpp.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@ -47,7 +47,8 @@ if(WITH_DOC)
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/doc/html
DESTINATION ${CMAKE_INSTALL_DOCDIR}/mastodon-cpp-${PROJECT_VERSION})
install(FILES ${PROJECT_SOURCE_DIR}/src/examples/example.cpp
file(GLOB examples src/examples/example*.cpp)
install(FILES ${examples}
DESTINATION ${CMAKE_INSTALL_DOCDIR}/mastodon-cpp-${PROJECT_VERSION}/examples)
endif()
@ -78,3 +79,44 @@ if(WITH_TESTS)
add_test(${bin} ${bin})
endforeach()
endif()
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${mastodon-cpp_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${mastodon-cpp_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${mastodon-cpp_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${mastodon-cpp_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ wrapper for the Mastodon API")
set(CPACK_PACKAGE_CONTACT "tastytea <tastytea@tastytea.de>")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_FILE_NAME, "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME, "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES, "/\\\\.git/;/build/;/doc/;.\\\\.sublime-")
set(CPACK_GENERATOR "TGZ")
if (WITH_DEB)
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/tastytea/mastodon-cpp")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcurlpp0 (>= 0.8.1)")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
execute_process(COMMAND dpkg --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_PACKAGE_FILE_NAME
"lib${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-0_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
endif()
if (WITH_RPM)
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_PACKAGE_LICENSE "GPL-3")
set(CPACK_RPM_PACKAGE_URL "https://github.com/tastytea/mastodon-cpp")
set(CPACK_RPM_PACKAGE_REQUIRES "curlpp >= 0.8.1")
execute_process(COMMAND uname -m
OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_PACKAGE_FILE_NAME
"lib${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-0.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
endif()
include(CPack)

View File

@ -5,13 +5,15 @@ The library takes care of the network stuff. You submit a query and get the raw
## Dependencies
* Tested OS: GNU/Linux
* C++ compiler (tested: gcc 6.4, clang 5.0)
* [cmake](https://cmake.org/) (tested: 3.9.6)
* [libcurl](https://curl.haxx.se/) (tested: 7.58.0)
* [curlpp](http://www.curlpp.org/) (tested: 0.8.1)
* Optional, documentation: [doxygen](https://www.stack.nl/~dimitri/doxygen/) (tested: 1.8.13)
* Optional, examples: [boost](http://www.boost.org/) (tested: 1.63.0)
* Tested OS: GNU/Linux
* C++ compiler (tested: gcc 6.4, clang 5.0)
* [cmake](https://cmake.org/) (tested: 3.9.6)
* [libcurl](https://curl.haxx.se/) (tested: 7.58.0)
* [curlpp](http://www.curlpp.org/) (tested: 0.8.1)
* Optional
* Documentation: [doxygen](https://www.stack.nl/~dimitri/doxygen/) (tested: 1.8.13)
* Examples: [boost](http://www.boost.org/) (tested: 1.63.0)
* DEB package: [dpkg](https://packages.qa.debian.org/dpkg) (tested: 1.19.0.5)
## Get sourcecode
@ -36,9 +38,28 @@ cmake options:
* `-DWITH_EXAMPLES=ON` if you want to compile the examples
* `-DWITH_TESTS=ON` if you want to compile the tests
* `-DWITH_DOC=ON` if you want to compile the HTML reference
* `-DWITH_DEB=ON` if you want to be able to generate a deb-package
* `-DWITH_RPM=ON` if you want to be able to generate an rpm-package
You can run the tests with `ctest ..` inside the build directory.
Install with `make install`.
## Packages
### Gentoo
Put the ebuild in `packages/gentoo` into your [local overlay](https://wiki.gentoo.org/wiki/Custom_repository).
### DEB and RPM
Compile with `-DWITH_DEB=ON` or `-DWITH_RPM=ON`.
Run `make package` from the build directory to generate a DEB/RPM package.
RPM packages are untested and DEB packages are tested sporadically.
To use the DEB package on stretch, you will need libcurlpp0(https://packages.debian.org/de/libcurlpp0) from buster.
### Other
Run `make install` from the build directory to install.
# Usage
@ -90,7 +111,7 @@ If you use a debug build, you get more verbose error messages.
* [Mastodon API reference](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)
* [Mastodon streaming API reference](https://github.com/tootsuite/documentation/blob/master/Using-the-API/Streaming-API.md)
## Status of implementation
# Status of implementation
Feature complete as of Mastodon 2.2.0

View File

@ -0,0 +1,53 @@
EAPI=6
inherit cmake-utils
DESCRIPTION="mastodon-cpp is a C++ wrapper for the Mastodon API."
HOMEPAGE="https://github.com/tastytea/mastodon-cpp"
SRC_URI="https://github.com/tastytea/mastodon-cpp/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE="doc debug examples"
RDEPEND=">=dev-cpp/curlpp-0.8.1
examples? ( >=dev-libs/boost-1.63.0 )"
DEPEND=">=dev-util/cmake-3.9.6
doc? ( >=app-doc/doxygen-1.8.13-r1 )
${RDEPEND}"
src_configure() {
local mycmakeargs=(
-DWITH_DOC=NO
-DWITH_EXAMPLES=NO
-DWITH_TESTS=NO
)
if use debug; then
mycmakeargs+=(-DCMAKE_BUILD_TYPE=Debug)
else
mycmakeargs+=(-DCMAKE_BUILD_TYPE=Release)
fi
cmake-utils_src_configure
}
# We won't let cmake handle the documentation, because it would install the
# examples, no matter if we want them.
src_compile() {
if use doc; then
./build_doc.sh
fi
cmake-utils_src_compile
}
src_install() {
if use doc; then
HTML_DOCS="doc/html/*"
fi
if use examples; then
docinto examples
for file in src/examples/*.cpp; do
dodoc ${file}
done
fi
cmake-utils_src_install
}