1

我需要一些帮助来解决以下问题:

我有一个每天使用 Launchpad 的食谱功能构建的 debian 包。版本名称(和源目录的名称)是自动生成的,包括当前的修订号。我想修改 debian/rules 文件以提取修订号并将其传递给 CMake。

到目前为止它不起作用 - 似乎将一个空字符串传递给 CMake。我不知道问题出在我的 make 代码中还是其他问题上。

规则文件:

#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

%:
    dh $@ --parallel --list-missing

# Try to detect the Bazaar revision number from the directory name
ifneq ($(findstring bzr,$(PWD)),)
COMPONENTS := $(PWD)
COMPONENTSL := $(subst -,' ',COMPONENTS)
COMPONENTSLL := $(subst ~,' ',COMPONENTSL)
BZRVER := $(filter bzr%,COMPONENTSLL)
BZRVERN := $(subst bzr,,$(BZRVER))
override_dh_auto_configure:
    dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=$(BZRVERN)
endif

构建日志的相关部分:

make[1]: Entering directory `/build/buildd/stellarium-0.11.2~bzr5066'
dh_auto_configure -- -DRELEASE_BUILD=0 -DBZR_REVISION=
    mkdir -p obj-i686-linux-gnu
    cd obj-i686-linux-gnu
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DRELEASE_BUILD=0 -DBZR_REVISION=

完整日志在这里: https ://launchpadlibrarian.net/86783083/buildlog_ubuntu-natty-i386.stellarium_0.11.2~bzr5066-0ubuntu0~natty1_BUILDING.txt.gz

有任何想法吗?

4

1 回答 1

1

你至少在这些方面犯了一个错误:

COMPONENTSL := $(subst -,' ',COMPONENTS)
COMPONENTSLL := $(subst ~,' ',COMPONENTSL)
BZRVER := $(filter bzr%,COMPONENTSLL)

您必须对COMPONENTSXX变量的实际值进行更改,因此它们的名称应包含在$(...).

如果您唯一需要的是修订号(在您的示例中为 5066),则可以提取如下:

BZR_REVISION := $(lastword $(subst ~bzr, ,$(PWD)))
于 2011-12-06T17:41:45.530 回答