Skip to content
example of building with scons using 0compile http://0install.net/0compile-scons.html
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
0compile.properties
Hello-scons.xml
README
SConstruct

README

Name: Hello-scons
Author: Thomas Leonard
License: Public domain
Date: 2011-05-28

This is a simple "Hello world" program written in C. It is built using SCons.

Its purpose is to demonstrate the use of 0compile to fetch build dependencies;
you do not need to install SCons manually on your system in order to build it.

To build, run 0compile with the Hello-scons interface as the first argument and
a directory for the build as the second. You can give the URL of Hello-scons to
fetch both the source and SCons using Zero Install. 0compile will create a
'Hello-scons' directory for the build; you should run futher commands from there.

$ 0compile setup http://0install.net/tests/Hello-scons.xml Hello-scons
$ cd Hello-scons

Alternatively, if you've downloaded the source manually (or cloned the Git
repository), then you can skip this step and just run "0compile build" directly
inside the checkout.

Eitherway, you will be prompted to choose the versions of Hello-scons and SCons
(if you used the local feed file then only that version of Hello-scons will be
available).

To build, use the build command:

$ 0compile build

This creates a 'hello-scons-ARCH' directory ready for use and/or distribution,
and a 'build' directory with some temporary files, such as 'hello.o'. This is
used only to speed up later rebuilds.

To run:

$ 0launch hello-scons-ARCH/0install/Hello-scons.xml
Hello world!

To see or modify a copy of the source:

$ 0compile copy-src

This creates a 'src' subdirectory. For more information (including how to
publish the binary using Zero Install), see the main 0compile tutorial:

  http://0install.net/0compile.html


Notes:

The main issues with using SCons with 0compile are that:

- SCons defaults to saving build files in the source directory. 0compile
  requires that the source directory is assumed to be read-only. Therefore, you
  must use --srcdir. See the Hello-scons.xml file for the command to use.

- By default, SCons resets all environment variables. This means that
  instead of compiling against the library versions you chose, it will
  build against whatever happens to be the default on the system today.
  This also breaks plash, which requires certain variables to be set.

The example SConstruct file shows how to fix these problems.
Something went wrong with that request. Please try again.