Skip to contentSkip to conversation

need help adding apache to buildroot

Buildroot New Jenkins 9 participants 28 messages Jan 16, 2013 – Sep 7, 2013 Kbuild

lore
Share & tools
lore

Jenkins

#0 lore raw

Hello. I'm adding apache httpd to my buildroot project but I'm stuck and need some help.

Here's what I've done so far:

1. created a directory buildroot/package/apache

2. created buildroot/package/apache/Config.in (see below)

3. as a starting point, downloaded the panda-buildroot apache.mk (see below) to buildroot/package/apache

4. added a line <<source "package/apache/Config.in">> to buildroot/package/Config.in under "Networking applications"

5. ran "make menuconfig", selected "apache" in "Package Selection" > "Networking applications", saved & exited

6. ran "make" and expected httpd to be built and show up in my rootfs target. It was not there.

7. ran "make apache-source" as a test, but make replies: "No rule to make target `apache-source'. Stop."

I expected make to pick up the new package, but that's clearly not happening. What am I missing?

Lee Jenkins

----- buildroot/package/apache/Config.in -----

config BR2_PACKAGE_APACHE
bool "apache"
help
Apache web server software

----- buildroot/package/apache/apache.mk -----

#############################################################
#

# apache
#
#############################################################
APACHE_VERSION    = 2.2.19
#APACHE_SITE       = http://mir2.ovh.net/ftp.apache.org/dist/httpd/
APACHE_SITE       = http://archive.apache.org/dist/httpd/
APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
APACHE_INSTALL_STAGING = YES
APACHE_INSTALL_TARGET = YES
APACHE_AUTORECONF = YES
APACHE_CONF_ENV += \
        ac_cv_file__dev_zero=yes \
        ac_cv_func_setpgrp_void=yes \
        apr_cv_tcp_nodelay_with_cork=yes \
        ac_cv_sizeof_struct_iovec=8 \
        apr_cv_process_shared_works=yes \
        apr_cv_mutex_robust_shared=no \
        ac_cv_struct_rlimit=yes \
        ap_cv_void_ptr_lt_long=no \
        CC="$(TARGET_CC)" \
        CFLAGS="$(TARGET_CFLAGS)" \
        LDFLAGS="$(TARGET_LDFLAGS)" \
APACHE_CONF_OPT += \
        --host="$(REAL_GNU_TARGET_NAME)" \
        --prefix="/apacheSW/" \
        --enable-so \
        --enable-module=all

define APACHE_CONFIGURE_CMDS

        (cd $(@D) && rm -rf config.cache; \
                $(APACHE_CONF_ENV) \
                ./configure \
                $(APACHE_CONF_OPT) \
        )

endef
define ADD_INIT_SCRIPT

$(INSTALL) -m 0755 -D $(APACHE_DIR_PREFIX)/$(APACHE_NAME)/Apache_InitScript \
        $(TARGET_DIR)/etc/init.d/S90Apache;

endef
APACHE_POST_INSTALL_STAGING_HOOKS += ADD_INIT_SCRIPT

$(eval $(call AUTOTARGETS))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130116/797f8c3a/attachment-0001.html>

#1 lore raw
Quoted 10 lines · Lee (ISS Houston)

Hello. I?m adding apache httpd to my buildroot project but I?m stuck and need some help.

Here?s what I?ve done so far:

7. ran ?make apache-source? as a test, but make replies: ?No rule
to make target `apache-source?. Stop.?

Quoted 4 lines

I expected make to pick up the new package, but that?s clearly not happening. What am I missing?

$(eval $(call AUTOTARGETS))

If you're using latest git buildroot this has changed to:

$(eval $(autotools-package))

So the package infrastructure isn't evaluating (parsing) your package at all.
Regards.

#2 lore raw

Gustavo & Thomas, thanks for the quick replies!

After a few changes to apache.mk the build started doing its thing, only to fail in mid stride.

The root problem is that the apache make process builds a binary (or maybe more than one) on the BUILD system that are then used to complete the build, but when cross-compiling, the binaries are being built for the target system instead of the build system. Ugh.

The good news is I found a patch that provides a CC_FOR_BUILD variable to fix the problem. However, the patch is not an "official" apache patch, but hosted at a different location here: http://people.apache.org/~fuankg/diffs/httpd-2.2.x-cross_compile.diff. If I'm reading the buildroot docs correctly, if I add APACHE_PATCH to apache.mk it will require the patch to be at the same URL as the tarball. Ugh.

Are the "patch hooks" simply shell commands? How egregious would it be (from a buildroot maintainer perspective) to use the patch hooks to wget the patch and apply it? :-)

Is there a simpler solution I'm not aware of?

#3 lore raw

On Thursday 17 January 2013 22:41:24 Jenkins, Lee wrote:
[...]

Quoted 11 lines

The good news is I found a patch that provides a CC_FOR_BUILD variable to fix the problem. However, the patch is not an "official" apache patch, but hosted at a different location here:
http://people.apache.org/~fuankg/diffs/httpd-2.2.x-cross_compile.diff. If I'm reading the buildroot docs correctly, if I add APACHE_PATCH to apache.mk it will require the patch to be at the same URL as the tarball. Ugh.

Are the "patch hooks" simply shell commands? How egregious would it be (from a buildroot maintainer perspective) to use the patch hooks to wget the patch and apply it? :-)

IMHO, this patch is small enough to be included in Buildroot tree.

Download manually the patch, place it in your package directory and name it RAWNAME-DESCRIPTION.patch (apache-cross-compile-fix.patch) (Exact naming rule is in packages/pkg-generic.mk:$(BUILD_DIR)/%/.stamp_patched).

Patch will be automatically applied.

Signature · 1 line
J?r?me Pouiller
#4 lore raw

Dear J?r?me Pouiller,

Quoted 13 lines · J?r?me Pouiller

On Thursday 17 January 2013 22:41:24 Jenkins, Lee wrote:
[...]

Quoted 11 lines

The good news is I found a patch that provides a CC_FOR_BUILD variable to fix the problem. However, the patch is not an "official" apache patch, but hosted at a different location here:
http://people.apache.org/~fuankg/diffs/httpd-2.2.x-cross_compile.diff. If I'm reading the buildroot docs correctly, if I add APACHE_PATCH to apache.mk it will require the patch to be at the same URL as the tarball. Ugh.

Are the "patch hooks" simply shell commands? How egregious would it be (from a buildroot maintainer perspective) to use the patch hooks to wget the patch and apply it? :-)

Quoted 7 lines

IMHO, this patch is small enough to be included in Buildroot tree.

Download manually the patch, place it in your package directory and name it RAWNAME-DESCRIPTION.patch (apache-cross-compile-fix.patch) (Exact naming rule is in packages/pkg-generic.mk:$(BUILD_DIR)/%/.stamp_patched).

Patch will be automatically applied.

Agreed, the patch seems small enough to be included in Buildroot directly.

That said, I've also found a bit strange that our package infrastructure enforces that the patches must be located on the same site, at the same location, as the original tarball. It doesn't make much sense. So we might want to change that in the future, but for this specific case, having the patch directly in Buildroot makes sense, I agree.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

---
 package/pkg-generic.mk |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +2 -2
index b0eca0a..37f3a29 100644
@@ -40,7 +40,7 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$(if $(findstring ://,$(p)),$(p),$($(PKG)_SITE)/$(p)))$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -85,7 +85,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
 	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

J?r?me, Peter, All,

Quoted 5 lines · On Friday 18 January 2013 J?r?me Pouiller wrote:

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

I've added this patch to my tree, as I need it to cleanly add new packages, and it will be included in my next pull-request.

I'll add my *-by tags at the same time.

Thank you! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

In reply to Jérôme Pouiller

J?r?me, Thomas, All,

Quoted 23 lines · On Friday 18 January 2013 J?r?me Pouiller wrote:

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

---
 package/pkg-generic.mk |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/pkg-generic.mk +1 -1
index b0eca0a..37f3a29 100644
@@ -40,7 +40,7 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$(if $(findstring ://,$(p)),$(p),$($(PKG)_SITE)/$(p)))$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)

package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) · line 91

Quoted 8 lines
package/pkg-generic.mk +1 -1
@@ -85,7 +85,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
 	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \

Hm. Not specific to the patch per-se, but:

Currently the (single) PKG_PATCH is saved to a file which name is the plain filename ("notdir") of the patch.

In case one uses a custom directory to store all downloaded files (eg. I use "${HOME}/src" so I don't have to download them again and again), this directory gets cluttered with many files that are difficult to link to the package they apply to.

It gets even worse with this change.

What about saving the patches to a file named thus:
$(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#8 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

On Wednesday 30 January 2013 20:23:58 Yann E. MORIN wrote:
[...]

Quoted 9 lines

In case one uses a custom directory to store all downloaded files (eg. I use "${HOME}/src" so I don't have to download them again and again), this directory gets cluttered with many files that are difficult to link to the package they apply to.

It gets even worse with this change.

What about saving the patches to a file named thus:

   $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patches

Sure!

Patch follows, Looks doing the job. Nevertheless, I begin to found this feature a little difficult to read (euphemism...). Someone has an opinion about coding style?

Signature · 1 line
J?r?me Pouiller
#9 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

Downloaded patches are named $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

---
 package/pkg-generic.mk |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/pkg-generic.mk +7 -2
index b0eca0a..0afa72d 100644
@@ -40,7 +40,12 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(basename $(notdir $(p)).patch)),\
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\
+		)\
+	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -85,7 +90,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
 	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

J?r?me, All,

Quoted 5 lines · On Wednesday 30 January 2013 J?r?me Pouiller wrote:

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

Downloaded patches are named $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

Well, I meant: $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME) We should keep the original filename (in case it is compresed).

Quoted 10 lines
---
 package/pkg-generic.mk |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/pkg-generic.mk +0 -0
index b0eca0a..0afa72d 100644

package/pkg-generic.mk ifeq ($(DL_MODE),DOWNLOAD) · line 45

Quoted 7 lines
package/pkg-generic.mk +3 -1
@@ -40,7 +40,12 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(basename $(notdir $(p)).patch)),\

forget 'basename', don;t add '.patch' (the file may be compressed, we shouldnot rename it or we won;t be able to apply it.

package/pkg-generic.mk ifeq ($(DL_MODE),DOWNLOAD) · line 46

Quoted 1 line
package/pkg-generic.mk +1 -0
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\

The naming should also be applied for the 'plain-file' case, too.

package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) · line 93

Quoted 11 lines
package/pkg-generic.mk +3 -1
+		)\
+	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -85,7 +90,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))

Make that consistent with the above, please.

Also, here you're doing two indepndent changes:
- change the downloaded file names
- allow plain URLs

This should be two different patches (multiple URLs first, I'd suggest).

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

Quoted 11 lines · On Wednesday 30 January 2013 23:54:23 Yann E. MORIN wrote:

J?r?me, All,

Quoted 6 lines · On Wednesday 30 January 2013 J?r?me Pouiller wrote:

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

Downloaded patches are named $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

Well, I meant: $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME) We should keep the original filename (in case it is compresed).

In this case, I think files ending with .diff will not work (and compressed patches are not supported without a HOOK).

[...]

Quoted 3 lines

package/pkg-generic.mk ifeq ($(DL_MODE),DOWNLOAD) · line 46

Quoted 1 line
package/pkg-generic.mk +1 -0
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\

The naming should also be applied for the 'plain-file' case, too.

Sure.

[...]

Signature · 1 line
J?r?me Pouiller
#12 lore raw

PATCH 1/2 Add support for plain URL in $(PKG)_PATCH variable

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

---
 package/pkg-generic.mk |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/pkg-generic.mk +7 -2
index b0eca0a..fbc2bb9 100644
@@ -40,7 +40,12 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p)),\
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\
+		)\
+	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -85,7 +90,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
 	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 2/2 Add $(PKG_NAME) in name of downloaded patches

Until now, patch was downloaded without be renamed. $(DL_DIR) quickly become a mess. Downloaded patches are now named $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).

---
 package/pkg-generic.mk |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
package/pkg-generic.mk +4 -3
index fbc2bb9..f2bf40a 100644
@@ -42,8 +42,8 @@ endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
 	$(foreach p,$($(PKG)_PATCH),\
 		$(if $(findstring ://,$(p)),\
-			$(call DOWNLOAD,$(p)),\
-			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\
+			$(call DOWNLOAD,$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p))),\
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p)))\
 		)\
 	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
@@ -90,7 +90,8 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+	  support/scripts/apply-patches.sh $(@D) $(DL_DIR) $($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p))$(sep))
 	$(Q)( \
 	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
 	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 1 line
1.7.9.5
#14 lore raw

PATCH 2/2 Add $(PKG_NAME) in name of downloaded patches

Quoted 2 lines · J?r?me Pouiller

Until now, patch was downloaded without be renamed. $(DL_DIR) quickly become a mess.

Not really... There is just a chance that the patch isn't named
according to the package name, which could lead to conflicts between patch names. But currently there is not a single patch for which the patch name differs from the archive name.

Quoted 2 lines

Downloaded patches are now named
$(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).

How about adding a new function, CLEAN_DOWNLOAD_NAME, that does

$($(PKG)_NAME)-$($(PKG)_VERSION)-$(patsubst \
$($(PKG)_VERSION)-%,%,$(patsubst $($(PKG)_NAME)-%,%,$(1)))

so that the names don't get too long in the usual case?

The same could also be applied to the package archives.

But really I think it's making things more complex without being
necessary in practice. I don't expect this situation of conflicting names is likely to occur.

Regards,
Arnout

Quoted 32 lines
---
  package/pkg-generic.mk |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
package/pkg-generic.mk +4 -3
index fbc2bb9..f2bf40a 100644
@@ -42,8 +42,8 @@ endif
  	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
  	$(foreach p,$($(PKG)_PATCH),\
  		$(if $(findstring ://,$(p)),\
-			$(call DOWNLOAD,$(p)),\
-			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\
+			$(call DOWNLOAD,$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p))),\
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p),$($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p)))\
  		)\
  	$(sep))
  	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
@@ -90,7 +90,8 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
  $(BUILD_DIR)/%/.stamp_patched:
  	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
  	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+	  support/scripts/apply-patches.sh $(@D) $(DL_DIR) $($(PKG)_NAME)-$($(PKG)_VERSION)-$(notdir $(p))$(sep))
  	$(Q)( \
  	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
  	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#15 lore raw

PATCH v2 1/1 Add support for plain URL in $(PKG)_PATCH variable

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

---
v2:
- Rebase to apply to HEAD
- Drop patch called "Add $(PKG_NAME) in name of downloaded patches" since I am not personally convinced of its usefulness

---
 package/pkg-generic.mk |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/pkg-generic.mk +7 -2
index d25797c..db34c13 100644
@@ -40,7 +40,12 @@ ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p)),\
+			$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))\
+		)\
+	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -86,7 +91,7 @@ $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	for D in $(PATCH_BASE_DIRS); do \
 	  if test -d $${D}; then \
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH v2 1/1 Add support for plain URL in $(PKG)_PATCH variable

J?r?me, All,

On 2013-05-13 17:51 +0200, J?r?me Pouiller spake thusly:

Quoted 5 lines

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#17 lore raw

PATCH v2 1/1 Add support for plain URL in $(PKG)_PATCH variable

Quoted 11 lines · Yann E. MORIN

J?r?me, All,

On 2013-05-13 17:51 +0200, J?r?me Pouiller spake thusly:

Quoted 5 lines

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

The patch looks good to me.

--
Regards,
Markos Chandras

#18 lore raw

PATCH v2 1/1 Add support for plain URL in $(PKG)_PATCH variable

In reply to Jérôme Pouiller
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"J?r?me" == J?r?me Pouiller <[email protected]> writes:

J?r?me> Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. J?r?me> This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly J?r?me> handle them.

J?r?me> Signed-off-by: J?r?me Pouiller <[email protected]>

J?r?me> ---
J?r?me> v2:
J?r?me> - Rebase to apply to HEAD
J?r?me> - Drop patch called "Add $(PKG_NAME) in name of downloaded patches" since I am
J?r?me> not personally convinced of its usefulness

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#19 lore raw

PATCH 1/2 Add support for plain URL in $(PKG)_PATCH variable

In reply to Jérôme Pouiller
Quoted 5 lines · J?r?me Pouiller

Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

(untested but it's pretty obvious that the current packages won't break).

Quoted 9 lines
---
  package/pkg-generic.mk |    9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
package/pkg-generic.mk +0 -0
index b0eca0a..fbc2bb9 100644

package/pkg-generic.mk ifeq ($(DL_MODE),DOWNLOAD) · line 46

Quoted 8 lines
package/pkg-generic.mk +4 -1
@@ -40,7 +40,12 @@ ifeq ($(DL_MODE),DOWNLOAD)
  	fi
  endif
  	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p)),\
+			$(call DOWNLOAD,$($(PKG)_SITE)/$(p))\

I would have put the condition inside the DOWNLOAD call, even though
that's a bit less efficient. But I guess it's just a matter of taste.

Regards,
Arnout

Quoted 15 lines
package/pkg-generic.mk +3 -1
+		)\
+	$(sep))
  	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
  ifeq ($(DL_MODE),DOWNLOAD)
  	$(Q)mkdir -p $(@D)
@@ -85,7 +90,7 @@ $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
  $(BUILD_DIR)/%/.stamp_patched:
  	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
  	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
  	$(Q)( \
  	if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \
  	  if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#20 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

In reply to Jérôme Pouiller
Quoted 9 lines · On Thursday 31 January 2013 00:11:08 J?r?me Pouiller wrote:
Quoted 8 lines · On Wednesday 30 January 2013 23:54:23 Yann E. MORIN wrote:

J?r?me, All,

Quoted 5 lines · On Wednesday 30 January 2013 J?r?me Pouiller wrote:

Until now, $(PKG)_PATCH allow only to download patches from same URL than
tarball. This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly handle them.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Downloaded patches are named $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

Well, I meant: $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME) We should keep the original filename (in case it is compresed).

In this case, I think files ending with .diff will not work (and compressed patches are not supported without a HOOK).

Forget this comment, I was tired.

Signature · 3 lines
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr
#21 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

In case one uses a custom directory to store all downloaded files (eg. I use "${HOME}/src" so I don't have to download them again and again), this directory gets cluttered with many files that are difficult to link to the package they apply to.

It gets even worse with this change.

What about saving the patches to a file named thus:

   $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

I am not sure because we don't do this for tarballs: we keep their original name. For example Python-3.3.0 even though the package is named python3, cJSONFiles.zip even though the package is named cjson, etc.

So either we decide to keep the original name for everything, or we decide to use our own name for everything.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#22 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

Thomas, All,

Quoted 13 lines · On Wednesday 30 January 2013 Thomas Petazzoni wrote:

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

In case one uses a custom directory to store all downloaded files (eg. I use "${HOME}/src" so I don't have to download them again and again), this directory gets cluttered with many files that are difficult to link to the package they apply to.

It gets even worse with this change.

What about saving the patches to a file named thus:

   $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch
Quoted 7 lines

I am not sure because we don't do this for tarballs: we keep their original name. For example Python-3.3.0 even though the package is named python3, cJSONFiles.zip even though the package is named cjson, etc.

So either we decide to keep the original name for everything, or we decide to use our own name for everything.

So, given two packages, 'foo' and 'bar', what will happen if both have a patch file named 'mktemp.patch' ?

1- only one will be downloaded
2- it will be applied onto both packages

Err... :-(

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#23 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

Quoted 1 line · On Wednesday 30 January 2013 23:57:13 Yann E. MORIN wrote:

On Wednesday 30 January 2013 Thomas Petazzoni wrote:

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

What about saving the patches to a file named thus:

   $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME).patch

I am not sure because we don't do this for tarballs: we keep their original name. For example Python-3.3.0 even though the package is named python3, cJSONFiles.zip even though the package is named cjson, etc.

Quoted 8 lines
Quoted 2 lines

So either we decide to keep the original name for everything, or we decide to use our own name for everything.

So, given two packages, 'foo' and 'bar', what will happen if both have a patch file named 'mktemp.patch' ?

1- only one will be downloaded
2- it will be applied onto both packages

And what about
$(PKG_NAME)-$(PKG_VERSION)/$(PKG_PATCH_FILENAME).patch
?

Signature · 1 line
J?r?me Pouiller
#24 lore raw

PATCH 1/1 Add support for plain URL in $(PKG)_PATCH variable

J?r?me, All,

Quoted 8 lines · On Thursday 31 January 2013 J?r?me Pouiller wrote:
Quoted 5 lines · On Wednesday 30 January 2013 23:57:13 Yann E. MORIN wrote:

So, given two packages, 'foo' and 'bar', what will happen if both have a patch file named 'mktemp.patch' ?

1- only one will be downloaded
2- it will be applied onto both packages

And what about
$(PKG_NAME)-$(PKG_VERSION)/$(PKG_PATCH_FILENAME).patch

No, we have to keep the patch filename as-is, or apply-patches.sh will not know it has to uncompress it. So, do not append '.patch' .

Besides, we do not want to create sub-dirs in the DL dir (which can be a custom dir, as it is in my case).

So, my proposal still stands: ;-)

    $(PKG_NAME)-$(PKG_VERSION)-$(PKG_PATCH_FILENAME)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#25 lore raw
In reply to Jenkins

Dear Jenkins, Lee (ISS Houston),

Quoted 2 lines · Lee (ISS Houston)

I expected make to pick up the new package, but that's clearly not happening. What am I missing?

Gustavo gave the explanation for this.

I'm however going to add a few more comments below, as I hope you'll be submitting this package to Buildroot once it works.

Quoted 6 lines

----- buildroot/package/apache/Config.in -----

config BR2_PACKAGE_APACHE
bool "apache"
help
Apache web server software

You should add the upstream URL of the project here, separated from the main description by an empty newline. (See how other packages do it).

Quoted 9 lines

----- buildroot/package/apache/apache.mk -----

#############################################################
#

# apache
#
#############################################################
APACHE_VERSION    = 2.2.19

We usually put an empty new line between the header and the first variable declaration.

Quoted 1 line

#APACHE_SITE = http://mir2.ovh.net/ftp.apache.org/dist/httpd/

Please remove unneeded comments if you want to submit this package to Buildroot.

Quoted 4 lines

APACHE_SITE = http://archive.apache.org/dist/httpd/
APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
APACHE_INSTALL_STAGING = YES
APACHE_INSTALL_TARGET = YES

This line is not needed, as it is the default.

Quoted 1 line

APACHE_AUTORECONF = YES

This is generally not needed, as releases shipped as tarballs usually have the configure script and the Makefile.in pre-generated. So there should be a comment above this line that explains why it is needed.

Quoted 13 lines
APACHE_CONF_ENV += \
        ac_cv_file__dev_zero=yes \
        ac_cv_func_setpgrp_void=yes \
        apr_cv_tcp_nodelay_with_cork=yes \
        ac_cv_sizeof_struct_iovec=8 \
        apr_cv_process_shared_works=yes \
        apr_cv_mutex_robust_shared=no \
        ac_cv_struct_rlimit=yes \
        ap_cv_void_ptr_lt_long=no \
        CC="$(TARGET_CC)" \
        CFLAGS="$(TARGET_CFLAGS)" \
        LDFLAGS="$(TARGET_LDFLAGS)" \

The CC, CFLAGS and LDFLAGS are not needed here, they are already passed by the Buildroot autotools infrastructure.

Quoted 2 lines
APACHE_CONF_OPT += \
        --host="$(REAL_GNU_TARGET_NAME)" \

--host is already passed by Buildroot.

Quoted 1 line
        --prefix="/apacheSW/" \

--prefix is already passed by Buildroot (and /apacheSW/ is not a standard and appropriate location).

Quoted 7 lines
        --enable-so \
        --enable-module=all

Please remove useless empty lines.

Quoted 7 lines

define APACHE_CONFIGURE_CMDS

        (cd $(@D) && rm -rf config.cache; \
                $(APACHE_CONF_ENV) \
                ./configure \
                $(APACHE_CONF_OPT) \
        )

endef

This is not needed, Buildroot already has a default <pkg>_CONFIGURE_CMDS for autotools packages that does the right thing. If it doesn't then please add a comment above that explains why we need to override the CONFIGURE_CMDS.

Quoted 4 lines

define ADD_INIT_SCRIPT

	$(INSTALL) -m 0755 -D $(APACHE_DIR_PREFIX)/$(APACHE_NAME)/Apache_InitScript $(TARGET_DIR)/etc/init.d/S90Apache;

endef
APACHE_POST_INSTALL_STAGING_HOOKS += ADD_INIT_SCRIPT

You should use APACHE_INSTALL_INIT_SYSV to install an init script. See package/lighttpd/lighttpd.mk for an example. Also, please name your script S90apache in package/apache/. So in the end, it should look like:

define APACHE_INSTALL_INIT_SYSV

	[ -f $(TARGET_DIR)/etc/init.d/S50apache ] || \
		$(INSTALL) -D -m 755 package/apache/S50apache \
			$(TARGET_DIR)/etc/init.d/S50apache

endef

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#26 lore raw
In reply to Jenkins

Am 16.01.2013 22:30, schrieb Jenkins, Lee (ISS Houston):

Quoted 4 lines

Hello. I'm adding apache httpd to my buildroot project but I'm stuck and need some help.

Hello Lee,

did you finally manage to build apache? If yes, could you provide a patch?

Kind Regards

Stephan

Quoted 170 lines

Here's what I've done so far:

1. created a directory buildroot/package/apache

2. created buildroot/package/apache/Config.in (see below)

3. as a starting point, downloaded the panda-buildroot apache.mk
(see below) to buildroot/package/apache

4. added a line <<source "package/apache/Config.in">> to
buildroot/package/Config.in under "Networking applications"

5. ran "make menuconfig", selected "apache" in "Package
Selection" > "Networking applications", saved & exited

6. ran "make" and expected httpd to be built and show up in my
rootfs target. It was not there.

7. ran "make apache-source" as a test, but make replies: "No
rule to make target `apache-source'. Stop."

I expected make to pick up the new package, but that's clearly not happening. What am I missing?

Lee Jenkins

----- buildroot/package/apache/Config.in -----

config BR2_PACKAGE_APACHE

bool "apache"

help

Apache web server software

----- buildroot/package/apache/apache.mk -----

#############################################################

#

# apache

#

#############################################################

APACHE_VERSION = 2.2.19

#APACHE_SITE = http://mir2.ovh.net/ftp.apache.org/dist/httpd/

APACHE_SITE = http://archive.apache.org/dist/httpd/

APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2

APACHE_INSTALL_STAGING = YES

APACHE_INSTALL_TARGET = YES

APACHE_AUTORECONF = YES

APACHE_CONF_ENV += \

        ac_cv_file__dev_zero=yes \

        ac_cv_func_setpgrp_void=yes \

        apr_cv_tcp_nodelay_with_cork=yes \

        ac_cv_sizeof_struct_iovec=8 \

        apr_cv_process_shared_works=yes \

        apr_cv_mutex_robust_shared=no \

        ac_cv_struct_rlimit=yes \

        ap_cv_void_ptr_lt_long=no \

        CC="$(TARGET_CC)" \

        CFLAGS="$(TARGET_CFLAGS)" \

        LDFLAGS="$(TARGET_LDFLAGS)" \

APACHE_CONF_OPT += \

        --host="$(REAL_GNU_TARGET_NAME)" \

        --prefix="/apacheSW/" \

        --enable-so \

        --enable-module=all

define APACHE_CONFIGURE_CMDS

        (cd $(@D) && rm -rf config.cache; \

                $(APACHE_CONF_ENV) \

                ./configure \

                $(APACHE_CONF_OPT) \

        )

endef

define ADD_INIT_SCRIPT

$(INSTALL) -m 0755 -D $(APACHE_DIR_PREFIX)/$(APACHE_NAME)/Apache_InitScript \

        $(TARGET_DIR)/etc/init.d/S90Apache;

endef

APACHE_POST_INSTALL_STAGING_HOOKS += ADD_INIT_SCRIPT

$(eval $(call AUTOTARGETS))

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130707/614c5484/attachment-0001.html>

#27 lore raw
Quoted 7 lines · Stephan Hoffmann

Hello Lee,

did you finally manage to build apache? If yes, could you provide a patch?

Kind Regards

Stephan

Stephan,

I did. It's a bit of a hack. Understatement, let me try again. It's a huge hack.

Some parts of buildroot are still pretty opaque to me and unfortunately I don't really have to the time to figure out how to make a proper patch.

I also had trouble with the patch command not recursing sub-directories. The diff file appeared to have the proper paths, but I'm obviously missing something.

Anyway, what I have works, but it clearly needs cleaning up before adding to buildroot and I just don't have the time to do it.

If anyone cares to try, I've included the makefile, Config, and startup script, plus the original patch/diff file and the break-out files that are called out in apache.mk.

Hopefully someone else with a little more expertise with buildroot and patch can clean these up for everyone else's benefit.

grace & peace,
Lee Jenkins

==========[ apache.mk ]==========

#############################################################
#

# apache
#
#############################################################

APACHE_VERSION = 2.2.23
APACHE_SITE = http://archive.apache.org/dist/httpd/
APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
APACHE_INSTALL_STAGING = YES
APACHE_PACKAGE_DIR=$(@D)/../../../package/apache

APACHE_CONF_ENV += \
        ac_cv_file__dev_zero=yes \
        ac_cv_func_setpgrp_void=yes \
        apr_cv_tcp_nodelay_with_cork=yes \
        ac_cv_sizeof_struct_iovec=8 \
        apr_cv_process_shared_works=yes \
        apr_cv_mutex_robust_shared=no \
        ac_cv_struct_rlimit=yes \
        ap_cv_void_ptr_lt_long=no \
        CC=/opt/Marvell_toolchain_201201/armv7-marvell-linux-gnueabi-softfp_i686/bin/arm-marvell-linux-gnueabi-gcc
APACHE_CONF_OPT += \
        --build=i686-pc-linux-gnu \
        --host=arm-marvell-linux-gnueabi \
        --enable-so \
        --enable-module=all
# the stock apache package provides two cross-compile options --host and
# --build that get passed into configure to allow make to distinguish between
# the build machine and the target machine, but they don't work as advertised.
#      http://www.devshed.com/c/a/Apache/Building-Apache-the-Way-You-Want-It/10/
# luckily, I found a patch that allows apache to be built using an additional
# variable CC_FOR_BUILD that fixes this problem. the patch was downloaded from
#      http://people.apache.org/~fuankg/diffs/httpd-2.2.x-cross_compile.diff
# strangely, the patch utility on my build machine would not apply patches
# to files in sub-directories. therefore I've divided the patch diff into
# parts for each directory and applied the patches separately.
# also, I tried using the patch hooks, but it appears that X_PRE_PATCH_HOOKS
# is only executing if X_PATCH is defined -- and X_PATCH requires the patch
# to be located at X_SITE and this patch is not located at the same site
# as the apache package. ugh. so the files get patched as the first step in
# the configure process below.

define APACHE_CONFIGURE_CMDS

    ( cd $(@D); ./buildconf )
        ( cd $(@D); patch -i $(APACHE_PACKAGE_DIR)/httpd-2.2.x-cross_compile-apache-root.diff )
        ( cd $(@D)/server; patch -i $(APACHE_PACKAGE_DIR)/httpd-2.2.x-cross_compile-apache-root-server.diff )
        ( cd $(@D)/srclib/pcre; patch -i $(APACHE_PACKAGE_DIR)/httpd-2.2.x-cross_compile-apache-root-srclib-pcre.diff )
        ( cd $(@D) && rm -rf config.cache; \
    $(APACHE_CONF_ENV) \
    ./configure \
    $(APACHE_CONF_OPT) \
    )

endef

APACHE_MAKE_ENV += \
    CC_FOR_BUILD=cc \
    CFLAGS_FOR_BUILD=

define APACHE_INSTALL_INIT_SCRIPT

    $(INSTALL) -m 0755 package/apache/S50apache $(TARGET_DIR)/etc/init.d/S50apache

endef

APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_INSTALL_INIT_SCRIPT

$(eval $(call AUTOTARGETS,package,apache))

==========[ Config.in ]==========

config BR2_PACKAGE_APACHE
bool "apache"
help
Apache web server software.

http://httpd.apache.org/

==========[ S50apache ]==========

#!/bin/sh
#
# Start the network....
#

APACHE_DIR=/usr/local/apache2/bin

case "$1" in
start)
echo "Starting apache web server..."
$APACHE_DIR/apachectl -k start
;;
stop)
echo -n "Stopping apache web server..."
$APACHE_DIR/apachectl -k stop
;;
restart|reload)
$APACHE_DIR/apachectl -k stop
$APACHE_DIR/apachectl -k start
;;
*)

    echo $"Usage: $0 {start|stop|restart}"
    exit 1

esac

exit $?

==========[ httpd-2.2.x-cross_compile-apache-root.diff ]==========

configure.in (working copy) renamed from configure.in (revision 1328718) +0 -0
Index: configure.in
===================================================================
@@ -154,6 +154,14 @@

AC_PROG_CC
AC_PROG_CPP
+dnl In case of cross compilation we set CC_FOR_BUILD to cc unless +dnl we got already CC_FOR_BUILD from environment.
+if test "x${build_alias}" != "x${host_alias}"; then
+ if test "x${CC_FOR_BUILD}" = "x"; then
+ CC_FOR_BUILD=cc
+ fi
+fi
+
if test "x${cache_file}" = "x/dev/null"; then
# Likewise, ensure that CC and CPP are passed through to the pcre

   # configure script iff caching is disabled (the autoconf 2.5x default).
Index: acinclude.m4
===================================================================
--- acinclude.m4    (revision 1328718)
+++ acinclude.m4    (working copy)
@@ -53,6 +53,8 @@
   APACHE_SUBST(CPPFLAGS)
   APACHE_SUBST(CFLAGS)
   APACHE_SUBST(CXXFLAGS)
+  APACHE_SUBST(CC_FOR_BUILD)
+  APACHE_SUBST(CFLAGS_FOR_BUILD)
   APACHE_SUBST(LTFLAGS)
   APACHE_SUBST(LDFLAGS)
   APACHE_SUBST(LT_LDFLAGS)
@@ -568,7 +570,7 @@
{
     return sizeof(void *) < sizeof(long);
 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
-    [ap_cv_void_ptr_lt_long=yes])])
+    [ap_cv_void_ptr_lt_long="cross compile - not checked"])])
 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
     AC_MSG_ERROR([Size of "void *" is less than size of "long"])

==========[ httpd-2.2.x-cross_compile-apache-root-server.diff ]==========

Makefile.in (working copy) renamed from Makefile.in (revision 1328718) +0 -0
Index: server/Makefile.in
===================================================================
@@ -21,9 +21,14 @@

include $(top_builddir)/build/rules.mk
include $(top_srcdir)/build/library.mk
+ifdef CC_FOR_BUILD
+gen_test_char: gen_test_char.c
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $<
+else
gen_test_char_OBJECTS = gen_test_char.lo
gen_test_char: $(gen_test_char_OBJECTS)

    $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS)

+endif
test_char.h: gen_test_char
./gen_test_char > test_char.h

==========[ httpd-2.2.x-cross_compile.diff ]==========

pcre/Makefile.in (working copy) renamed from pcre/Makefile.in (revision 1328718) +4 -0
Index: srclib/pcre/Makefile.in
===================================================================
@@ -11,8 +11,13 @@
 $(LTLIBRARY_OBJECTS) dftables.lo: config.h
+ifdef CC_FOR_BUILD
+dftables: dftables.c
+   $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
+else

dftables: dftables.lo

    $(LINK) $(EXTRA_LDFLAGS) dftables.lo $(EXTRA_LIBS)
+endif
 $(srcdir)/chartables.c: dftables
    ./dftables $@

==========[ httpd-2.2.x-cross_compile-apache-root-srclib-pcre.diff ]==========

Makefile.in (working copy) renamed from Makefile.in (revision 1328718) +0 -0
Index: server/Makefile.in
===================================================================
@@ -21,9 +21,14 @@

include $(top_builddir)/build/rules.mk
include $(top_srcdir)/build/library.mk
+ifdef CC_FOR_BUILD
+gen_test_char: gen_test_char.c
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $<
+else
gen_test_char_OBJECTS = gen_test_char.lo
gen_test_char: $(gen_test_char_OBJECTS)

    $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS)

+endif
test_char.h: gen_test_char
./gen_test_char > test_char.h

pcre/Makefile.in (working copy) renamed from pcre/Makefile.in (revision 1328718) +4 -0
Index: srclib/pcre/Makefile.in
===================================================================
@@ -11,8 +11,13 @@
 $(LTLIBRARY_OBJECTS) dftables.lo: config.h
+ifdef CC_FOR_BUILD
+dftables: dftables.c
+   $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $<
+else

dftables: dftables.lo

    $(LINK) $(EXTRA_LDFLAGS) dftables.lo $(EXTRA_LIBS)
+endif
 $(srcdir)/chartables.c: dftables
    ./dftables $@
configure.in (working copy) renamed from configure.in (revision 1328718) +0 -0
Index: configure.in
===================================================================
@@ -154,6 +154,14 @@

AC_PROG_CC
AC_PROG_CPP
+dnl In case of cross compilation we set CC_FOR_BUILD to cc unless +dnl we got already CC_FOR_BUILD from environment.
+if test "x${build_alias}" != "x${host_alias}"; then
+ if test "x${CC_FOR_BUILD}" = "x"; then
+ CC_FOR_BUILD=cc
+ fi
+fi
+
if test "x${cache_file}" = "x/dev/null"; then
# Likewise, ensure that CC and CPP are passed through to the pcre

   # configure script iff caching is disabled (the autoconf 2.5x default).
Index: acinclude.m4
===================================================================
--- acinclude.m4    (revision 1328718)
+++ acinclude.m4    (working copy)
@@ -53,6 +53,8 @@
   APACHE_SUBST(CPPFLAGS)
   APACHE_SUBST(CFLAGS)
   APACHE_SUBST(CXXFLAGS)
+  APACHE_SUBST(CC_FOR_BUILD)
+  APACHE_SUBST(CFLAGS_FOR_BUILD)
   APACHE_SUBST(LTFLAGS)
   APACHE_SUBST(LDFLAGS)
   APACHE_SUBST(LT_LDFLAGS)
@@ -568,7 +570,7 @@
{
     return sizeof(void *) < sizeof(long);
 }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes],
-    [ap_cv_void_ptr_lt_long=yes])])
+    [ap_cv_void_ptr_lt_long="cross compile - not checked"])])
 if test "$ap_cv_void_ptr_lt_long" = "yes"; then
     AC_MSG_ERROR([Size of "void *" is less than size of "long"])

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130718/b1ff1e0b/attachment-0001.html>