Re: Cross compile click packages
Sascha Alexander Jopen <[email protected]>
| Newsgroups | gmane.network.routing.click |
|---|---|
| Message-ID | <[email protected]> |
In my case it's the easier deployment. In particular, i use the OpenWRT buildroot for cross compilation of click packages. I install the complete click "base package" with DESTDIR into a staging directory for further usage. So far i changed some definitions within the makefiles to use the click build tools directly out of the source directory, because the installed versions would be host binaries, not build system binaries. After fixing the include directories and data directories i could compile two different packages for userlevel. Neither linuxmodules nor bsdmodule will work with the attached patch. Im pretty sure this patch is not complete. I'm really new to such "complex" makefiles. For example, no dependency files (*.d) are generated for my packges, though this worked before. Sascha On 11/09/11 15:07, Eddie Kohler wrote: > In particular, it might be much easier to handle this: > > Click prefix => /usr/local/click > Click temporary installation directory => /usr/local/click-cross/usr/local/click > > than this: > > Click prefix => /usr/local/click > Click temporary installation directory => /usr/local/click-cross > > Eddie > > > On Wed, Nov 9, 2011 at 9:04 AM, Eddie Kohler <[email protected]> wrote: >> Hi Sascha, >> >> Hmm. >> >> Can you tell me a bit more about your deployment situation?... Are you >> installing with a DESTDIR, or copying the whole tree somewhere else? >> It is not immediately clear to me how this should be handled. >> >> Eddie >> >> >> On Tue, Nov 8, 2011 at 7:09 AM, Sascha Alexander Jopen >> <[email protected]> wrote: >>> Hey, >>> >>> does anybody cross compile click packages? >>> >>> If i cross compile click with the default prefix, but install it to a >>> different location for further usage with click packages, the file >>> config.mk in clickdatadir contains the original prefix. This is fine to >>> define the directories for the final destination locations of the >>> packaged to be cross compiled, but the package Makefiles use this >>> information to find the installed click instance, too. One can configure >>> a package with --with-click=PREFIX, but this doesn't help. >>> >>> I know that i can compile click with local elements instead of packages, >>> but using packages is a cleaner way, i think. >>> >>> Are there any special configure flags or something similar i am missing, >>> to get click packages cross compiled? >>> >>> Regards, >>> Sascha >>> _______________________________________________ >>> click mailing list >>> [email protected] >>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click >>> >> _______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
click-packages.patch
(text/x-patch, 5.5 KB)
diff -ur click-2.0.1/etc/pkg-Makefile click-2.0.1-patched/etc/pkg-Makefile
--- click-2.0.1/etc/pkg-Makefile 2011-08-23 20:10:16.000000000 +0200
+++ click-2.0.1-patched/etc/pkg-Makefile 2011-11-09 11:45:46.000000000 +0100
@@ -15,27 +15,29 @@
VPATH ?= .:$(top_srcdir)/$(subdir):$(top_srcdir)
-include $(clickdatadir)/pkg-config.mk
+include $(clickinstalleddatadir)/pkg-config.mk
+
+clickbuildbindir ?= $(clicksrcdir)
ifeq ($(CLICK_PACKAGE_MAKING),userlevel)
-include $(clickdatadir)/pkg-userlevel.mk
+include $(clickinstalleddatadir)/pkg-userlevel.mk
endif
ifeq ($(CLICK_PACKAGE_MAKING),linuxmodule)
-include $(clickdatadir)/pkg-linuxmodule.mk
+include $(clickinstalleddatadir)/pkg-linuxmodule.mk
endif
ifeq ($(CLICK_PACKAGE_MAKING),bsdmodule)
-include $(clickdatadir)/pkg-bsdmodule.mk
+include $(clickinstalleddatadir)/pkg-bsdmodule.mk
endif
ifeq ($(CLICK_PACKAGE_MAKING),)
INSTALL ?= $(CLICKINSTALL)
INSTALL_DATA ?= $(CLICKINSTALL) -m 644
-mkinstalldirs ?= $(clickdatadir)/mkinstalldirs
+mkinstalldirs ?= $(clickinstalleddatadir)/mkinstalldirs
-CLICK_BUILDTOOL = $(clickbindir)/click-buildtool
+CLICK_BUILDTOOL = $(clickbuildbindir)/click-buildtool
CLICK_ELEM2PACKAGE = $(CLICK_BUILDTOOL) elem2package $(ELEM2PACKAGE_INCLUDES)
# set TARGETS, etc. based on MAKE_UPACKAGE, MAKE_KPACKAGE, and MAKE_BPACKAGE
@@ -79,8 +81,8 @@
elemlist:
for i in $(DRIVERS); do $(MAKE) CLICK_PACKAGE_MAKING=$$i elemlist; done
-elementmap-$(package).xml: $(clickbindir)/click-mkelemmap always
- r="$(DRIVERS) $(package)"; echo $(srcdir) | $(CLICK_BUILDTOOL) findelem -r "$$r" -P | $(clickbindir)/click-mkelemmap -r "$(package)" -t "$(DRIVERS)" -s `cd $(srcdir) && pwd` > elementmap-$(package).xml
+elementmap-$(package).xml: $(clickbuildbindir)/click-mkelemmap always
+ r="$(DRIVERS) $(package)"; echo $(srcdir) | $(CLICK_BUILDTOOL) findelem -r "$$r" -P | $(clickbuildbindir)/click-mkelemmap -r "$(package)" -t "$(DRIVERS)" -s `cd $(srcdir) && pwd` > elementmap-$(package).xml
install: install-obj install-man elementmap-$(package).xml always
$(mkinstalldirs) $(DESTDIR)$(clickdatadir)
@@ -91,7 +93,7 @@
install-man: always elementmap-$(package).xml
$(mkinstalldirs) $(DESTDIR)$(mandir)
$(mkinstalldirs) $(DESTDIR)$(mandir)/mann
- $(clickbindir)/click-elem2man -L -d $(DESTDIR)$(mandir)/mann -P $(package) -e $(clickdatadir)/elementmap.xml elementmap-$(package).xml
+ $(clickbuildbindir)/doc/click-elem2man -L -d $(DESTDIR)$(mandir)/mann -P $(package) -e $(clickinstalleddatadir)/elementmap.xml elementmap-$(package).xml
uninstall: uninstall-obj uninstall-man always
/bin/rm -f $(DESTDIR)$(clickdatadir)/elementmap-$(package).xml
diff -ur click-2.0.1/etc/pkg-config.mk.in click-2.0.1-patched/etc/pkg-config.mk.in
--- click-2.0.1/etc/pkg-config.mk.in 2011-09-24 19:31:09.000000000 +0200
+++ click-2.0.1-patched/etc/pkg-config.mk.in 2011-11-09 12:09:58.000000000 +0100
@@ -38,7 +38,7 @@
CLICKDEPCFLAGS = @DEPCFLAGS@
CLICKDEFS = @DEFS@
-CLICKINCLUDES = -I$(clickincludedir) -I$(clicksrcdir) @PCAP_INCLUDES@
+CLICKINCLUDES = -I$(clickinstalledincludedir) -I$(clicksrcdir) @PCAP_INCLUDES@
CLICKLDFLAGS = @LDFLAGS@
CLICKLDMODULEFLAGS = @LDMODULEFLAGS@
diff -ur click-2.0.1/etc/pkg-userlevel.mk click-2.0.1-patched/etc/pkg-userlevel.mk
--- click-2.0.1/etc/pkg-userlevel.mk 2011-04-25 21:19:09.000000000 +0200
+++ click-2.0.1-patched/etc/pkg-userlevel.mk 2011-11-09 11:34:41.000000000 +0100
@@ -37,7 +37,7 @@
PACKAGE_LIBS ?=
PACKAGE_DEPS ?=
-CLICK_BUILDTOOL ?= $(clickbindir)/click-buildtool
+CLICK_BUILDTOOL ?= $(clickbuildbindir)/click-buildtool
CLICK_ELEM2PACKAGE ?= $(CLICK_BUILDTOOL) elem2package $(ELEM2PACKAGE_INCLUDES)
STRIP_UPACKAGE ?= true
@@ -79,7 +79,7 @@
OBJS = $(ELEMENT_OBJS) $(PACKAGE_OBJS)
-$(package).uo: $(clickdatadir)/pkg-userlevel.mk $(OBJS) $(PACKAGE_DEPS)
+$(package).uo: $(clickinstalleddatadir)/pkg-userlevel.mk $(OBJS) $(PACKAGE_DEPS)
$(CXXLINK) -o $(package).uo $(OBJS) $(ELEMENT_LIBS) $(PACKAGE_LIBS)
$(STRIP_UPACKAGE) $(package).uo
diff -ur click-2.0.1/etc/samplepackage/Makefile.in click-2.0.1-patched/etc/samplepackage/Makefile.in
--- click-2.0.1/etc/samplepackage/Makefile.in 2011-04-21 00:52:10.000000000 +0200
+++ click-2.0.1-patched/etc/samplepackage/Makefile.in 2011-11-09 10:59:08.000000000 +0100
@@ -10,9 +10,11 @@
top_builddir := .
subdir := .
+clickinstalleddatadir := @clickinstalleddatadir@
+
# Require Click prefix settings.
# Generally, you will provide a '--with-click=CLICKPREFIX' option, and set:
-include @clickdatadir@/config.mk
+include $(clickinstalleddatadir)/config.mk
# Set 'MAKE_UPACKAGE', 'MAKE_KPACKAGE', and 'MAKE_BPACKAGE' to '0' or '1'
# to determine whether to build userlevel, linuxmodule, and bsdmodule
@@ -56,4 +58,6 @@
datadir = @datadir@
endif
-include $(clickdatadir)/pkg-Makefile
+clicksrcdir = $(clickinstalleddatadir)/src
+
+include $(clickinstalleddatadir)/pkg-Makefile
diff -ur click-2.0.1/etc/samplepackage/configure.ac click-2.0.1-patched/etc/samplepackage/configure.ac
--- click-2.0.1/etc/samplepackage/configure.ac 2009-03-08 02:03:02.000000000 +0100
+++ click-2.0.1-patched/etc/samplepackage/configure.ac 2011-11-09 12:11:11.000000000 +0100
@@ -38,6 +38,8 @@
test "x$clickprefix" = xNONE && clickprefix="$prefix"
clickdatadir="${clickprefix}/share/click"
+clickinstalleddatadir="${clickdatadir}"
+clickinstalledincludedir="${clickprefix}/include"
if test ! -r $clickdatadir/config.mk; then
AC_MSG_ERROR([
@@ -55,7 +57,8 @@
AC_SUBST(clickbindir)
AC_SUBST(clicksbindir)
AC_SUBST(clickdatadir)
-
+AC_SUBST(clickinstalleddatadir)
+AC_SUBST(clickinstalledincludedir)
dnl
dnl build userlevel? Linux module? FreeBSD module?