[ Content contribution] 水谈·打包适用于 cmake 项目,以 bfdev 项目为例(CMake)
Tofloor
default avatar
魔法师
deepin
2024-06-18 14:29
Author

bfdev is a high-performance, aesthetically pleasing, and portable infrastructure provisioning library. Its goal is to provide a comprehensive and streamlined development environment.

bfdev是一个高性能、美观且便携的基础设施配置库,旨在提供全面而简洁的开发环境。

仓库地址:https://github.com/openbfdev/bfdev

教程引导 - 建议跳过 - 直达附录

主要以 cmake 项目进行光速 deb 打包操作的魔法教程。
您可以不用阅读 SparkDebPackageConfig-Usage.md 文档来了解模块说明

  1. 直接克隆该项目,如果您的网络不是特别通畅请改用以下地址

    git clone https://gitee.com/spark-framework-libs/bfdev

基本复制粘贴说明(纯步骤而已可直接跳过)

  1. 进入终端准备引入 spark 为名的扩展构建模块

    此时 wget 命令将会下载2个文件到 cmake 目录

    cd bfdev wget -P cmake \ https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake \ https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript # 编辑 spark-deb-package.descript 文件,填写包信息
  2. 修改描述文件,补充软件包基本信息(暂补充了以下内容)

    其它部分不按需修改,默认 auto 的将会自动适配

    # 软件包描述信息 Descrition: bfdev bfdev is a high-performance, aesthetically pleasing, and portable infrastructure provisioning library. . Its goal is to provide a comprehensive and streamlined development environment.
  3. 在 bfdev 项目的 CMakeLists.txt 文件尾部添加两行代码

    # 注释行(使用方式) find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript)
    cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF # 您可以使用 cat 命令直接向 CMakeLists.txt 文件尾部追加该内容。 # 并在 $ 符号前添加反斜杆禁用 shell 变量取值

项目构建说明(纯步骤说明而已可直接跳过)

  1. 构建此项目的软件包

    mkdir build # 创建:以 build 名称的目录 cmake -Bbuild -S . # 配置:以 build 目录为输出目录,源目录为当前目录 cmake --build build -t package # 构建:以 build 目录为输出目录,构建 package 目标 # 因为引入了构建模块,即支持了 package 目标动作。如以下配置同上: # mkdir -p build && cd build # cmake .. && make packge # 构建 package 目标时将会生成 deb 文件 # 在 package 构建过程中会自动构建项目并在 build 目录中生成 bfdev_1.0.4-20240618_amd64.deb 文件
    ... [100%] Linking C shared library libbfdev.so [100%] Built target bfdev_shared Run CPack packaging tool... CPack: Create package using DEB CPack: Install projects CPack: - Run preinstall target for: bfdev CPack: - Install project: bfdev [] CPack: Create package -- CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies. CPack: - package: /tmp/bfdev/build/bfdev_1.0.4-20240618_amd64.deb generated.

查看软件包内容(没什么用的内容而已可直接跳过)

  1. 查看软件包内容

    以下是命令输出

    $ dpkg-deb --contents bfdev_1.0.4-20240618_amd64.deb drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/ -rw-r--r-- root/root 2806 2024-06-18 21:49 ./usr/include/bfdev.h -rw-r--r-- root/root 1772 2024-06-18 21:35 ./usr/include/bfdev/action.h -rw-r--r-- root/root 2151 2024-06-18 21:35 ./usr/include/bfdev/align.h -rw-r--r-- root/root 378 2024-06-18 21:35 ./usr/include/bfdev/alloca.h -rw-r--r-- root/root 3418 2024-06-18 21:35 ./usr/include/bfdev/allocator.h -rw-r--r-- root/root 1780 2024-06-18 21:35 ./usr/include/bfdev/allocpool.h -rw-r--r-- root/root 734 2024-06-18 21:35 ./usr/include/bfdev/arc4.h -rw-r--r-- root/root 871 2024-06-18 21:35 ./usr/include/bfdev/argv.h -rw-r--r-- root/root 4424 2024-06-18 21:35 ./usr/include/bfdev/array.h -rw-r--r-- root/root 2064 2024-06-18 21:35 ./usr/include/bfdev/ascii.h -rw-r--r-- root/root 1400 2024-06-18 21:35 ./usr/include/bfdev/ascii85.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/asm/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/asm-generic/ -rw-r--r-- root/root 3934 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/atomic.h -rw-r--r-- root/root 15585 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/bitops.h -rw-r--r-- root/root 604 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/bitsperlong.h -rw-r--r-- root/root 482 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-clz.h -rw-r--r-- root/root 482 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-ctz.h -rw-r--r-- root/root 482 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-ffs.h -rw-r--r-- root/root 494 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-ffsuf.h -rw-r--r-- root/root 516 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-fls.h -rw-r--r-- root/root 520 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/builtin-flsuf.h -rw-r--r-- root/root 355 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/byteorder.h -rw-r--r-- root/root 1453 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/cmpxchg.h -rw-r--r-- root/root 7143 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/dword.h -rw-r--r-- root/root 509 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/rwonce.h -rw-r--r-- root/root 297 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/swab.h -rw-r--r-- root/root 7215 2024-06-18 21:35 ./usr/include/bfdev/asm-generic/unaligned.h -rw-r--r-- root/root 113 2024-06-18 21:49 ./usr/include/bfdev/asm/atomic.h -rw-r--r-- root/root 565 2024-06-18 21:35 ./usr/include/bfdev/asm/bitops.h -rw-r--r-- root/root 118 2024-06-18 21:49 ./usr/include/bfdev/asm/bitsperlong.h -rw-r--r-- root/root 118 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-clz.h -rw-r--r-- root/root 118 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-ctz.h -rw-r--r-- root/root 118 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-ffs.h -rw-r--r-- root/root 120 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-ffsuf.h -rw-r--r-- root/root 118 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-fls.h -rw-r--r-- root/root 120 2024-06-18 21:49 ./usr/include/bfdev/asm/builtin-flsuf.h -rw-r--r-- root/root 116 2024-06-18 21:49 ./usr/include/bfdev/asm/byteorder.h -rw-r--r-- root/root 114 2024-06-18 21:49 ./usr/include/bfdev/asm/cmpxchg.h -rw-r--r-- root/root 112 2024-06-18 21:49 ./usr/include/bfdev/asm/dword.h -rw-r--r-- root/root 113 2024-06-18 21:49 ./usr/include/bfdev/asm/rwonce.h -rw-r--r-- root/root 111 2024-06-18 21:49 ./usr/include/bfdev/asm/swab.h -rw-r--r-- root/root 116 2024-06-18 21:49 ./usr/include/bfdev/asm/unaligned.h -rw-r--r-- root/root 5738 2024-06-18 21:35 ./usr/include/bfdev/atomic.h -rw-r--r-- root/root 1215 2024-06-18 21:35 ./usr/include/bfdev/base32.h -rw-r--r-- root/root 1171 2024-06-18 21:35 ./usr/include/bfdev/base64.h -rw-r--r-- root/root 1465 2024-06-18 21:35 ./usr/include/bfdev/bcd.h -rw-r--r-- root/root 1480 2024-06-18 21:35 ./usr/include/bfdev/bitfield.h -rw-r--r-- root/root 11076 2024-06-18 21:35 ./usr/include/bfdev/bitflags.h -rw-r--r-- root/root 2825 2024-06-18 21:35 ./usr/include/bfdev/bitmap-comp.h -rw-r--r-- root/root 7439 2024-06-18 21:35 ./usr/include/bfdev/bitmap.h -rw-r--r-- root/root 5846 2024-06-18 21:35 ./usr/include/bfdev/bitops-endian.h -rw-r--r-- root/root 14839 2024-06-18 21:35 ./usr/include/bfdev/bitops.h -rw-r--r-- root/root 10083 2024-06-18 21:35 ./usr/include/bfdev/bitrev.h -rw-r--r-- root/root 2914 2024-06-18 21:35 ./usr/include/bfdev/bits.h -rw-r--r-- root/root 1077 2024-06-18 21:35 ./usr/include/bfdev/bitwalk-comp.h -rw-r--r-- root/root 9042 2024-06-18 21:35 ./usr/include/bfdev/bitwalk.h -rw-r--r-- root/root 1836 2024-06-18 21:35 ./usr/include/bfdev/bloom.h -rw-r--r-- root/root 1160 2024-06-18 21:35 ./usr/include/bfdev/bsearch.h -rw-r--r-- root/root 9682 2024-06-18 21:35 ./usr/include/bfdev/btree.h -rw-r--r-- root/root 1593 2024-06-18 21:35 ./usr/include/bfdev/bug.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/byteorder/ -rw-r--r-- root/root 2259 2024-06-18 21:35 ./usr/include/bfdev/byteorder.h -rw-r--r-- root/root 4257 2024-06-18 21:35 ./usr/include/bfdev/byteorder/big-endian.h -rw-r--r-- root/root 4308 2024-06-18 21:35 ./usr/include/bfdev/byteorder/little-endian.h -rw-r--r-- root/root 4375 2024-06-18 21:35 ./usr/include/bfdev/cache.h -rw-r--r-- root/root 530 2024-06-18 21:35 ./usr/include/bfdev/callback.h -rw-r--r-- root/root 642 2024-06-18 21:35 ./usr/include/bfdev/cdefs.h -rw-r--r-- root/root 1529 2024-06-18 21:35 ./usr/include/bfdev/circle.h -rw-r--r-- root/root 882 2024-06-18 21:35 ./usr/include/bfdev/cmpxchg.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/compiler/ -rw-r--r-- root/root 1247 2024-06-18 21:35 ./usr/include/bfdev/compiler.h -rw-r--r-- root/root 11383 2024-06-18 21:35 ./usr/include/bfdev/compiler/attributes.h -rw-r--r-- root/root 490 2024-06-18 21:35 ./usr/include/bfdev/compiler/types.h -rw-r--r-- root/root 1454 2024-06-18 21:49 ./usr/include/bfdev/config.h -rw-r--r-- root/root 616 2024-06-18 21:35 ./usr/include/bfdev/const.h -rw-r--r-- root/root 1443 2024-06-18 21:35 ./usr/include/bfdev/container.h -rw-r--r-- root/root 1019 2024-06-18 21:35 ./usr/include/bfdev/crc.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/crypto/ -rw-r--r-- root/root 480 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc-ccitt-inline.h -rw-r--r-- root/root 83776 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc-ccitt-table.h -rw-r--r-- root/root 3736 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc-inline.h -rw-r--r-- root/root 474 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc-itut-inline.h -rw-r--r-- root/root 83773 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc-itut-table.h -rw-r--r-- root/root 498 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc-rocksoft-inline.h -rw-r--r-- root/root 108370 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc-rocksoft-table.h -rw-r--r-- root/root 486 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc-t10dif-inline.h -rw-r--r-- root/root 83777 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc-t10dif-table.h -rw-r--r-- root/root 456 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc16-inline.h -rw-r--r-- root/root 83769 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc16-table.h -rw-r--r-- root/root 456 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc32-inline.h -rw-r--r-- root/root 91965 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc32-table.h -rw-r--r-- root/root 1349 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc4-inline.h -rw-r--r-- root/root 456 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc64-inline.h -rw-r--r-- root/root 108356 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc64-table.h -rw-r--r-- root/root 441 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc7-inline.h -rw-r--r-- root/root 38703 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc7-table.h -rw-r--r-- root/root 441 2024-06-18 21:35 ./usr/include/bfdev/crypto/crc8-inline.h -rw-r--r-- root/root 38703 2024-06-18 21:49 ./usr/include/bfdev/crypto/crc8-table.h -rw-r--r-- root/root 2592 2024-06-18 21:35 ./usr/include/bfdev/crypto/sha1-base.h -rw-r--r-- root/root 2964 2024-06-18 21:35 ./usr/include/bfdev/crypto/sha1.h -rw-r--r-- root/root 3091 2024-06-18 21:35 ./usr/include/bfdev/crypto/sha2-base.h -rw-r--r-- root/root 4396 2024-06-18 21:35 ./usr/include/bfdev/crypto/sha2.h -rw-r--r-- root/root 7211 2024-06-18 21:35 ./usr/include/bfdev/ctype.h -rw-r--r-- root/root 881 2024-06-18 21:35 ./usr/include/bfdev/dword.h -rw-r--r-- root/root 824 2024-06-18 21:35 ./usr/include/bfdev/errname.h -rw-r--r-- root/root 8367 2024-06-18 21:35 ./usr/include/bfdev/errno.h -rw-r--r-- root/root 1909 2024-06-18 21:35 ./usr/include/bfdev/errptr.h -rw-r--r-- root/root 17051 2024-06-18 21:35 ./usr/include/bfdev/fifo.h -rw-r--r-- root/root 5350 2024-06-18 21:35 ./usr/include/bfdev/fsm.h -rw-r--r-- root/root 886 2024-06-18 21:35 ./usr/include/bfdev/guards.h -rw-r--r-- root/root 1909 2024-06-18 21:35 ./usr/include/bfdev/hash.h -rw-r--r-- root/root 4509 2024-06-18 21:35 ./usr/include/bfdev/hashmap.h -rw-r--r-- root/root 6354 2024-06-18 21:35 ./usr/include/bfdev/hashtbl.h -rw-r--r-- root/root 15001 2024-06-18 21:35 ./usr/include/bfdev/heap.h -rw-r--r-- root/root 12110 2024-06-18 21:35 ./usr/include/bfdev/hlist.h -rw-r--r-- root/root 12643 2024-06-18 21:35 ./usr/include/bfdev/ilist.h -rw-r--r-- root/root 1303 2024-06-18 21:35 ./usr/include/bfdev/level.h -rw-r--r-- root/root 1511 2024-06-18 21:35 ./usr/include/bfdev/levenshtein.h -rw-r--r-- root/root 3968 2024-06-18 21:35 ./usr/include/bfdev/limits.h -rw-r--r-- root/root 22702 2024-06-18 21:35 ./usr/include/bfdev/list.h -rw-r--r-- root/root 1512 2024-06-18 21:35 ./usr/include/bfdev/llist.h -rw-r--r-- root/root 7616 2024-06-18 21:35 ./usr/include/bfdev/log.h -rw-r--r-- root/root 5679 2024-06-18 21:35 ./usr/include/bfdev/log2.h -rw-r--r-- root/root 1282 2024-06-18 21:35 ./usr/include/bfdev/macro.h -rw-r--r-- root/root 1834 2024-06-18 21:35 ./usr/include/bfdev/math.h -rw-r--r-- root/root 2783 2024-06-18 21:35 ./usr/include/bfdev/matrix.h -rw-r--r-- root/root 2523 2024-06-18 21:35 ./usr/include/bfdev/memalloc.h -rw-r--r-- root/root 2289 2024-06-18 21:35 ./usr/include/bfdev/mhelper.h -rw-r--r-- root/root 1723 2024-06-18 21:35 ./usr/include/bfdev/minmax.h -rw-r--r-- root/root 3622 2024-06-18 21:35 ./usr/include/bfdev/mpi.h -rw-r--r-- root/root 2748 2024-06-18 21:35 ./usr/include/bfdev/notifier.h -rw-r--r-- root/root 1253 2024-06-18 21:35 ./usr/include/bfdev/once.h -rw-r--r-- root/root 5175 2024-06-18 21:35 ./usr/include/bfdev/overflow.h -rw-r--r-- root/root 1236 2024-06-18 21:35 ./usr/include/bfdev/poison.h -rw-r--r-- root/root 6973 2024-06-18 21:35 ./usr/include/bfdev/popcount.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/include/bfdev/port/ -rw-r--r-- root/root 367 2024-06-18 21:35 ./usr/include/bfdev/port/ctype.h -rw-r--r-- root/root 397 2024-06-18 21:35 ./usr/include/bfdev/port/limits.h -rw-r--r-- root/root 376 2024-06-18 21:35 ./usr/include/bfdev/port/stdarg.h -rw-r--r-- root/root 375 2024-06-18 21:35 ./usr/include/bfdev/port/stdbool.h -rw-r--r-- root/root 372 2024-06-18 21:35 ./usr/include/bfdev/port/stddef.h -rw-r--r-- root/root 372 2024-06-18 21:35 ./usr/include/bfdev/port/stdint.h -rw-r--r-- root/root 1232 2024-06-18 21:35 ./usr/include/bfdev/port/stdio.h -rw-r--r-- root/root 1203 2024-06-18 21:35 ./usr/include/bfdev/port/stdlib.h -rw-r--r-- root/root 2231 2024-06-18 21:35 ./usr/include/bfdev/port/string.h -rw-r--r-- root/root 1975 2024-06-18 21:35 ./usr/include/bfdev/prandom.h -rw-r--r-- root/root 9673 2024-06-18 21:35 ./usr/include/bfdev/radix.h -rw-r--r-- root/root 40252 2024-06-18 21:35 ./usr/include/bfdev/rbtree.h -rw-r--r-- root/root 8518 2024-06-18 21:35 ./usr/include/bfdev/refcount.h -rw-r--r-- root/root 2137 2024-06-18 21:35 ./usr/include/bfdev/respool.h -rw-r--r-- root/root 18015 2024-06-18 21:35 ./usr/include/bfdev/ringbuf.h -rw-r--r-- root/root 1356 2024-06-18 21:35 ./usr/include/bfdev/scnprintf.h -rw-r--r-- root/root 14661 2024-06-18 21:35 ./usr/include/bfdev/segtree.h -rw-r--r-- root/root 1054 2024-06-18 21:35 ./usr/include/bfdev/sha1.h -rw-r--r-- root/root 1783 2024-06-18 21:35 ./usr/include/bfdev/sha2.h -rw-r--r-- root/root 2005 2024-06-18 21:35 ./usr/include/bfdev/size.h -rw-r--r-- root/root 5637 2024-06-18 21:35 ./usr/include/bfdev/skiplist.h -rw-r--r-- root/root 9247 2024-06-18 21:35 ./usr/include/bfdev/slist.h -rw-r--r-- root/root 818 2024-06-18 21:35 ./usr/include/bfdev/sort.h -rw-r--r-- root/root 283 2024-06-18 21:35 ./usr/include/bfdev/stdarg.h -rw-r--r-- root/root 315 2024-06-18 21:35 ./usr/include/bfdev/stddef.h -rw-r--r-- root/root 279 2024-06-18 21:35 ./usr/include/bfdev/stdio.h -rw-r--r-- root/root 283 2024-06-18 21:35 ./usr/include/bfdev/stdlib.h -rw-r--r-- root/root 629 2024-06-18 21:35 ./usr/include/bfdev/string.h -rw-r--r-- root/root 349 2024-06-18 21:35 ./usr/include/bfdev/stringhash.h -rw-r--r-- root/root 530 2024-06-18 21:35 ./usr/include/bfdev/stringify.h -rw-r--r-- root/root 1676 2024-06-18 21:35 ./usr/include/bfdev/struct.h -rw-r--r-- root/root 12996 2024-06-18 21:35 ./usr/include/bfdev/swab.h -rw-r--r-- root/root 6943 2024-06-18 21:35 ./usr/include/bfdev/textsearch.h -rw-r--r-- root/root 1692 2024-06-18 21:35 ./usr/include/bfdev/time.h -rw-r--r-- root/root 2333 2024-06-18 21:35 ./usr/include/bfdev/timer.h -rw-r--r-- root/root 17725 2024-06-18 21:35 ./usr/include/bfdev/titer.h -rw-r--r-- root/root 1591 2024-06-18 21:35 ./usr/include/bfdev/typecheck.h -rw-r--r-- root/root 2730 2024-06-18 21:35 ./usr/include/bfdev/types.h -rw-r--r-- root/root 4106 2024-06-18 21:35 ./usr/include/bfdev/unaligned.h -rw-r--r-- root/root 970 2024-06-18 21:35 ./usr/include/bfdev/uplower.h drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/lib/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/lib/cmake/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/lib/cmake/bfdev/ -rw-r--r-- root/root 250 2024-06-18 21:49 ./usr/lib/cmake/bfdev/bfdev-config.cmake -rw-r--r-- root/root 385606 2024-06-18 21:49 ./usr/lib/libbfdev.a lrwxrwxrwx root/root 0 2024-06-18 21:49 ./usr/lib/libbfdev.so -> libbfdev.so.1 lrwxrwxrwx root/root 0 2024-06-18 21:49 ./usr/lib/libbfdev.so.1 -> libbfdev.so.1.0.4 -rw-r--r-- root/root 293856 2024-06-18 21:49 ./usr/lib/libbfdev.so.1.0.4 drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/share/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/share/doc/ drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/share/doc/bfdev/ -rw-r--r-- root/root 377 2024-06-18 21:35 ./usr/share/doc/bfdev/AUTHORS -rw-r--r-- root/root 18006 2024-06-18 21:35 ./usr/share/doc/bfdev/COPYING -rw-r--r-- root/root 5613 2024-06-18 21:35 ./usr/share/doc/bfdev/README.md drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/share/doc/bfdev/docs/ -rw-r--r-- root/root 2329 2024-06-18 21:35 ./usr/share/doc/bfdev/docs/components.md drwxr-xr-x root/root 0 2024-06-18 21:49 ./usr/share/doc/bfdev/docs/images/ -rw-r--r-- root/root 8462 2024-06-18 21:35 ./usr/share/doc/bfdev/docs/images/logo.png -rw-r--r-- root/root 4060 2024-06-18 21:35 ./usr/share/doc/bfdev/docs/images/logo.svg

非常规 debian 化构建软件包,适用于更简单高效的打包方式(星火投稿器诞生之时就已经在使用)

附录(不需要思考,终端一开直接粘贴运行就行了)

  • 更快的操作让 cmake 项目变成 deb 包(bfdev)

    git clone https://gitee.com/spark-framework-libs/bfdev cd bfdev wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. && make package dpkg-deb --contents ./*.deb
  • 更快的操作让 cmake 项目变成 deb 包(xcursor-viewer)

    git clone https://github.com/drizt/xcursor-viewer cd xcursor-viewer wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. && make package dpkg-deb --contents ./*.deb

    按附录表,一起来构建 “不小心发现的 CMake 项目” 吧,回贴为例

Reply Favorite View the author
All Replies
魔法师
deepin
2024-06-18 14:42
#1

什么是 debian?(但还是要基于的)
什么是 deb?
什么是 debmake?
什么是 dh?
什么是 dpkg-buildpackage?

通通不需要,直接构建 deb 就行了applaud

Reply View the author
晚秋(lateautumn)
Moderator
2024-06-18 14:43
#2

高手like

Reply View the author
明天会更好
deepin
2024-06-18 23:17
#3

学习,我照猫画虎看有没有拦路虎。

Reply View the author
明天会更好
deepin
2024-06-19 00:06
#4

正常生存deb文件,但是换一个源码,还是不会,那里去找相应的spark 为名扩展构建模块

Reply View the author
魔法师
deepin
2024-06-19 02:04
#5
明天会更好

正常生存deb文件,但是换一个源码,还是不会,那里去找相应的spark 为名扩展构建模块

这里最核心的就两个点:

  1. 拥有 install 逻辑的 CMake 项目,也就是它可以 make install,这样就可以扩展 CMake 项目能力,模块仅限 CMake 项目使用,

  2. 从 wget 命令开始,就是在引入模块,让你的 make install 进而变成 make package,可以生成 deb 软件包

  3. 你同样可以去尝试其它项目,使用以下两步

    1. 克隆项目代码(xcursor-viewer)

      git clone https://github.com/drizt/xcursor-viewer cd xcursor-viewer
    2. 使用以下命令(通用)

      wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. && make package dpkg-deb --contents ./*.deb

      这样就在 build 目录中看到 deb 软件包了

      drwxr-xr-x root/root 0 2024-06-19 10:06 ./usr/ drwxr-xr-x root/root 0 2024-06-19 10:06 ./usr/bin/ -rwxr-xr-x root/root 206816 2024-06-19 10:06 ./usr/bin/xcursor-viewer
    3. 例外:不想使用 ./*.deb ,那么使用强大的命令行吧

      make package | while read line do if [[ "$line" == *"generated." ]]; then dpkg-deb --contents \ $(echo $line | awk -F' ' '{print $4}'); fi done # CPack: - package: /tmp/tmp.xWgxco53hF/xcursor-viewer/build/xcursor-viewer_1.0-20240619_amd64.deb generated. # ^1 2^ ^3 ^4 ^5

    此种方式适用于“仅打包”,而某些项目可能不提供 desktop 文件,所以你打包之后,它是没有图标的。
    参考 https://gitee.com/spark-store-project/xcursor-viewer 项目,这是一个在 CMakeLists.txt 中引入了自动创建 desktop 文件的模块,所以它会拥有应用图标(此内容已经超出本贴范围)

Reply View the author
魔法师
deepin
2024-06-19 03:12
#6
  • 更快的操作让 cmake 项目变成 deb 包(termtunnel)

    Cross-platform terminal tunnel tool 跨平台终端隧道工具,允许你简单 bypass 堡垒机。或是方便的越过多台主机进行通信:HTTP代理、Socks5代理、端口转发以及文件传输。

    git clone https://gitee.com/beordle/termtunnel cd termtunnel
    wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. && make package dpkg-deb --contents ./*.deb
Reply View the author
魔法师
deepin
2024-06-19 03:36
#7
  • 更快的操作让 cmake 项目变成 deb 包(sqlitebrowser - 特例项目)

    _DB Browser for SQLite_ (DB4S)是一个高质量的可视化开源工具,可以 创建、设计和编辑与SQLite兼容的数据库文件。 DB4S是为想要创建、搜索和编辑的用户和开发人员准备的 数据库。DB4S使用熟悉的类似电子表格的界面,因此复杂的SQL命令不必学习。

    git clone https://gitee.com/kunkk1/sqlitebrowser cd sqlitebrowser
    # 扩展构建不适用于已拥有 CPack 的项目,所以可以直接构建 mkdir build && cd build && cmake .. && make package dpkg-deb --contents ./*.deb
    drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/bin/ -rwxr-xr-x root/root 7529576 2024-06-19 11:33 ./usr/bin/sqlitebrowser drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/applications/ -rw-r--r-- root/root 722 2024-06-19 11:27 ./usr/share/applications/sqlitebrowser.desktop drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/hicolor/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/hicolor/256x256/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/hicolor/256x256/apps/ -rw-r--r-- root/root 15047 2024-06-19 11:27 ./usr/share/icons/hicolor/256x256/apps/sqlitebrowser.png drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/hicolor/scalable/ drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/icons/hicolor/scalable/apps/ -rw-r--r-- root/root 14683 2024-06-19 11:27 ./usr/share/icons/hicolor/scalable/apps/sqlitebrowser.svg drwxr-xr-x root/root 0 2024-06-19 11:33 ./usr/share/metainfo/ -rw-r--r-- root/root 2628 2024-06-19 11:27 ./usr/share/metainfo/sqlitebrowser.desktop.appdata.xml

    image.png

Reply View the author
魔法师
deepin
2024-06-19 05:50
#8
  • 更快的操作让 cmake 项目变成 deb 包(OpenSceneGraph)

    OpenSceneGraph是一个开源的三维引擎,被广泛的应用在可视化仿真、游戏、虚拟现实、科学计算、三维重建、地理信息、太空探索、石油矿产等领域。

    git clone https://gitee.com/mirrors/OpenSceneGraph cd OpenSceneGraph
    wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. && make package -j8 dpkg-deb --contents ./*.deb
Reply View the author
魔法师
deepin
2024-06-19 07:17
#9
  • 更快的操作让 cmake 项目变成 deb 包(CPU-X)

    CPU-X是一个收集CPU、主板等信息的免费软件。 CPU-X是一个系统配置和监控应用程序(类似于Windows的CPU-Z),但CPU-X是一个为GNU/Linux和FreeBSD设计的免费开源软件。 这个软件是用C写的,用CMake工具构建的。 可以通过使用GTK在图形模式下使用它,也可以通过使用NCurses在基于文本的模式下使用它。命令行中存在转储模式。

    git clone https://gitee.com/swlhmq/CPU-X cd CPU-X
    wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/SparkDebPackageConfig.cmake wget -P cmake https://gitee.com/zinface/spark.deb-package/raw/master/cmake/spark-deb-package.descript cat >> CMakeLists.txt <<EOF # 注释行(使用方式) find_package(SparkDebPackage PATHS \${CMAKE_SOURCE_DIR}) add_package_descript(cmake/spark-deb-package.descript) EOF mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr && make package -j8 dpkg-deb --contents ./*.deb
Reply View the author
乾豫恒益
deepin
2024-10-08 01:11
#10

关于CMake要好好学习一下了,还有一堆的知识不懂。。。

Reply View the author
New Thread

Popular Events

More
国际排名
WHLUG