【问题标题】:dpkg-buildpackage: how to include .so files in the source packdpkg-buildpackage:如何在源包中包含 .so 文件
【发布时间】:2019-06-13 13:23:38
【问题描述】:

我想打包一个包含 .so 文件的第三方应用程序。 当我使用 dpkg-buildpackage 构建包时,.so 文件会从生成的源包中排除。

我没有 .orig 文件。所以,我在 debian/source 中使用“3.0 (native)”。

首先我收到了这些信息:

dpkg-shlibdeps: error: cannot find library...

所以,我在 debian/rules 文件中包含了“override_dh_makeshlibs”和“override_dh_shlibdeps”。

man dpgk-source 建议在 debian/source 中使用“3.0 (quilt)”,但我没有 .orig 文件,只有一个包含文件的 tar。

我尝试过设置一个 debian/include-binaries 文件(其中包含“path_to.so”),但这没有帮助。

debian/规则:

%:
dh $@

override_dh_strip:
    @echo "Not running dh_strip"

override_dh_makeshlibs:
    @echo "Not running dh_makeshlibs"

override_dh_shlibdeps:
    @echo "Not running dh_shlibdeps"

debian/源码/格式:

3.0 (native)

构建命令:

dpkg-buildpackage -aamd64 -us -uc

我希望源包包含所有文件,但它缺少 .so 文件。

deb 文件构建正确。

[编辑:部分解决方案]
我已经设法通过在构建 deb 之前手动创建 orig 文件来创建带有上游源的 deb。

在源目录中:

更新日志:

make sure that the version number has a revision.

来源/格式:

3.0 (quilt)

源/包含二进制文件:

path_to.so

命令:

VERSION=$(dpkg-parsechangelog -S Version | sed -rne 's,([^-\+]+)+(\+dfsg)*.*,\1,p'i)
SOURCE=$(dpkg-parsechangelog -S Source)
UPSTREAM_PACKAGE=${SOURCE}_${VERSION}.orig.tar.gz

rm -f ../${UPSTREAM_PACKAGE}
tar czvf ../${UPSTREAM_PACKAGE} --exclude=debian --exclude=Makefile

dpkg-buildpackage -rfakeroot -aamd64 -us -uc

有没有办法实现自动化?

我不知道在 debian/rules 文件或 Makefile 中是否或如何做到这一点。

【问题讨论】:

    标签: packaging dpkg


    【解决方案1】:

    这是我想出的解决方案。

    按照您希望打包的方式创建您的项目。我假设您知道成功打包项目需要哪些 debian 文件。

    创建或修改了这些文件:
    debian/源码/格式:

    3.0 (quilt)
    

    debian/规则:

    #!/usr/bin/make -f
    # -*- makefile -*-
    # https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules
    # https://manpages.debian.org/stretch/debhelper/debhelper.7.en.html
    
    # Uncomment this to turn on verbose mode.
    #export DH_VERBOSE=1
    
    version := $(shell dpkg-parsechangelog -S Version | sed -rne 's,([^-\+]+)+(\+dfsg)*.*,\1,p'i)
    source := $(shell dpkg-parsechangelog -S Source)
    upstreampck := $(source)_$(version).orig.tar.gz
    
    clean:
        @ echo CLEAN
        rm -f ../$(upstreampck)
        tar czf ../$(upstreampck) --exclude=debian --exclude=.pc .
        dh_testdir
        dh_auto_clean
        dh_clean 
    
    build:
        @ echo BUILD: nothing to do here
        #dh_testdir
        #dh_auto_configure
        #dh_auto_build
        #dh_auto_test
    
    binary:
        @ echo BINARY
        dh_testroot
        dh_prep
        dh_install
        dh_installdocs
        dh_installchangelogs 
        dh_installexamples
        dh_installman
        dh_link
        dh_compress
        dh_fixperms
        dh_installdeb
        dh_gencontrol
        dh_md5sums
        dh_builddeb
    
    .PHONY: build clean binary
    

    更新 cangelog 并确保在上游版本中添加修订号:

    dch -i -D stable -u low -M -p
    

    构建包:

    dpkg-buildpackage -rfakeroot -us -uc -aamd64 --source-option=--include-binaries
    

    这将生成 orig 文件和 debian/source/include-binaries 文件。

    所有后续构建都可以使用:

    dpkg-buildpackage -rfakeroot -us -uc -aamd64
    

    【讨论】:

      猜你喜欢
      • 2018-08-22
      • 2014-07-15
      • 1970-01-01
      • 2012-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多