mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
feat: linux packaging
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
cmake_minimum_required(VERSION 3.6)
|
cmake_minimum_required(VERSION 3.6)
|
||||||
project(GmSSL)
|
project(GmSSL)
|
||||||
|
|
||||||
|
SET(CMAKE_PROJECT_HOMEPAGE_URL "http://gmssl.org")
|
||||||
|
|
||||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|
||||||
@@ -267,3 +270,11 @@ if (CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
|||||||
# target_compile_options(gmssl PRIVATE /wd4996)
|
# target_compile_options(gmssl PRIVATE /wd4996)
|
||||||
# target_compile_options(gmssl-bin PRIVATE /wd4996)
|
# target_compile_options(gmssl-bin PRIVATE /wd4996)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
# packaging
|
||||||
|
include(LinuxPacking)
|
||||||
|
include(DebPacking)
|
||||||
|
include(RpmPacking)
|
||||||
|
include(CPack)
|
||||||
|
endif (UNIX)
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -65,6 +65,26 @@ cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDR
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Linux软件包构建
|
||||||
|
|
||||||
|
依赖于cmake工具包中的cpack工具,目前仅支持构建:
|
||||||
|
* .deb
|
||||||
|
* .rpm
|
||||||
|
* .sh安装脚本
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir build; cd build
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||||
|
# 构建deb软件包
|
||||||
|
cpack -G DEB
|
||||||
|
# 构建rpm软件包
|
||||||
|
cpack -G RPM
|
||||||
|
# 构建.sh安装脚本
|
||||||
|
make package
|
||||||
|
```
|
||||||
|
|
||||||
|
构建的软件包在`build`目录下。
|
||||||
|
|
||||||
## 主要功能
|
## 主要功能
|
||||||
|
|
||||||
### 密码算法
|
### 密码算法
|
||||||
|
|||||||
3
cmake/DebPacking.cmake
Normal file
3
cmake/DebPacking.cmake
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_NOARCH_PACKAGE_RELEASE})
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_VENDOR})
|
||||||
17
cmake/LinuxPacking.cmake
Normal file
17
cmake/LinuxPacking.cmake
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
set(CPACK_PACKAGE_NAME "gmssl")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "GmSSL develop team")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR 3)
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR 0)
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH 0)
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${PROJECT_SOURCE_DIR}/README.md)
|
||||||
|
string(CONCAT CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||||
|
"GmSSL is an open source cryptographic toolbox that supports SM2 / SM3 / SM4 / SM9 "
|
||||||
|
"and other national secret (national commercial password) algorithm. ")
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY /usr)
|
||||||
|
set(CPACK_PACKAGE_CONTACT "https://github.com/guanzhi/GmSSL/issues")
|
||||||
|
# The general number of package itself.
|
||||||
|
# Should be incremented when the package content changes for the same version.
|
||||||
|
# Can be used to distinguish between different builds of the same version.
|
||||||
|
# Can be overridden by `cmake -DCPACK_NOARCH_PACKAGE_RELEASE=1`
|
||||||
|
set(CPACK_NOARCH_PACKAGE_RELEASE 1 CACHE STRING "The general release number of package")
|
||||||
2
cmake/RpmPacking.cmake
Normal file
2
cmake/RpmPacking.cmake
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
|
||||||
|
set(CPACK_RPM_PACKAGE_RELEASE ${CPACK_NOARCH_PACKAGE_RELEASE})
|
||||||
Reference in New Issue
Block a user