Difference between revisions of "SCONS for online"

From GlueXWiki
Jump to: navigation, search
m
m
Line 35: Line 35:
 
  Processing package: myPackage
 
  Processing package: myPackage
 
   --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0
 
   --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0
 
+
 
  scons: done reading SConscript files.
 
  scons: done reading SConscript files.
 
  scons: Building targets ...
 
  scons: Building targets ...
Line 44: Line 44:
 
  $ scons install
 
  $ scons install
 
  scons: Reading SConscript files ...
 
  scons: Reading SConscript files ...
 
+
 
  Processing package: myPackage
 
  Processing package: myPackage
 
   --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0
 
   --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0
 
+
 
  scons: done reading SConscript files.
 
  scons: done reading SConscript files.
 
+
 
 
  scons: Building targets ...
 
  scons: Building targets ...
 
  scons: `install' is up to date.
 
  scons: `install' is up to date.
 
  scons: done building targets.
 
  scons: done building targets.
 
+
 
  $ ls myPackage
 
  $ ls myPackage
 
  doc/  java/  Linux_RHEL6-x86_64-gcc4.8.0/  SConstruct  src/
 
  doc/  java/  Linux_RHEL6-x86_64-gcc4.8.0/  SConstruct  src/
 
+
 
  $ ls Linux_RHEL6-x86_64-gcc4.8.0/
 
  $ ls Linux_RHEL6-x86_64-gcc4.8.0/
 
  bin/  include/ lib/  scripts/
 
  bin/  include/ lib/  scripts/
 
  
  
  
 
'''Building a package'''
 
'''Building a package'''

Revision as of 15:41, 10 May 2013

How To Build Online Packages with the SCONS-Based Build System

Introduction

SCONS is used in the online build system due to its superior scripting abilities and built-in knowledge of dependencies in different languages (n.b. Make is used in the offline). It is based on Python, the main scripting language used in the online. Package building is vastly simplified via a library of SCONS scripts that implement the Hall D directory and installation scheme. The result is that package developers will likely only need to make one-line modifications to SCONS scripts to build their package.

Developers need only deal with the individual packages and their directory structures, and should work from their own personal accounts. Deployment of packages into the production environment, and the directory structures used for deployment, is the concern of software system managers (via the hdsys account), and will not be discussed here.

SVN is used for code management for all packages We use the same repository as the offline, but in a separate online area. Code management will not be discussed here.


Creating a new package

To create a new package in your own directory execute the Python script:

$ create_online_package myPackage

This will set up a package root and directory structure that includes SCONS files needed for building the package:

$ ls myPackage/
doc/  java/ SConstruct  src/

C and C++ code resides in the src directory, Java code in the java directory. Scripts reside in src/scripts:

$ ls src/
binsrc/  examples/  libsrc/  scripts/  test/

SConstruct is the top-level SCONS file, and the package can be built by executing the "scons" command here. SCONS will descend the directory tree and build the libraries, executables, etc. that it comes across (hidden subdirectories in the source areas old intermediate build files):

$ scons
scons: Reading SConscript files ...
Processing package: myPackage
  --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0

scons: done reading SConscript files.
scons: Building targets ...
scons: done building targets.

Executing "scons install" will install what was previously built into an architecture-dependent directory in the package root directory, with subdirectories for header files, libraries, etc:

$ scons install
scons: Reading SConscript files ...

Processing package: myPackage
 --> Building for architecture Linux_RHEL6-x86_64-gcc4.8.0

scons: done reading SConscript files.
 
scons: Building targets ...
scons: `install' is up to date.
scons: done building targets.

$ ls myPackage
doc/  java/  Linux_RHEL6-x86_64-gcc4.8.0/  SConstruct  src/

$ ls Linux_RHEL6-x86_64-gcc4.8.0/
bin/  include/	lib/  scripts/


Building a package