diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5dd903..643183c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,12 +11,13 @@ set(HEADERDEF "${VERSION_MAJOR}_${VERSION_MINOR}_${VERSION_MICRO}") project(rpi_ws281x VERSION ${PROJECT_VERSION}) -option(BUILD_SHARED "Build as shared library" OFF) option(BUILD_TEST "Build test application" ON) set(CMAKE_C_STANDARD 11) set(LIB_TARGET ws2811) +set(LIB_SHARED_TARGET "${LIB_TARGET}-shared") +set(LIB_STATIC_TARGET "${LIB_TARGET}-static") set(TEST_TARGET test) set(LIB_PUBLIC_HEADERS @@ -53,25 +54,27 @@ configure_file( @ONLY ) -set(DEST_HEADERS_DIR include/ws2811) -set(DEST_LIB_DIR lib) +add_library(${LIB_SHARED_TARGET} SHARED ${LIB_SOURCES}) +add_library(${LIB_STATIC_TARGET} ${LIB_SOURCES}) -if(BUILD_SHARED) - add_library(${LIB_TARGET} SHARED ${LIB_SOURCES}) -else() - add_library(${LIB_TARGET} ${LIB_SOURCES}) -endif() +target_link_libraries(${LIB_SHARED_TARGET} m) +target_link_libraries(${LIB_STATIC_TARGET} m) -target_link_libraries(${LIB_TARGET} m) -set_target_properties(${LIB_TARGET} PROPERTIES PUBLIC_HEADER "${LIB_PUBLIC_HEADERS}") +set_target_properties(${LIB_SHARED_TARGET} ${LIB_STATIC_TARGET} + PROPERTIES + OUTPUT_NAME ${LIB_TARGET} + VERSION 1.1 + SOVERSION 1 + PUBLIC_HEADER "${LIB_PUBLIC_HEADERS}") -install(TARGETS ${LIB_TARGET} - ARCHIVE DESTINATION ${DEST_LIB_DIR} - PUBLIC_HEADER DESTINATION ${DEST_HEADERS_DIR} +install(TARGETS ${LIB_SHARED_TARGET} ${LIB_STATIC_TARGET} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ws2811" ) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/libws2811.pc" - DESTINATION lib/pkgconfig) + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") install(CODE "execute_process(COMMAND /sbin/ldconfig RESULT_VARIABLE EXIT_STATUS @@ -84,5 +87,5 @@ if(BUILD_TEST) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(${TEST_TARGET} ${TEST_SOURCES}) - target_link_libraries(${TEST_TARGET} ${LIB_TARGET}) + target_link_libraries(${TEST_TARGET} ${LIB_SHARED_TARGET}) endif() diff --git a/DEBIAN/control b/DEBIAN/control deleted file mode 100644 index ab028912..00000000 --- a/DEBIAN/control +++ /dev/null @@ -1,9 +0,0 @@ -package: libws2811 -Version: 1.1.0-1 -Section: base -Priority: optional -Architecture: armhf -Depends: -Maintainer: Jeremy Garff (jer@jers.net) -Description: Raspberry Pi WS281X Library - LED Control Library for the Raspberry Pi. diff --git a/DEBIAN/postinst b/DEBIAN/postinst deleted file mode 100644 index 70ad8398..00000000 --- a/DEBIAN/postinst +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -# source debconf library -. /usr/share/debconf/confmodule - -# Source dbconfig-common functions -if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then - . /usr/share/dbconfig-common/dpkg/postinst.pgsql -fi - -case "$1" in - - configure) - ldconfig - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; - -esac - -db_stop - -exit 0 -~ diff --git a/DEBIAN/postrm b/DEBIAN/postrm deleted file mode 100644 index 689222c5..00000000 --- a/DEBIAN/postrm +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -# source debconf library -. /usr/share/debconf/confmodule - -# Source dbconfig-common functions -if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then - . /usr/share/dbconfig-common/dpkg/postinst.pgsql -fi - -case "$1" in - - remove) - ldconfig - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; - -esac - -db_stop - -exit 0 -~ diff --git a/DEBIAN/prerm b/DEBIAN/prerm deleted file mode 100644 index b90c5b06..00000000 --- a/DEBIAN/prerm +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -# source debconf library -. /usr/share/debconf/confmodule - -# Source dbconfig-common functions -if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then - . /usr/share/dbconfig-common/dpkg/postinst.pgsql -fi - -case "$1" in - - remove|upgrade|deconfigure) - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; - -esac - -db_stop - -exit 0 - diff --git a/SConscript b/SConscript index 39540a1d..8f89310b 100644 --- a/SConscript +++ b/SConscript @@ -62,34 +62,7 @@ test = tools_env.Program('test', objs + tools_env['LIBS']) Default([test, ws2811_lib]) -package_version = "1.1.0-1" -package_name = 'libws2811_%s' % package_version - -debian_files = [ - 'DEBIAN/control', - 'DEBIAN/postinst', - 'DEBIAN/prerm', - 'DEBIAN/postrm', -] - -package_files_desc = [ - [ '/usr/lib', ws2811_slib ], -] - -package_files = [] -for target in package_files_desc: - package_files.append(tools_env.Install(package_name + target[0], target[1])) - -for deb_file in debian_files: - package_files.append( - tools_env.Command('%s/%s' % (package_name, deb_file), deb_file, [ - Copy("$TARGET", "$SOURCE"), - Chmod("$TARGET", 0o755) - ]) - ) - -package = tools_env.Command('%s.deb' % package_name, package_files, - 'cd %s; dpkg-deb --build %s' % (Dir('.').abspath, package_name)); +package = tools_env.Execute('dpkg-buildpackage -us -uc') Alias("deb", package) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..5de434a1 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +libws2811 (1.1.0) bookworm; urgency=medium + + * Initial deb package release. + + -- Jeremy Garff Wed, 13 Nov 2024 00:29:37 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..6b1871c1 --- /dev/null +++ b/debian/control @@ -0,0 +1,29 @@ +Source: libws2811 +Section: libs +Priority: optional +Maintainer: Jeremy Garff (jer@jers.net) +Build-Depends: debhelper (>= 9), cmake +Standards-Version: 4.1.4 +Homepage: https://github.com/jgarff/rpi_ws281x +Vcs-Git: https://github.com/jgarff/rpi_ws281x.git +Vcs-Browser: https://github.com/jgarff/rpi_ws281x + +Package: libws2811-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libws2811 (= ${binary:Version}), ${misc:Depends} +Description: Raspberry Pi WS281X Library - development kit + LED Control Library for the Raspberry Pi. + . + This package contains the development files for libws2811. + +Package: libws2811 +Section: libs +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Raspberry Pi WS281X Library + LED Control Library for the Raspberry Pi. + . + This package contains the libws2811 library used by applications. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..f6a3e913 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +Copyright (c) 2014, jgarff +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/debian/libws2811-dev.install b/debian/libws2811-dev.install new file mode 100644 index 00000000..72723864 --- /dev/null +++ b/debian/libws2811-dev.install @@ -0,0 +1,4 @@ +usr/include +usr/lib/*/*.a +usr/lib/*/*.so +usr/lib/*/pkgconfig diff --git a/debian/libws2811.install b/debian/libws2811.install new file mode 100644 index 00000000..3de3b10a --- /dev/null +++ b/debian/libws2811.install @@ -0,0 +1 @@ +usr/lib/*/*.so.* diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..abde6ef2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f + +%: + dh $@ + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..89ae9db8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/triggers b/debian/triggers new file mode 100644 index 00000000..dd866036 --- /dev/null +++ b/debian/triggers @@ -0,0 +1 @@ +activate-noawait ldconfig