Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
9 changes: 0 additions & 9 deletions DEBIAN/control

This file was deleted.

45 changes: 0 additions & 45 deletions DEBIAN/postinst

This file was deleted.

45 changes: 0 additions & 45 deletions DEBIAN/postrm

This file was deleted.

44 changes: 0 additions & 44 deletions DEBIAN/prerm

This file was deleted.

29 changes: 1 addition & 28 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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)

5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libws2811 (1.1.0) bookworm; urgency=medium

* Initial deb package release.

-- Jeremy Garff <[email protected]> Wed, 13 Nov 2024 00:29:37 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
29 changes: 29 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Source: libws2811
Section: libs
Priority: optional
Maintainer: Jeremy Garff ([email protected])
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.
23 changes: 23 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions debian/libws2811-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usr/include
usr/lib/*/*.a
usr/lib/*/*.so
usr/lib/*/pkgconfig
1 change: 1 addition & 0 deletions debian/libws2811.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/*.so.*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add usr/lib/*/*.so, to make the non-versioned .so symlink installed too. This is required because a lot of apps depend to the non-versioned .so file.

5 changes: 5 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/make -f

%:
dh $@

1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
1 change: 1 addition & 0 deletions debian/triggers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
activate-noawait ldconfig