[okl4-developer] Simple hello world inside wombat

Remy Gottschalk rgottschalk at linagora.com
Tue Mar 18 04:23:16 EST 2008


Hello

I am finally getting to something more practical. I am simply trying to
add an hello world inside wombat.

What i have understood so far :
- I need to create linux/apps/hello
- This directory should be populated with my sources (currently hello.c)
and SConscript.
- I will need to add linux_apps=hello as option to tool/build.py

But what i don't know is what to put inside the SConscript file since i
wanna do it all in SCons style.
I mean all that was told in the mailing list and the examples (pciutils
and busybox) show how to wrap some other build system. I wonder if there
is a way to keep it pure "Scons-ish".


For now I've done something really dirty (kids don't try that at home :) )
I know this is wrong and i am willing to do better but for now it works.

Import("*")
import os

build_dir = Dir(env.builddir + "/hello").abspath
inst_dir = Dir(env.builddir + "/install").abspath

def b(file_name):
    return os.path.join(build_dir, file_name)
def i(file_name):
    return os.path.join(inst_dir, file_name)

env.scons_env["MAKE"] = "make"

hello = env.Command(b("hello"),
                    [] ,
                    "cp linux/apps/hello/hello.c %s & %sgcc -o %s/hello
%s/hello.c" % (build_dir, 
env.scons_env["TOOLPREFIX"], build_dir,  build_dir))

hello_install = env.Command(i("bin/hello"),
                            hello,
                            "cp %s/hello %s/usr/bin/hello" % (build_dir,
inst_dir))
Return("hello_install")







More information about the Developer mailing list