[quagga-dev 3119] tips or guide needed howto wite a complex buildroot makefile

Claus Klein claus.klein at arcormail.de
Tue Apr 5 18:47:38 BST 2005


Hi,

while providing a buildroot makefile for the ospf router package quagga I run into
some problems:

1.) quagga needs netsnmp, and netsnmp needs openssl libs and headers installed.

2.) how to prevent that the host libs and headers are found and used while configure?

3.) how and what should be installed?
     * It seems, that the libs, the headers and the -config script should be installed to 
        the $(STAGING_DIR).
     * But we need the libs too installed to the $(TARGET_DIR).
     * Sure, we need the applications, the config files and the init scripts installed to the $(TARGET_DIR).
     * And, all binaries should be striped, but not with 'install -s' like many makefiles do!
     * But for an embedded system, we normally do not need the man, info or header files?

The buildroot docu 'Extending Buildroot with more software' is good, but only for simple packages.

So I looked into some package makefiles: zlib, netsnmp, openssl, and openssh.

For me, it seems that there is no general rule or strategy?

Is there any good idea or guide to solve these little problems while working on a new package?

Claus


see too:
 http://buildroot.uclibc.org/buildroot.html#add_software
 http://www.superhlinux.com/user_guide/getting_started/autoconf_cross_compile.php3
 http://www.lnx-bbc.org/garchitecture.html
 http://bugs.uclibc.org/view.php?id=149
-------------- next part --------------
#############################################################
#
# quagga
#
#############################################################

QUAGGA_URL:=http://www.quagga.net/download/
QUAGGA_DIR:=$(BUILD_DIR)/quagga-0.98.2
QUAGGA_SOURCE:=quagga-0.98.2.tar.gz
QUAGGA_PATCH1:=quagga_0.98.2-1.diff.gz
QUAGGA_PATCH1_URL:=http://ftp.debian.org/debian/pool/main/q/quagga/

$(DL_DIR)/$(QUAGGA_SOURCE):
	$(WGET) -P $(DL_DIR) $(QUAGGA_URL)/$(QUAGGA_SOURCE)

$(DL_DIR)/$(QUAGGA_PATCH1):
	$(WGET) -P $(DL_DIR) $(QUAGGA_PATCH1_URL)/$(QUAGGA_PATCH1)

$(QUAGGA_DIR)/.unpacked: $(DL_DIR)/$(QUAGGA_SOURCE) $(DL_DIR)/$(QUAGGA_PATCH1)
	zcat $(DL_DIR)/$(QUAGGA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
	### zcat $(DL_DIR)/$(QUAGGA_PATCH1) | patch -p1 -d $(QUAGGA_DIR)
	zcat $(DL_DIR)/$(QUAGGA_PATCH1) | sed -e '39,49d' | patch -p1 -d $(QUAGGA_DIR)
	toolchain/patch-kernel.sh $(QUAGGA_DIR) package/quagga quagga\*.patch
	touch  $(QUAGGA_DIR)/.unpacked

###FIXME### check if this realy necessary if we use smux interface!
$(STAGING_DIR)/bin/net-snmp-config: $(TARGET_DIR)/usr/bin/net-snmp-config
	cp $< $@

$(QUAGGA_DIR)/.configured: $(QUAGGA_DIR)/.unpacked $(STAGING_DIR)/bin/net-snmp-config
	(cd $(QUAGGA_DIR); autoconf; \
		PATH=$(TARGET_PATH) \
		LDFLAGS="-L$(TARGET_DIR)/lib -L$(TARGET_DIR)/usr/lib" \
		./configure \
		--with-cc=$(TARGET_CROSS)gcc \
		--with-ar=$(TARGET_CROSS)ar \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
	\
 --disable-ripd --disable-ripngd --disable-bgpd --disable-bgp-announce \
 --disable-ospf6d --disable-ipv6 \
 --enable-snmp \
 --sysconfdir=/etc/quagga \
 --includedir=/include/quagga \
 --cache-file=config.cache \
 --with-net-snmp-exec-prefix=$(STAGING_DIR) --with-net-snmp-config-prefix=$(TARGET_DIR)/usr \
	\
		--enable-shared \
		--disable-static \
		--prefix=/usr \
		--mandir=/usr/man \
		--infodir=/usr/info \
		--disable-manuals \
	\
	);
	touch  $(QUAGGA_DIR)/.configured
#
###tbd### Optional Features:
#
#  --with-libpam           use libpam for PAM support in vtysh
#  --enable-ospf-te        enable Traffic Engineering Extension to OSPF
#  --enable-netlink        force to use Linux netlink interface
#  --enable-pkgsrcrcdir    specify directory for rc.d scripts
#

$(QUAGGA_DIR)/zebra/zebra: $(QUAGGA_DIR)/.configured
	PATH=$(TARGET_PATH) \
	$(MAKE) -C $(QUAGGA_DIR)

$(TARGET_DIR)/usr/sbin/ospfd: $(TARGET_DIR)/usr/sbin/zebra 
$(TARGET_DIR)/usr/sbin/watchquagga: $(TARGET_DIR)/usr/sbin/zebra 

###tbd### do we need the libs in STAGING_DIR too?
$(TARGET_DIR)/usr/sbin/zebra: $(QUAGGA_DIR)/zebra/zebra  $(QUAGGA_DIR)/lib/.libs
	PATH=$(TARGET_PATH) \
	$(MAKE) DESTDIR=$(TARGET_DIR) \
	    includedir=$(STAGING_DIR)/include \
	    -C $(QUAGGA_DIR) install-strip;
	rm -rf $(TARGET_DIR)/usr/info \
		$(TARGET_DIR)/usr/man \

quagga: netsnmp $(TARGET_DIR)/usr/sbin/zebra

###tbd### do we need the headers in TARGET_DIR too?
### quagga-headers: $(STAGING_DIR)/include/quagga
###	cp -a $(STAGING_DIR)/include/quagga $(TARGET_DIR)/usr/include/quagga

quagga-source: $(DL_DIR)/$(QUAGGA_SOURCE)

quagga-patch: $(QUAGGA_DIR)/.unpacked

quagga-clean: 
	$(MAKE) -C $(QUAGGA_DIR) clean

quagga-dirclean: 
	rm -rf $(QUAGGA_DIR)

# configure: creating ./config.status
# 
# Quagga configuration
# --------------------
# quagga version          : 0.98.2
# host operationg system  : linux-gnu
# source code location    : .
# compiler                : powerpc-linux-gcc
# compiler flags          : -Os -g  -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -g-O2 -Dlinux -I. -I/home/claus/src/buildroot/build_powerpc/root/usr/include
# linker flags            : -L/home/claus/src/buildroot/build_powerpc/root/lib -L/home/claus/src/buildroot/build_powerpc/root/usr/lib -lm -lcrypt  -L/home/claus/src/buildroot/build_powerpc/root/usr/lib -lnetsnmp -lcrypto -lm
# state file directory    : /usr/etc
# config file directory   : /etc/quagga
# example directory       : /etc/quagga
# user to run as          : quagga
# group to run as         : quagga
# group for vty sockets   :
# config file mask        : 0600
# log file mask           : 0600
# 
# The above user and group must have read/write access to the state file
# directory and to the config files in the config file directory.
# 


More information about the Quagga-dev mailing list