Please provide some tips for creating a new "recipe" including a package from source

Ronny Nilsson rln-nard at arbetsmyra.dyndns.org
Mon Sep 1 14:58:11 CEST 2014


Hi
I will try to guide you through the process of adding a new package. This is 
still a TODO in the documentation. :-/

Adding a new application requires some general knowledge about Make, shell 
scripts and gcc. However, have you ever written a Makefile you'll be fine. 
Start with creating a directory and download the package. It's advised to name 
the directory in same manner as the downloaded file:
	- cd nard/apps/
	- mkdir myapp
	- wget http://....myapp-1.0.tar.gz

Extract your downloaded tarball and inspect how to build it. Does it have a 
"configure" script? Is there a Makefile already? Try building it for your 
local PC first! (If you can't build it for your host PC you won't be able to 
cross-compile it either.)

When creating your custom cross-compile Makefile you might want to look at 
some existing ones first. Chances are you can reuse 90% of them.
	- nard/apps/ser2net/Makefile
	- nard/apps/wireless_tools/Makefile
are good learn from. 


- cp nard/apps/wireless_tools/Makefile nard/apps/myapp

Open the copied Makefile in a text editor and find the target
	"$(PKG_VER)/.nard-build"

With the knowledge of how to build the application for your PC, add the 
necessery commands to the
	"$(PKG_VER)/.nard-build"
target. For applications using autoconf something like this is a god start:
	cd $(dir $@) && env CFLAGS="$(CROSS_CFLAGS)" \
	./configure --sysconfdir=/etc --prefix=/usr \
	--host=$(CROSS_TUPLE)
	$(MAKE) -C "$(PKG_VER)"

Next open the product recipe in a text editor:
	emacs nard/platform/skeleton/Rules.mk

Add a line to the PKGS_APPS list. Note the format of the existing lines! First 
the application directory name, followed by a slash and last the application 
directory name again with a trailing version number. This should resolve to 
your downloaded tarball. For example, by adding:
	PKGS_APPS += myapp/myapp-1.0
There should be a corresponding file:
	nard/apps/myapp/myapp-1.0.tar.gz
which will be automatically extracted during the build.

Now try building it:
	cd nard/apps/myapp/
	make

/Ronny



------------------------------------
> I tried to create a new recipe which comprised "skeleton" plus "linphonec":
> - I used git to clone the source for linphone to apps/linphone
> - I copied the whole of  platform/skeleton to a new folder
> platform/christest
> I then added the line
> PKGS_APPS += linphone to /platform/christest/Rules.mk
> 
> Then I returned to my nard folder and did
> make christest
> 
> But was told that Make does not know how to make christest.
> 
> So I then simply edited platform/skeleton/Rules.mk in the same way.
> 
> This time when I do "make skeleton", it enters the apps/linphone
> folder.  This fails,  but I suspect that's my fault for now, (as
> autogen.sh does not run cleanly - I need to fix that first)
> 
> so two questions:
> 
> 1) What is the correct way to create a new "product"
> 2) Apart from knobbling Makefiles to use the correct (cross-) toolchain,
> does anything else need to be done to incorporate a new package in to
> the build?
> 
> With thanks,
> 
> Chris



More information about the Nard mailing list