buildroot将一个错误的PREFIX附加到自定义包构建中

时间:2015-08-21 13:48:24

标签: makefile autotools prefix buildroot

我正在尝试将WSO2 WSF/C自定义程序包包含到buildroot交叉编译ARM项目中。到目前为止,这是wsfc.mk文件:

################################################################################
#
# WSO2 WSF/C 
#
################################################################################

    WSFC_VERSION = 2.0.0
    WSFC_SOURCE_BASENAME = wso2-wsf-c-src-$(WSFC_VERSION)
    WSFC_SOURCE = $(WSFC_SOURCE_BASENAME).zip
    WSFC_SITE = $(BR2_EXTERNAL)/package/wsfc/
    WSFC_SITE_METHOD = file
    WSFC_PREFIX = /usr/local/wso/wsf_c/
    WSFC_CONF_OPTS = --prefix=$(WSFC_PREFIX) --exec-prefix=$(WSFC_PREFIX) \
                     --enable-rampart=no --enable-sandesha=no --enable-savan=no

    define WSFC_EXTRACT_CMDS
        unzip $(DL_DIR)/$(WSFC_SOURCE) -d $(@D)
        mv $(@D)/$(WSFC_SOURCE_BASENAME)/* $(@D)
        rmdir $(@D)/$(WSFC_SOURCE_BASENAME)
    endef

    $(eval $(autotools-package))

问题,

WSFC_PREFIX = /usr/local/wso/wsf_c/时,它会尝试在主机中安装样本,因此权限被拒绝

[... lot of buildroot log output then:]
/usr/bin/make  install-data-hook
make[5]: Entering directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
mkdir -p /usr/local/wso/wsf_c/samples/src/axis2c
mkdir: cannot create directory ‘/usr/local/wso’: Permission denied
make[5]: *** [install-data-hook] Error 1
make[5]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[4]: *** [install-data-am] Error 2
make[4]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/axis2c'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0'
make: *** [/home/masteruser/Downloads/buildroot-2015.05/output/build/wsfc-2.0.0/.stamp_target_installed] Error 2

WSFC_PREFIX = $(TARGET_DIR)/usr/local/wso/wsf_c/时,没有错误,但它重复了前缀,在错误的地方安装了几个文件(..home ../ target / home /...)

[... lot of buildroot log output then:]
test -z "/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c" || /bin/mkdir -p "/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c"
test -z "/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/docs" || /bin/mkdir -p "/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/docs"
 /usr/bin/install -c -m 644 'config/axis2.xml' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/axis2.xml'
 /usr/bin/install -c -m 644 'README' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/README'
 /usr/bin/install -c -m 644 'INSTALL' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/INSTALL'
 /usr/bin/install -c -m 644 'COPYING' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/COPYING'
 /usr/bin/install -c -m 644 'NEWS' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/NEWS'
 /usr/bin/install -c -m 644 'CREDITS' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/CREDITS'
 /usr/bin/install -c -m 644 'NOTICE' '/home/masteruser/Downloads/buildroot-2015.05/output/target/home/masteruser/Downloads/buildroot-2015.05/output/target/usr/local/wso/wsf_c/NOTICE'
[... lot of buildroot log output ]

我认为这需要修复补丁,但我不熟悉autotools,我不知道我应该在哪里修补以及buildroot如何在make期间附加前缀以避免这种行为。

1 个答案:

答案 0 :(得分:1)

WSF / C源未正确使用autotools。有一些手动编写的安装挂钩,但它们不包含目标位置中的$(DESTDIR)/前缀。所以这些东西都安装在主机系统中,而不是安装在输出/目标目录中。

最简单的解决方案是不安装样品。

以下是修复源代码并将其集成到buildroot的文件和修补程序。

wsfc.mk

################################################################################
#
# WSO2 WSF/C 
#
################################################################################

WSFC_VERSION = 2.0.0
WSFC_SOURCE_BASENAME = wso2-wsf-c-src-$(WSFC_VERSION)
WSFC_SOURCE = $(WSFC_SOURCE_BASENAME).zip
WSFC_SITE = $(BR2_EXTERNAL)/package/wsfc/
WSFC_SITE_METHOD = file
WSFC_PREFIX = /usr/local/wso/wsf_c/
WSFC_CONF_OPTS = --prefix=$(WSFC_PREFIX) --exec-prefix=$(WSFC_PREFIX) --enable-rampart=no --enable-sandesha=no --enable-savan=no

define WSFC_EXTRACT_CMDS
    unzip $(DL_DIR)/$(WSFC_SOURCE) -d $(@D)
    mv $(@D)/$(WSFC_SOURCE_BASENAME)/* $(@D)
    rmdir $(@D)/$(WSFC_SOURCE_BASENAME)
endef

$(eval $(autotools-package))

0001次采样DESTDIR-fix.patch

diff -ENwbur wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.am wso2-wsf-c-src-2.0.0/axis2c/Makefile.am
--- wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.am    2015-08-21 16:33:24.807351795 -0300
+++ wso2-wsf-c-src-2.0.0/axis2c/Makefile.am 2015-08-21 16:37:58.994193027 -0300
@@ -30,6 +30,8 @@
    rm -rf axis2c-bin-${PACKAGE_VERSION}-linux

 install-data-hook:
-   mkdir -p $(samplesdir)/src/axis2c
-   cp -rf samples/* $(samplesdir)/src/axis2c
+   @:
+
+   #mkdir -p $(samplesdir)/src/axis2c
+   #cp -rf samples/* $(samplesdir)/src/axis2c

diff -ENwbur wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.in wso2-wsf-c-src-2.0.0/axis2c/Makefile.in
--- wso2-wsf-c-src-2.0.0.orig/axis2c/Makefile.in    2015-08-21 16:33:25.191159781 -0300
+++ wso2-wsf-c-src-2.0.0/axis2c/Makefile.in 2015-08-21 16:38:25.178193336 -0300
@@ -823,8 +823,10 @@
    rm -rf axis2c-bin-${PACKAGE_VERSION}-linux

 install-data-hook:
-   mkdir -p $(samplesdir)/src/axis2c
-   cp -rf samples/* $(samplesdir)/src/axis2c
+   @:
+
+   #mkdir -p $(samplesdir)/src/axis2c
+   #cp -rf samples/* $(samplesdir)/src/axis2c
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff -ENwbur wso2-wsf-c-src-2.0.0.orig/Makefile.am wso2-wsf-c-src-2.0.0/Makefile.am
--- wso2-wsf-c-src-2.0.0.orig/Makefile.am   2015-08-21 16:33:24.775367794 -0300
+++ wso2-wsf-c-src-2.0.0/Makefile.am    2015-08-21 16:40:42.506194955 -0300
@@ -10,24 +10,28 @@
    sh dist_hook.sh

 samples:
-   sh build_samples.sh $(prefix)
-   mkdir -p  $(samplesdir)/src/wsf_c
-   cp -rf examples/* $(samplesdir)/src/wsf_c
-   cd $(samplesdir)
-   rm -rf `find $(samplesdir)/ -type d -name *.svn`
-   rm -rf `find $(samplesdir)/ -type d -name *.libs`
-   rm -rf `find $(samplesdir)/ -type d -name *.deps`
-   rm -rf `find $(samplesdir)/ -type f -name Makefile`
-   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
-   cp config/axis2.xml $(prefix)
+   @:
+   
+   #sh build_samples.sh $(prefix)
+   #mkdir -p  $(samplesdir)/src/wsf_c
+   #cp -rf examples/* $(samplesdir)/src/wsf_c
+   #cd $(samplesdir)
+   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
+   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
+   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
+   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
+   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
+   #cp config/axis2.xml $(prefix)

 install-data-hook:
-   cp -rf docs/* $(docsdir)
-   rm -rf `find $(samplesdir)/ -type d -name *.svn`
-   rm -rf `find $(samplesdir)/ -type d -name *.libs`
-   rm -rf `find $(samplesdir)/ -type d -name *.deps`
-   rm -rf `find $(samplesdir)/ -type f -name Makefile`
-   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
+   @:
+   
+   #cp -rf docs/* $(docsdir)
+   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
+   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
+   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
+   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
+   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`

 EXTRA_DIST=build_samples.sh config build.bat clean.bat docs CREDITS NOTICE examples LICENSE configure.in link_samples.sh link.sh build/build_optional.bat build/optional.mk build/init.bat build/versions.in test build/codegen

diff -ENwbur wso2-wsf-c-src-2.0.0.orig/Makefile.in wso2-wsf-c-src-2.0.0/Makefile.in
--- wso2-wsf-c-src-2.0.0.orig/Makefile.in   2015-08-21 16:33:26.042733811 -0300
+++ wso2-wsf-c-src-2.0.0/Makefile.in    2015-08-21 16:41:35.322195578 -0300
@@ -714,24 +714,28 @@
    sh dist_hook.sh

 samples:
-   sh build_samples.sh $(prefix)
-   mkdir -p  $(samplesdir)/src/wsf_c
-   cp -rf examples/* $(samplesdir)/src/wsf_c
-   cd $(samplesdir)
-   rm -rf `find $(samplesdir)/ -type d -name *.svn`
-   rm -rf `find $(samplesdir)/ -type d -name *.libs`
-   rm -rf `find $(samplesdir)/ -type d -name *.deps`
-   rm -rf `find $(samplesdir)/ -type f -name Makefile`
-   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
-   cp config/axis2.xml $(prefix)
+   @:
+   
+   #sh build_samples.sh $(prefix)
+   #mkdir -p  $(samplesdir)/src/wsf_c
+   #cp -rf examples/* $(samplesdir)/src/wsf_c
+   #cd $(samplesdir)
+   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
+   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
+   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
+   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
+   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
+   #cp config/axis2.xml $(prefix)

 install-data-hook:
-   cp -rf docs/* $(docsdir)
-   rm -rf `find $(samplesdir)/ -type d -name *.svn`
-   rm -rf `find $(samplesdir)/ -type d -name *.libs`
-   rm -rf `find $(samplesdir)/ -type d -name *.deps`
-   rm -rf `find $(samplesdir)/ -type f -name Makefile`
-   rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
+   @:  
+
+   #cp -rf docs/* $(docsdir)
+   #rm -rf `find $(samplesdir)/ -type d -name *.svn`
+   #rm -rf `find $(samplesdir)/ -type d -name *.libs`
+   #rm -rf `find $(samplesdir)/ -type d -name *.deps`
+   #rm -rf `find $(samplesdir)/ -type f -name Makefile`
+   #rm -rf `find $(samplesdir)/ -type d -name autom4te.cache`
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT: