Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] advice on makefile
@ 2008-04-10  7:52 Nigel Kukard
  2008-04-10  8:37 ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10  7:52 UTC (permalink / raw)
  To: buildroot

Hi Guys,

Could someone lend me some tips on improving my rpm.mk file, I"m not
happy to commit it yet as it looks scrappy. I've spent a few hours
looking over it and reading the gnu make manpage.

As I think another chap pointed out, Makefiles are not shell scripts,
but what is the right way then to install? I know $(INSTALL) but
makefile equiv for for i in xxxx yyy zzz?

-N
-------------- next part --------------
#############################################################
#
# rpm
#
#############################################################
RPM_VERSION:=5.0.3
RPM_SOURCE:=rpm-$(RPM_VERSION).tar.gz
RPM_SITE:=http://rpm5.org/files/rpm/rpm-5.0/
RPM_DIR:=$(BUILD_DIR)/rpm-$(RPM_VERSION)
RPM_CAT:=$(ZCAT)
RPM_BINARIES:=rpm
RPM_LIBS:=librpmio-5.0.so librpmdb-5.0.so librpm-5.0.so librpmbuild-5.0.so librpmmisc-5.0.so


$(DL_DIR)/$(RPM_SOURCE):
	$(WGET) -P $(DL_DIR) $(RPM_SITE)/$(RPM_SOURCE)

rpm-source: $(DL_DIR)/$(RPM_SOURCE)

$(RPM_DIR)/.unpacked: $(DL_DIR)/$(RPM_SOURCE)
	$(RPM_CAT) $(DL_DIR)/$(RPM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	find $(RPM_DIR) -name '*.rej' | xargs --no-run-if-empty rm
	toolchain/patch-kernel.sh $(RPM_DIR) package/rpm/ rpm\*.patch
	touch $@

		#perl -pi -e 's|#![^ ]+ |#!/bin/|' installplatform; 
$(RPM_DIR)/.configured: $(RPM_DIR)/.unpacked
	(cd $(RPM_DIR); rm -rf config.cache; \
		autoreconf; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		CFLAGS="$(CFLAGS) -I$(STAGING_DIR)/usr/include/beecrypt -I$(STAGING_DIR)/usr/include/neon" \
		LDFLAGS="-lz" \
		ac_cv_va_copy=yes \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=$(STAGING_DIR)/usr \
		--exec_prefix=$(STAGING_DIR) \
		--libdir=$(STAGING_DIR)/usr/lib \
		--includedir=$(STAGING_DIR)/usr/include \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--program-prefix= \
		--disable-build-versionscript \
		--without-selinux \
		--without-python \
		--without-perl \
		$(DISABLE_NLS) \
	)
	touch $@

$(RPM_DIR)/.built: $(RPM_DIR)/.configured
	$(MAKE1) $(TARGET_CONFIGURE_OPTS) -C $(RPM_DIR)
	touch $@

RPM_STAGING_LIBS:=$(addprefix $(STAGING_DIR)/usr/lib/,$(RPM_LIBS))
RPM_STAGING_BINARIES:=$(addprefix $(STAGING_DIR)/usr/bin/, $(addprefix $(GNU_TARGET_NAME)-,$(RPM_BINARIES)))

$(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES): $(RPM_DIR)/.built
	$(MAKE) prefix=$(STAGING_DIR) \
	    exec_prefix=$(STAGING_DIR) \
	    bindir=$(STAGING_DIR)/usr/bin \
	    sbindir=$(STAGING_DIR)/usr/sbin \
	    libexecdir=$(STAGING_DIR)/usr/lib \
	    datadir=$(STAGING_DIR)/usr/share \
	    sysconfdir=$(STAGING_DIR)/etc \
	    sharedstatedir=$(STAGING_DIR)/com \
	    localstatedir=$(STAGING_DIR)/var \
	    libdir=$(STAGING_DIR)/usr/lib \
	    includedir=$(STAGING_DIR)/usr/include \
	    infodir=$(STAGING_DIR)/usr/info \
	    mandir=$(STAGING_DIR)/usr/man \
	    -C $(RPM_DIR) install

RPM_TARGET_LIBS:=$(addprefix $(TARGET_DIR)/usr/lib/,$(RPM_LIBS))
RPM_TARGET_BINARIES:=$(addprefix $(TARGET_DIR)/usr/bin/,$(RPM_BINARIES))


$(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES): $(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES)
	mkdir -p $(TARGET_DIR)/usr/lib/rpm
	for i in $(RPM_BINARIES); do cp -pf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$i $(TARGET_DIR)/usr/bin/$$i; done
	for i in $(RPM_LIBS); do cp -pf $(STAGING_DIR)/usr/lib/$$i $(TARGET_DIR)/usr/lib/$$i; done
ifeq ($(BR2_HAVE_MANPAGES),y)
	mkdir -p $(STAGING_DIR)/usr/man/man{1,8}
	for i in gendiff; do gzip -9 < $(STAGING_DIR)/usr/man/man1/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man1/$i.1.gz; done
	for i in rpm rpmbuild rpm2cpio; do gzip -9 < $(STAGING_DIR)/usr/man/man8/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man8/$i.8.gz; done
endif

rpm: libbeecrypt libneon libpopt $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES)

rpm-clean:
	rm -f $(TARGET_DIR)/bin/rpm
	for i in $(BIN_PROGS) $(BIN2_PROGS); do rm -f $(TARGET_DIR)/usr/bin/$$i; done
	for i in $(LIBS); do rm -f $(TARGET_DIR)/usr/lib/$$i; done
	rm -rf $(TARGET_DIR)/usr/lib/rpm
	-$(MAKE) -C $(RPM_DIR) clean

rpm-dirclean:
	rm -rf $(RPM_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(BR2_PACKAGE_RPM)),y)
TARGETS+=rpm
endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/b659e3fd/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10  7:52 [Buildroot] advice on makefile Nigel Kukard
@ 2008-04-10  8:37 ` Peter Korsgaard
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-10  8:37 UTC (permalink / raw)
  To: buildroot

>>>>> "Nigel" == Nigel Kukard <nkukard@lbsd.net> writes:

Hi,

 Nigel> Hi Guys,
 Nigel> Could someone lend me some tips on improving my rpm.mk file, I"m not
 Nigel> happy to commit it yet as it looks scrappy. I've spent a few hours
 Nigel> looking over it and reading the gnu make manpage.

 Nigel> As I think another chap pointed out, Makefiles are not shell scripts,
 Nigel> but what is the right way then to install? I know $(INSTALL) but
 Nigel> makefile equiv for for i in xxxx yyy zzz?

 Nigel> -N

 Nigel> #############################################################
 Nigel> #
 Nigel> # rpm
 Nigel> #
 Nigel> #############################################################
 Nigel> RPM_VERSION:=5.0.3
 Nigel> RPM_SOURCE:=rpm-$(RPM_VERSION).tar.gz
 Nigel> RPM_SITE:=http://rpm5.org/files/rpm/rpm-5.0/
 Nigel> RPM_DIR:=$(BUILD_DIR)/rpm-$(RPM_VERSION)
 Nigel> RPM_CAT:=$(ZCAT)
 Nigel> RPM_BINARIES:=rpm
 Nigel> RPM_LIBS:=librpmio-5.0.so librpmdb-5.0.so librpm-5.0.so librpmbuild-5.0.so librpmmisc-5.0.so

You could use patsubst, E.G.:

RPM_LIBS=$(patsubst %,lib%-5.0.so,rpmio rpmdb rpm rpmbuild rpmmisc)

 Nigel> $(DL_DIR)/$(RPM_SOURCE):
 Nigel> 	$(WGET) -P $(DL_DIR) $(RPM_SITE)/$(RPM_SOURCE)

 Nigel> rpm-source: $(DL_DIR)/$(RPM_SOURCE)

 Nigel> $(RPM_DIR)/.unpacked: $(DL_DIR)/$(RPM_SOURCE)
 Nigel> 	$(RPM_CAT) $(DL_DIR)/$(RPM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
 Nigel> 	find $(RPM_DIR) -name '*.rej' | xargs --no-run-if-empty rm

What are those .rej files?

 Nigel> 	toolchain/patch-kernel.sh $(RPM_DIR) package/rpm/ rpm\*.patch
 Nigel> 	touch $@

 Nigel> 		#perl -pi -e 's|#![^ ]+ |#!/bin/|' installplatform; 

Please use sed for replacing text.

 Nigel> $(RPM_DIR)/.configured: $(RPM_DIR)/.unpacked

It looks like you need to depend on beecrypt and neon installing into
STAGING_DIR.

 Nigel> 	(cd $(RPM_DIR); rm -rf config.cache; \
 Nigel> 		autoreconf; \
 Nigel> 		$(TARGET_CONFIGURE_OPTS) \
 Nigel> 		$(TARGET_CONFIGURE_ARGS) \
 Nigel> 		CFLAGS="$(CFLAGS) -I$(STAGING_DIR)/usr/include/beecrypt -I$(STAGING_DIR)/usr/include/neon" \
 Nigel> 		LDFLAGS="-lz" \
 Nigel> 		ac_cv_va_copy=yes \
 Nigel> 		./configure \
 Nigel> 		--target=$(GNU_TARGET_NAME) \
 Nigel> 		--host=$(GNU_TARGET_NAME) \
 Nigel> 		--build=$(GNU_HOST_NAME) \
 Nigel> 		--prefix=$(STAGING_DIR)/usr \
 Nigel> 		--exec_prefix=$(STAGING_DIR) \
 Nigel> 		--libdir=$(STAGING_DIR)/usr/lib \
 Nigel> 		--includedir=$(STAGING_DIR)/usr/include \
 Nigel> 		--bindir=/usr/bin \
 Nigel> 		--sbindir=/usr/sbin \
 Nigel> 		--libexecdir=/usr/lib \
 Nigel> 		--sysconfdir=/etc \
 Nigel> 		--datadir=/usr/share \
 Nigel> 		--localstatedir=/var \
 Nigel> 		--mandir=/usr/man \
 Nigel> 		--infodir=/usr/info \

Is all of this needed? Normally you just need to set prefix=/usr and
use DESTDIR when installing into STAGING_DIR / TARGET_DIR.

 Nigel> 		--program-prefix= \
 Nigel> 		--disable-build-versionscript \
 Nigel> 		--without-selinux \
 Nigel> 		--without-python \

We have a python package. Maybe we should add something like the
DISABLE_NLS stuff for it?

 Nigel> 		--without-perl \
 Nigel> 		$(DISABLE_NLS) \
 Nigel> 	)
 Nigel> 	touch $@

 Nigel> $(RPM_DIR)/.built: $(RPM_DIR)/.configured
 Nigel> 	$(MAKE1) $(TARGET_CONFIGURE_OPTS) -C $(RPM_DIR)
 Nigel> 	touch $@

 Nigel> RPM_STAGING_LIBS:=$(addprefix $(STAGING_DIR)/usr/lib/,$(RPM_LIBS))
 Nigel> RPM_STAGING_BINARIES:=$(addprefix $(STAGING_DIR)/usr/bin/, $(addprefix $(GNU_TARGET_NAME)-,$(RPM_BINARIES)))

 Nigel> $(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES): $(RPM_DIR)/.built
 Nigel> 	$(MAKE) prefix=$(STAGING_DIR) \
 Nigel> 	    exec_prefix=$(STAGING_DIR) \
 Nigel> 	    bindir=$(STAGING_DIR)/usr/bin \
 Nigel> 	    sbindir=$(STAGING_DIR)/usr/sbin \
 Nigel> 	    libexecdir=$(STAGING_DIR)/usr/lib \
 Nigel> 	    datadir=$(STAGING_DIR)/usr/share \
 Nigel> 	    sysconfdir=$(STAGING_DIR)/etc \
 Nigel> 	    sharedstatedir=$(STAGING_DIR)/com \
 Nigel> 	    localstatedir=$(STAGING_DIR)/var \
 Nigel> 	    libdir=$(STAGING_DIR)/usr/lib \
 Nigel> 	    includedir=$(STAGING_DIR)/usr/include \
 Nigel> 	    infodir=$(STAGING_DIR)/usr/info \
 Nigel> 	    mandir=$(STAGING_DIR)/usr/man \

Is this needed? Doesn't make install support DESTDIR=$(STAGING_DIR)?
 Nigel> 	    -C $(RPM_DIR) install

 Nigel> RPM_TARGET_LIBS:=$(addprefix $(TARGET_DIR)/usr/lib/,$(RPM_LIBS))
 Nigel> RPM_TARGET_BINARIES:=$(addprefix $(TARGET_DIR)/usr/bin/,$(RPM_BINARIES))


 Nigel> $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES): $(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES)
 Nigel> 	mkdir -p $(TARGET_DIR)/usr/lib/rpm
 Nigel> 	for i in $(RPM_BINARIES); do cp -pf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$i $(TARGET_DIR)/usr/bin/$$i; done

Well, RPM_BINARIES=rpm, so if you don't forsee more programs to be
added, just drop the loop.

 Nigel> 	for i in $(RPM_LIBS); do cp -pf $(STAGING_DIR)/usr/lib/$$i $(TARGET_DIR)/usr/lib/$$i; done

cp -pf $(RPM_STAGING_LIBS) $(TARGET_DIR)/usr/lib ?

 Nigel> ifeq ($(BR2_HAVE_MANPAGES),y)
 Nigel> 	mkdir -p $(STAGING_DIR)/usr/man/man{1,8}
 Nigel> 	for i in gendiff; do gzip -9 < $(STAGING_DIR)/usr/man/man1/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man1/$i.1.gz; done
 Nigel> 	for i in rpm rpmbuild rpm2cpio; do gzip -9 < $(STAGING_DIR)/usr/man/man8/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man8/$i.8.gz; done
 Nigel> endif

 Nigel> rpm: libbeecrypt libneon libpopt $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES)

The rpm target shouldn't depend on the full installation in TARGET_DIR
of libeecrypt / libneon / libpopt, instead the configure target should
depend on those libraries installing into $(STAGING_DIR).

 Nigel> rpm-clean:
 Nigel> 	rm -f $(TARGET_DIR)/bin/rpm
 Nigel> 	for i in $(BIN_PROGS) $(BIN2_PROGS); do rm -f $(TARGET_DIR)/usr/bin/$$i; done

What are BIN_PROGS / BIN2_PROGS?

Why not simply rm -f $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES) instead?
 Nigel> 	for i in $(LIBS); do rm -f $(TARGET_DIR)/usr/lib/$$i; done
 Nigel> 	rm -rf $(TARGET_DIR)/usr/lib/rpm
 Nigel> 	-$(MAKE) -C $(RPM_DIR) clean

What about the manpages?

 Nigel> rpm-dirclean:
 Nigel> 	rm -rf $(RPM_DIR)
 Nigel> #############################################################
 Nigel> #
 Nigel> # Toplevel Makefile options
 Nigel> #
 Nigel> #############################################################
 Nigel> ifeq ($(strip $(BR2_PACKAGE_RPM)),y)
 Nigel> TARGETS+=rpm
 Nigel> endif

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
@ 2008-04-10 11:32 Nigel Kukard
  2008-04-10 11:56 ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10 11:32 UTC (permalink / raw)
  To: buildroot



>  Nigel> $(DL_DIR)/$(RPM_SOURCE):
>  Nigel> 	$(WGET) -P $(DL_DIR) $(RPM_SITE)/$(RPM_SOURCE)
> 
>  Nigel> rpm-source: $(DL_DIR)/$(RPM_SOURCE)
> 
>  Nigel> $(RPM_DIR)/.unpacked: $(DL_DIR)/$(RPM_SOURCE)
>  Nigel> 	$(RPM_CAT) $(DL_DIR)/$(RPM_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
>  Nigel> 	find $(RPM_DIR) -name '*.rej' | xargs --no-run-if-empty rm
> 
> What are those .rej files?

RPM5 v4.4.9 contained .rej files in the tar.gz, which made patch-kernel
choke.  Dirty I know ... but yea


>  Nigel> 	toolchain/patch-kernel.sh $(RPM_DIR) package/rpm/ rpm\*.patch
>  Nigel> 	touch $@
> 
>  Nigel> 		#perl -pi -e 's|#![^ ]+ |#!/bin/|' installplatform; 
> 
> Please use sed for replacing text.

Removed that line. it was hanging around from my previous cleanup ... :\


>  Nigel> $(RPM_DIR)/.configured: $(RPM_DIR)/.unpacked
> 
> It looks like you need to depend on beecrypt and neon installing into
> STAGING_DIR.

I do this later on....
rpm: libbeecrypt libneon libpopt ...

Problem is I don't want to depend on the fixed library names .... would
you suggest I depend on  $(STAGING_DIR)/usr/lib/libbeecrypt.so ... etc?



>  Nigel> 	(cd $(RPM_DIR); rm -rf config.cache; \
>  Nigel> 		autoreconf; \
>  Nigel> 		$(TARGET_CONFIGURE_OPTS) \
>  Nigel> 		$(TARGET_CONFIGURE_ARGS) \
>  Nigel> 		CFLAGS="$(CFLAGS) -I$(STAGING_DIR)/usr/include/beecrypt -I$(STAGING_DIR)/usr/include/neon" \
>  Nigel> 		LDFLAGS="-lz" \
>  Nigel> 		ac_cv_va_copy=yes \
>  Nigel> 		./configure \
>  Nigel> 		--target=$(GNU_TARGET_NAME) \
>  Nigel> 		--host=$(GNU_TARGET_NAME) \
>  Nigel> 		--build=$(GNU_HOST_NAME) \
>  Nigel> 		--prefix=$(STAGING_DIR)/usr \
>  Nigel> 		--exec_prefix=$(STAGING_DIR) \
>  Nigel> 		--libdir=$(STAGING_DIR)/usr/lib \
>  Nigel> 		--includedir=$(STAGING_DIR)/usr/include \
>  Nigel> 		--bindir=/usr/bin \
>  Nigel> 		--sbindir=/usr/sbin \
>  Nigel> 		--libexecdir=/usr/lib \
>  Nigel> 		--sysconfdir=/etc \
>  Nigel> 		--datadir=/usr/share \
>  Nigel> 		--localstatedir=/var \
>  Nigel> 		--mandir=/usr/man \
>  Nigel> 		--infodir=/usr/info \
> 
> Is all of this needed? Normally you just need to set prefix=/usr and
> use DESTDIR when installing into STAGING_DIR / TARGET_DIR.

I can try filter it out a bit, but 4.4.9 was very very picky.


>  Nigel> 		--program-prefix= \
>  Nigel> 		--disable-build-versionscript \
>  Nigel> 		--without-selinux \
>  Nigel> 		--without-python \
> 
> We have a python package. Maybe we should add something like the
> DISABLE_NLS stuff for it?

Lets get rpm in without python, then improve on the extras later :)



>  Nigel> 		--without-perl \
>  Nigel> 		$(DISABLE_NLS) \
>  Nigel> 	)
>  Nigel> 	touch $@
> 
>  Nigel> $(RPM_DIR)/.built: $(RPM_DIR)/.configured
>  Nigel> 	$(MAKE1) $(TARGET_CONFIGURE_OPTS) -C $(RPM_DIR)
>  Nigel> 	touch $@
> 
>  Nigel> RPM_STAGING_LIBS:=$(addprefix $(STAGING_DIR)/usr/lib/,$(RPM_LIBS))
>  Nigel> RPM_STAGING_BINARIES:=$(addprefix $(STAGING_DIR)/usr/bin/, $(addprefix $(GNU_TARGET_NAME)-,$(RPM_BINARIES)))
> 
>  Nigel> $(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES): $(RPM_DIR)/.built
>  Nigel> 	$(MAKE) prefix=$(STAGING_DIR) \
>  Nigel> 	    exec_prefix=$(STAGING_DIR) \
>  Nigel> 	    bindir=$(STAGING_DIR)/usr/bin \
>  Nigel> 	    sbindir=$(STAGING_DIR)/usr/sbin \
>  Nigel> 	    libexecdir=$(STAGING_DIR)/usr/lib \
>  Nigel> 	    datadir=$(STAGING_DIR)/usr/share \
>  Nigel> 	    sysconfdir=$(STAGING_DIR)/etc \
>  Nigel> 	    sharedstatedir=$(STAGING_DIR)/com \
>  Nigel> 	    localstatedir=$(STAGING_DIR)/var \
>  Nigel> 	    libdir=$(STAGING_DIR)/usr/lib \
>  Nigel> 	    includedir=$(STAGING_DIR)/usr/include \
>  Nigel> 	    infodir=$(STAGING_DIR)/usr/info \
>  Nigel> 	    mandir=$(STAGING_DIR)/usr/man \
> 
> Is this needed? Doesn't make install support DESTDIR=$(STAGING_DIR)?

4.4.9 was a nightmare ... I started from scratch, then added line by
line. I'll try 5.0.x and filter out.


>  Nigel> 	    -C $(RPM_DIR) install
> 
>  Nigel> RPM_TARGET_LIBS:=$(addprefix $(TARGET_DIR)/usr/lib/,$(RPM_LIBS))
>  Nigel> RPM_TARGET_BINARIES:=$(addprefix $(TARGET_DIR)/usr/bin/,$(RPM_BINARIES))
> 
> 
>  Nigel> $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES): $(RPM_STAGING_LIBS) $(RPM_STAGING_BINARIES)
>  Nigel> 	mkdir -p $(TARGET_DIR)/usr/lib/rpm
>  Nigel> 	for i in $(RPM_BINARIES); do cp -pf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$i $(TARGET_DIR)/usr/bin/$$i; done
> 
> Well, RPM_BINARIES=rpm, so if you don't forsee more programs to be
> added, just drop the loop.

yea ... i'm busy trying to determine if more are required


> 
>  Nigel> ifeq ($(BR2_HAVE_MANPAGES),y)
>  Nigel> 	mkdir -p $(STAGING_DIR)/usr/man/man{1,8}
>  Nigel> 	for i in gendiff; do gzip -9 < $(STAGING_DIR)/usr/man/man1/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man1/$i.1.gz; done
>  Nigel> 	for i in rpm rpmbuild rpm2cpio; do gzip -9 < $(STAGING_DIR)/usr/man/man8/$(GNU_TARGET_NAME)-$i.1 > $(TARGET_DIR)/usr/man/man8/$i.8.gz; done
>  Nigel> endif
> 
>  Nigel> rpm: libbeecrypt libneon libpopt $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES)
> 
> The rpm target shouldn't depend on the full installation in TARGET_DIR
> of libeecrypt / libneon / libpopt, instead the configure target should
> depend on those libraries installing into $(STAGING_DIR).


I looked in some other .mk's and saw they normally depend on the package
name?


>  Nigel> rpm-clean:
>  Nigel> 	rm -f $(TARGET_DIR)/bin/rpm
>  Nigel> 	for i in $(BIN_PROGS) $(BIN2_PROGS); do rm -f $(TARGET_DIR)/usr/bin/$$i; done
> 
> What are BIN_PROGS / BIN2_PROGS?

cruft left over ...


-N


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/07c8bf3e/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 11:32 Nigel Kukard
@ 2008-04-10 11:56 ` Peter Korsgaard
  2008-04-10 14:11   ` Nigel Kukard
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-10 11:56 UTC (permalink / raw)
  To: buildroot

>>>>> "Nigel" == Nigel Kukard <nkukard@lbsd.net> writes:

Hi,

 Nigel> find $(RPM_DIR) -name '*.rej' | xargs --no-run-if-empty rm
 >> 
 >> What are those .rej files?

 Nigel> RPM5 v4.4.9 contained .rej files in the tar.gz, which made patch-kernel
 Nigel> choke.  Dirty I know ... but yea

Yddrk.

 >> Please use sed for replacing text.

 Nigel> Removed that line. it was hanging around from my previous
 Nigel> cleanup ... :\

Ok.

 >> It looks like you need to depend on beecrypt and neon installing into
 >> STAGING_DIR.

 Nigel> I do this later on....
 Nigel> rpm: libbeecrypt libneon libpopt ...

 Nigel> Problem is I don't want to depend on the fixed library names
 Nigel> .... would you suggest I depend on
 Nigel> $(STAGING_DIR)/usr/lib/libbeecrypt.so ... etc?

Yes, but that breaks parallel builds. You have to tell make that it
cannot start the configure step until those other libraries are
installed into STAGING_DIR.

I know that the current approach of having to hardcode the file name
used in the library .mk isn't really nice. We should probably come up
with an agreement regarding a fixed target name / file for libraries
to clean this up. Notice that this has to be a physical file name as a
PHONY target like <package>-staging-install always will be considered
out-of-date, so the configure target will rerun everytime you run
make.

You can see the avahi package for an example.

 >> Is all of this needed? Normally you just need to set prefix=/usr and
 >> use DESTDIR when installing into STAGING_DIR / TARGET_DIR.

 Nigel> I can try filter it out a bit, but 4.4.9 was very very picky.

Ok.

 Nigel> --program-prefix= \
 Nigel> --disable-build-versionscript \
 Nigel> --without-selinux \
 Nigel> --without-python \
 >> 
 >> We have a python package. Maybe we should add something like the
 >> DISABLE_NLS stuff for it?

 Nigel> Lets get rpm in without python, then improve on the extras later :)

Ok, it was more of generic note.

 Nigel> mandir=$(STAGING_DIR)/usr/man \
 >> 
 >> Is this needed? Doesn't make install support DESTDIR=$(STAGING_DIR)?

 Nigel> 4.4.9 was a nightmare ... I started from scratch, then added line by
 Nigel> line. I'll try 5.0.x and filter out.

Ok.

 >> Well, RPM_BINARIES=rpm, so if you don't forsee more programs to be
 >> added, just drop the loop.

 Nigel> yea ... i'm busy trying to determine if more are required

Ok.

 Nigel> rpm: libbeecrypt libneon libpopt $(RPM_TARGET_LIBS) $(RPM_TARGET_BINARIES)
 >> 
 >> The rpm target shouldn't depend on the full installation in TARGET_DIR
 >> of libeecrypt / libneon / libpopt, instead the configure target should
 >> depend on those libraries installing into $(STAGING_DIR).

 Nigel> I looked in some other .mk's and saw they normally depend on
 Nigel> the package name?

Yeah, quite some packages are broken in this regard :/

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 11:56 ` Peter Korsgaard
@ 2008-04-10 14:11   ` Nigel Kukard
  2008-04-10 14:35     ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10 14:11 UTC (permalink / raw)
  To: buildroot


>  Nigel> Problem is I don't want to depend on the fixed library names
>  Nigel> .... would you suggest I depend on
>  Nigel> $(STAGING_DIR)/usr/lib/libbeecrypt.so ... etc?
> 
> Yes, but that breaks parallel builds. You have to tell make that it
> cannot start the configure step until those other libraries are
> installed into STAGING_DIR.
> 
> I know that the current approach of having to hardcode the file name
> used in the library .mk isn't really nice. We should probably come up
> with an agreement regarding a fixed target name / file for libraries
> to clean this up. Notice that this has to be a physical file name as a
> PHONY target like <package>-staging-install always will be considered
> out-of-date, so the configure target will rerun everytime you run
> make.

What is going on in libxml2.mk?  I need to add libxml as one of the
deps  :)

-N
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/5fcd2c45/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 14:11   ` Nigel Kukard
@ 2008-04-10 14:35     ` Peter Korsgaard
  2008-04-10 14:51       ` Nigel Kukard
  2008-04-10 17:28       ` Nigel Kukard
  0 siblings, 2 replies; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-10 14:35 UTC (permalink / raw)
  To: buildroot

>>>>> "Nigel" == Nigel Kukard <nkukard@lbsd.net> writes:

Hi,

 Nigel> What is going on in libxml2.mk?  I need to add libxml as one of the
 Nigel> deps  :)

That's the new autotools autotargets stuff. I don't know much about
it, but take a look at package/Makefile.autotools.in.

The problem is going to be that the automatic rules uses
$BUILD_DIR/package-<version>/.stamp_staging_installed, so you'll have
to hardcode the version and it'll break when the version is bumped.

Maybe we should rather add a .stamp_<package>_<whatever> directly in
BUILD_DIR?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 14:35     ` Peter Korsgaard
@ 2008-04-10 14:51       ` Nigel Kukard
  2008-04-12  9:25         ` Hamish Moffatt
  2008-04-10 17:28       ` Nigel Kukard
  1 sibling, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10 14:51 UTC (permalink / raw)
  To: buildroot


>  Nigel> What is going on in libxml2.mk?  I need to add libxml as one of the
>  Nigel> deps  :)
> 
> That's the new autotools autotargets stuff. I don't know much about
> it, but take a look at package/Makefile.autotools.in.
> 
> The problem is going to be that the automatic rules uses
> $BUILD_DIR/package-<version>/.stamp_staging_installed, so you'll have
> to hardcode the version and it'll break when the version is bumped.
> 
> Maybe we should rather add a .stamp_<package>_<whatever> directly in
> BUILD_DIR?

At present I nuke .root and root  in my build_xxx/uclibc dir and do a
make and everything is installed again.  Maybe its just my luck ...

If we add .stamp_xxx to the build dir ... I guess my luck will run
out ;)

I really think some kind of unification needs to be agreed apon, this
would include targets, deps ... etc. Maybe a wiki on standards,
guidelines ... etc?  from my mucking around I've seen very many ways to
do the same thing, not all the right way and most of the time the wrong
way is more commonly used.

*shrug*

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/928ae847/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 14:35     ` Peter Korsgaard
  2008-04-10 14:51       ` Nigel Kukard
@ 2008-04-10 17:28       ` Nigel Kukard
  2008-04-10 17:30         ` Nigel Kukard
  1 sibling, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10 17:28 UTC (permalink / raw)
  To: buildroot

<snip snip snip>

Regarding dependencies on other targets ... what about having something
like   $(PKGNAME_LIB_VERSION) variable?

or maybe ....  PKGNAME_LIB_NAME?   or   PKGNAME_LIB_STAGING_TARGET?

or all of them?

PKGNAME_LIB_VERSION=1.2.3
PKGNAME_LIB_NAME=libfubar.$(PKGNAME_LIB_VERSION)
PKGNAME_LIB_STAGING_TARGET=$(STAGING_DIR)/usr/lib/$(PKGNAME_LIB_NAME)

starting to look like something that should be part of autotools?

really getting frustrated ... everything is different!  :(

-N
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/b1e8b0b4/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 17:28       ` Nigel Kukard
@ 2008-04-10 17:30         ` Nigel Kukard
  2008-04-10 18:09           ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Nigel Kukard @ 2008-04-10 17:30 UTC (permalink / raw)
  To: buildroot



> <snip snip snip>
> 
> Regarding dependencies on other targets ... what about having something
> like   $(PKGNAME_LIB_VERSION) variable?
> 
> or maybe ....  PKGNAME_LIB_NAME?   or   PKGNAME_LIB_STAGING_TARGET?
> 
> or all of them?
> 
> PKGNAME_LIB_VERSION=1.2.3
> PKGNAME_LIB_NAME=libfubar.$(PKGNAME_LIB_VERSION)
> PKGNAME_LIB_STAGING_TARGET=$(STAGING_DIR)/usr/lib/$(PKGNAME_LIB_NAME)
> 
> starting to look like something that should be part of autotools?
> 
> really getting frustrated ... everything is different!  :(
> 

OMW!! ..... after looking over autotools .... I think it should rather
be improved and everything converted to autotools ... most of the stuff
is standardized then. It would just be a small task of catching some
specifics and adding a few more features...

-N
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://busybox.net/lists/buildroot/attachments/20080410/5b6d952d/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 17:30         ` Nigel Kukard
@ 2008-04-10 18:09           ` Peter Korsgaard
       [not found]             ` <1207851468.6817.498.camel@nigel-x60>
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-10 18:09 UTC (permalink / raw)
  To: buildroot

>>>>> "Nigel" == Nigel Kukard <nkukard@lbsd.net> writes:

Hi,

 Nigel> OMW!! ..... after looking over autotools .... I think it should rather
 Nigel> be improved and everything converted to autotools ... most of the stuff
 Nigel> is standardized then. It would just be a small task of catching some
 Nigel> specifics and adding a few more features...

Yes, I also think that's the best long term solution (similar to how
it's done in openwrt, openembedded, ...).

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
       [not found]             ` <1207851468.6817.498.camel@nigel-x60>
@ 2008-04-10 18:59               ` Peter Korsgaard
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-10 18:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Nigel" == Nigel Kukard <nkukard@lbsd.net> writes:

Hi,

 Nigel> OMW!! ..... after looking over autotools .... I think it should rather
 Nigel> be improved and everything converted to autotools ... most of the stuff
 Nigel> is standardized then. It would just be a small task of catching some
 Nigel> specifics and adding a few more features...
 >> 
 >> Yes, I also think that's the best long term solution (similar to how
 >> it's done in openwrt, openembedded, ...).

 Nigel> I think it needs a bit more magic though ...

;)

 Nigel> I'll convert some of the things I've done so far to beecrypt,
 Nigel> make files reduce from 100+ lines down to +- 10 ... its
 Nigel> amazing!

 Nigel> Do we have a wiki where this can be documented?  would also
 Nigel> suggest we not accept any patches with manual makefiles?
 Nigel> unless there is a very good reason autotools cannot handle it,
 Nigel> in which case autotools should be fixed not complexity added.

No, but we have docs/ ;)

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-10 14:51       ` Nigel Kukard
@ 2008-04-12  9:25         ` Hamish Moffatt
  2008-04-12 13:16           ` Peter Korsgaard
  0 siblings, 1 reply; 13+ messages in thread
From: Hamish Moffatt @ 2008-04-12  9:25 UTC (permalink / raw)
  To: buildroot

On Thu, Apr 10, 2008 at 02:51:38PM +0000, Nigel Kukard wrote:
> 
> >  Nigel> What is going on in libxml2.mk?  I need to add libxml as one of the
> >  Nigel> deps  :)
> > 
> > That's the new autotools autotargets stuff. I don't know much about
> > it, but take a look at package/Makefile.autotools.in.
> > 
> > The problem is going to be that the automatic rules uses
> > $BUILD_DIR/package-<version>/.stamp_staging_installed, so you'll have
> > to hardcode the version and it'll break when the version is bumped.
> > 
> > Maybe we should rather add a .stamp_<package>_<whatever> directly in
> > BUILD_DIR?
> 
> At present I nuke .root and root  in my build_xxx/uclibc dir and do a
> make and everything is installed again.  Maybe its just my luck ...
> 
> If we add .stamp_xxx to the build dir ... I guess my luck will run
> out ;)

Yep, that really sucks. Please, depend on files in the target dir rather
than on stamp files elsewhere. Unless you use external toolchain I think
nuking the root is already unsafe :-(


Hamish
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] advice on makefile
  2008-04-12  9:25         ` Hamish Moffatt
@ 2008-04-12 13:16           ` Peter Korsgaard
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Korsgaard @ 2008-04-12 13:16 UTC (permalink / raw)
  To: buildroot

>>>>> "Hamish" == Hamish Moffatt <hamish@cloud.net.au> writes:

Hi,

 >> If we add .stamp_xxx to the build dir ... I guess my luck will run
 >> out ;)

 Hamish> Yep, that really sucks. Please, depend on files in the target
 Hamish> dir rather than on stamp files elsewhere. Unless you use
 Hamish> external toolchain I think nuking the root is already unsafe
 Hamish> :-(

Notice this was about files in STAGING_DIR (and providing a known
filename that other packages can depend on).

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-04-12 13:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10  7:52 [Buildroot] advice on makefile Nigel Kukard
2008-04-10  8:37 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2008-04-10 11:32 Nigel Kukard
2008-04-10 11:56 ` Peter Korsgaard
2008-04-10 14:11   ` Nigel Kukard
2008-04-10 14:35     ` Peter Korsgaard
2008-04-10 14:51       ` Nigel Kukard
2008-04-12  9:25         ` Hamish Moffatt
2008-04-12 13:16           ` Peter Korsgaard
2008-04-10 17:28       ` Nigel Kukard
2008-04-10 17:30         ` Nigel Kukard
2008-04-10 18:09           ` Peter Korsgaard
     [not found]             ` <1207851468.6817.498.camel@nigel-x60>
2008-04-10 18:59               ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox