Add packaging.

This commit is contained in:
James Pace 2022-03-26 20:10:14 -04:00
parent fa238f650d
commit 4f267f5edf
10 changed files with 80 additions and 22 deletions

View File

@ -8,35 +8,42 @@ find_package(yaml-cpp)
set(CMAKE_CXX_STANDARD 20)
add_library(utils SHARED src/utils.cpp)
target_include_directories(utils PUBLIC
add_library(j7s-plugin-utils SHARED src/utils.cpp)
target_include_directories(j7s-plugin-utils PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(utils OpenSSL::Crypto jwt-cpp)
target_link_libraries(j7s-plugin-utils OpenSSL::Crypto jwt-cpp)
add_library(Authorizer SHARED src/Authorizer.cpp src/AuthList.cpp)
target_include_directories(Authorizer PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(Authorizer utils yaml-cpp)
target_link_libraries(Authorizer j7s-plugin-utils yaml-cpp)
add_library(j7s-plugin SHARED src/j7s-plugin.cpp)
target_include_directories(j7s-plugin PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(j7s-plugin utils Authorizer)
target_link_libraries(j7s-plugin j7s-plugin-utils Authorizer)
add_executable(gen-token src/gen-token.cpp)
target_include_directories(gen-token PUBLIC
add_executable(j7s-gen-token src/gen-token.cpp)
target_include_directories(j7s-gen-token PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(gen-token utils argparse::argparse)
target_link_libraries(j7s-gen-token j7s-plugin-utils argparse::argparse)
if(BUILD_TESTING)
FetchContent_Declare(googletest
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "release-1.11.0"
GIT_SHALLOW "True"
)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
enable_testing()
@ -46,6 +53,19 @@ if(BUILD_TESTING)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(token_test utils GTest::gtest_main)
target_link_libraries(token_test j7s-plugin-utils GTest::gtest_main)
gtest_discover_tests(token_test)
endif()
install(
TARGETS
j7s-plugin
Authorizer
j7s-plugin-utils
j7s-gen-token
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
COMPONENT Plugin
)

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
j7s-mosquitto-plugin (0.0.1-1) unstable; urgency=medium
* Initial release.
-- James Pace <jpace121@gmail.com> Sat, 26 Mar 2022 23:49:28 +0000

14
debian/control vendored Normal file
View File

@ -0,0 +1,14 @@
Source: j7s-mosquitto-plugin
Maintainer: James Pace <jpace121@gmail.com>
Build-Depends: cmake, dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, debhelper-compat (= 12),
mosquitto-dev, libmosquitto-dev, libssl-dev, libyaml-cpp-dev
Standards-Version: 4.1.5
Homepage: https://github.com/jpace121/j7s-jwt-mosquitto-auth
Section: misc
Priority: optional
Package: j7s-mosquitto-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Authentication plugin for mosquitto for the j7s project.
Authentication plugin for mosquitto for the j7s project.

17
debian/copyright vendored Normal file
View File

@ -0,0 +1,17 @@
Files: *
Copyright: 2021-2022 James Pace <jpace121@gmail.com>
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
On Debian systems, the full text of the Apache Software License version 2 can
be found in the file `/usr/share/common-licenses/Apache-2.0'.

3
debian/files vendored Normal file
View File

@ -0,0 +1,3 @@
j7s-mosquitto-plugin-dbgsym_0.0.1-1_amd64.deb debug optional automatic=yes
j7s-mosquitto-plugin_0.0.1-1_amd64.buildinfo misc optional
j7s-mosquitto-plugin_0.0.1-1_amd64.deb misc optional

View File

@ -0,0 +1 @@
Plugin

4
debian/rules vendored Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/make -f
%:
dh $@ --buildsystem=cmake

1
debian/triggers vendored Normal file
View File

@ -0,0 +1 @@
activate-noawait ldconfig

View File

@ -1,17 +1,17 @@
per_listener_settings true
log_type all
listener 8082
listener 9000
protocol websockets
allow_anonymous false
auth_plugin /home/jimmy/Develop/mosquitto-plugin/build/libj7s-plugin.so
auth_opt_key_file /home/jimmy/Develop/mosquitto-plugin/examples/keys.yaml
auth_opt_acl_file /home/jimmy/Develop/mosquitto-plugin/examples/acl.yaml
auth_plugin /opt/libj7s-plugin.so
auth_opt_key_file /opt/websocket-keys.yaml
auth_opt_acl_file /opt/websocket-acl.yaml
listener 8081
listener 9001
protocol mqtt
allow_anonymous false
auth_plugin /home/jimmy/Develop/mosquitto-plugin/build/libj7s-plugin.so
auth_plugin /opt/libj7s-plugin.so
auth_opt_key_file /home/jimmy/Develop/mosquitto-plugin/examples/keys.yaml
auth_opt_acl_file /home/jimmy/Develop/mosquitto-plugin/examples/acl.yaml

View File

@ -1,12 +1,5 @@
include(FetchContent)
FetchContent_Declare(googletest
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_TAG "release-1.11.0"
GIT_SHALLOW "True"
)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(jwt-cpp
GIT_REPOSITORY "https://github.com/Thalhammer/jwt-cpp.git"
GIT_TAG "v0.5.2"