Gentoo Archives: gentoo-embedded

From: Peter Stuge <peter@×××××.se>
To: Gentoo-Embedded <gentoo-embedded@l.g.o>
Subject: Re: [gentoo-embedded] Compiling trivial app
Date: Thu, 06 Dec 2007 04:54:23
Message-Id: 20071206045317.29180.qmail@stuge.se
In Reply to: [gentoo-embedded] Compiling trivial app by Jean-Claude Gervais
1 On Wed, Dec 05, 2007 at 01:49:29PM -0500, Jean-Claude Gervais wrote:
2 > I understand how to use crossdev to generate a toolchain and xmerge
3 > to then build ebuilds for a target system, but what if I have a
4 > simple app that is not distributed as an ebuild?
5 >
6 > What is the proper way to get the project to build for the intended
7 > target?
8
9 Write an ebuild. Seriously. It's pretty easy.
10
11
12 > Here is the source file, helloworld.c
13 > .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
14 > int main ( void ) {
15 > return 0;
16 > }
17 > .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
18 >
19 >
20 > Here is the makefile:
21 > .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
22 > all: helloworld
23 >
24 > helloworld: helloworld.o
25 > .-.-.-.-.-.-.-..-.-.-.-.-.-.-.
26
27 Ok. Make a tarball with a subdirectory named helloworld-1.0 that
28 contains your two files. The ebuild can then be as simple as:
29
30 --8<-- helloworld-1.0.ebuild
31 DESCRIPTION="hello world thing"
32 HOMEPAGE=""
33 SRC_URI="helloworld.tar.gz"
34
35 LICENSE="GPL-2" # or perhaps "your.com_proprietary" ?
36 SLOT="0"
37 KEYWORDS="amd64 x86" # add archs here of course.
38 IUSE=""
39 DEPEND=""
40
41 src_compile() {
42 emake
43 }
44
45 src_install() {
46 dobin helloworld
47 }
48 -->8--
49
50 Note that this should never be distributed since SRC_URI only has the
51 filename, and thus this requires the tarball to be placed in
52 /usr/portage/distfiles by some other means than portage.
53 Maybe make an internal URL, and add RESTRICT="mirror" instead. That
54 is much cleaner.
55
56 Make digests with ebuild helloworld-1.0.ebuild digest and then it
57 should xmerge.
58
59
60 //Peter
61 --
62 gentoo-embedded@g.o mailing list