bump to 0.0.4, address packaging review issues

This commit is contained in:
Neil Hanlon 2023-08-07 22:08:38 -04:00 committed by Neil Hanlon
parent 581bde9d2c
commit e47699ff65
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
2 changed files with 53 additions and 128 deletions

View File

@ -1,121 +1,30 @@
diff -ru blisp-0.0.2/CMakeLists.txt blisp-0.0.2-b/CMakeLists.txt
--- blisp-0.0.2/CMakeLists.txt 2023-01-12 05:49:04.000000000 -0500
+++ blisp-0.0.2-b/CMakeLists.txt 2023-01-12 14:31:14.092073606 -0500
@@ -32,30 +32,19 @@
ARCHIVE_OUTPUT_DIRECTORY "static"
OUTPUT_NAME "blisp")
-target_sources(libblisp_obj PRIVATE
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
-
-target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
-
if(WIN32)
target_link_libraries(libblisp PRIVATE Setupapi.lib)
target_link_libraries(libblisp_static PRIVATE Setupapi.lib)
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/windows.c)
elseif(UNIX AND NOT APPLE)
- target_sources(libblisp_obj PRIVATE
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/linux.c
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
- target_compile_definitions(libblisp_obj PRIVATE
- LIBSERIALPORT_ATBUILD
- HAVE_TERMIOS2_SPEED
- HAVE_STRUCT_TERMIOS2
- HAVE_DECL_BOTHER
- "SP_API=__attribute__((visibility(\"default\")))"
- "SP_PRIV=__attribute__((visibility(\"hidden\")))")
- write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
+ find_package(PkgConfig)
+ pkg_check_modules(LIBSP REQUIRED libserialport>=0.1.1)
+
+ target_link_libraries(libblisp_obj PRIVATE ${LIBSP_LIBRARIES})
+ target_include_directories(libblisp_obj PRIVATE ${LIBSP_INCLUDE_DIRS})
+ target_compile_options(libblisp_obj PUBLIC ${LIBSP_CFLAGS_OTHER})
elseif(APPLE)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
@@ -67,6 +56,49 @@
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 693dc6b..2d4d7d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,7 +90,17 @@ else()
endif()
endif()
+set(BLISP_PACKAGE_NAME Blisp)
+set(BLISP_VERSION 0.0.2)
-install(TARGETS libblisp libblisp_static DESTINATION lib)
+include(GNUInstallDirs)
+if(UNIX OR MSYS OR MINGW)
+ set(BLISP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/blisp)
+elseif(WIN32)
+ set(BLISP_INSTALL_CMAKEDIR "cmake")
+endif()
+install(TARGETS libblisp libblisp_static
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(FILES ${BLISP_PUBLIC_HEADERS}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
if(BLISP_BUILD_CLI)
add_subdirectory(tools/blisp)
+ install(TARGETS blisp
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
endif()
+
+install(TARGETS libblisp
+ EXPORT ${BLISP_PACKAGE_NAME}Config
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
+file(GLOB HEADER_FILES
+ "${PROJECT_SOURCE_DIR}/include/*.h"
+ "${PROJECT_SOURCE_DIR}/data/*.h"
+)
+
+install(FILES ${HEADER_FILES}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(EXPORT ${BLISP_PACKAGE_NAME}Config
+ NAMESPACE ${BLISP_PROJECT_NAME}::
+ DESTINATION ${BLISP_INSTALL_CMAKEDIR}
+)
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file("${PROJECT_BINARY_DIR}/${BLISP_PACKAGE_NAME}ConfigVersion.cmake"
+ VERSION ${BLISP_VERSION}
+ COMPATIBILITY SameMajorVersion
+)
+
+install(FILES "${PROJECT_BINARY_DIR}/${BLISP_PACKAGE_NAME}ConfigVersion.cmake"
+ DESTINATION ${BLISP_INSTALL_CMAKEDIR}
+)
--- blisp-0.0.2/tools/blisp/CMakeLists.txt 2023-01-12 05:49:04.000000000 -0500
+++ blisp-0.0.2-b/tools/blisp/CMakeLists.txt 2023-01-12 14:20:35.839890965 -0500
@@ -1,20 +1,21 @@
set(ARGTABLE3_ENABLE_TESTS OFF CACHE BOOL "Enable unit tests")
set(ARGTABLE3_ENABLE_EXAMPLES OFF CACHE BOOL "Enable examples")
#set(ARGTABLE3_REPLACE_GETOPT OFF CACHE BOOL "Replace getopt in the system C library")
-add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
@@ -99,4 +109,4 @@ endif()
add_executable(blisp src/main.c src/cmd/write.c src/util.c src/common.c src/cmd/iot.c)
-target_include_directories(blisp PRIVATE
- "${CMAKE_SOURCE_DIR}/include"
- "${CMAKE_SOURCE_DIR}/vendor/argtable3/src")
+find_package(Argtable3 REQUIRED)
+target_include_directories(blisp PRIVATE
+ "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(blisp PRIVATE
- argtable3
+ argtable3::argtable3
+ ${LIBSP_LIBRARIES}
libblisp_static)
if (WIN32)
target_link_libraries(blisp PRIVATE Setupapi.lib)
elseif (APPLE)
target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation")
-endif ()
if(COMPILE_TESTS)
add_subdirectory(tools/blisp/src/cmd/dfu/tests)
-endif(COMPILE_TESTS)
\ No newline at end of file
+endif ()
+
+endif(COMPILE_TESTS)

View File

@ -1,18 +1,25 @@
Name: blisp
Version: 0.0.3
Release: 0%{?dist}
Version: 0.0.4
Release: 1%{?dist}
Summary: Bouffalo Labs ISP tool/library for flashing Bouffalo RISC-V MCUs
URL: https://github.com/pine64/blisp
License: MIT, Apache
License: MIT, Apache-2.0
Source0: https://github.com/pine64/%{name}/archive/refs/tags/v%{version}.tar.gz
Patch0: 0001-Fix-cmake.patch
Source: https://github.com/pine64/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildRequires: gcc cmake make
BuildRequires: libserialport, libserialport-devel
BuildRequires: argtable3, argtable3-devel
Patch: 0001-Fix-cmake.patch
Requires: libserialport, argtable3
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: make
BuildRequires: argtable3
BuildRequires: argtable3-devel
BuildRequires: libserialport
BuildRequires: libserialport-devel
Requires: argtable3
Requires: libserialport
%global _description %{expand:
Bouffalo Labs ISP tool & library
@ -28,29 +35,38 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Header and development files for using blisp
%package libs
Summary: Libraries for blisp
Requires: %{name}%{?_isa} = %{version}-%{release}
%description libs
Shared libraries for blisp
%prep
%autosetup -p 1 -n %{name}-%{version}
rm -rv vendor/
%build
%cmake -DBLISP_BUILD_CLI=ON
%cmake -DBLISP_BUILD_CLI=ON -DBLISP_USE_SYSTEM_LIBRARIES=ON -DCMAKE_INSTALL_LIBDIR=lib64
%cmake_build
%install
%cmake_install
%files
%{_libdir}/libblisp.so*
%{_bindir}/blisp
%files libs
%{_libdir}/libblisp.so*
%{_libdir}/libblisp.a
%files devel
%{_includedir}/blisp*.h
%{_includedir}/bl?0x_eflash_loader.h
%{_libdir}/cmake/blisp/*
%ldconfig_scriptlets
%changelog
* Mon Aug 07 2023 Neil Hanlon <neil@shrug.pw> - 0.0.4-1
- Update to upstream 0.0.4
* Thu Jan 26 2023 Neil Hanlon <neil@shrug.pw> - 0.0.3-0
- Update to upstream 0.0.3