SuperScript::Software::build

How to use build


These instructions assume that you have installed current versions of djblib and weblib.

Compiling

Create a new project directory:
  build-project hello
  cd hello

Create the file src/hello.c containing:

  #include "buffer.h"
  #include "exit.h"

  int main() {
    buffer_putsflush(buffer_1,"Hello, world!\n");
    _exit(0);
  }

Create the file src/hello=x listing the dependencies for the hello command:

  unix.a

Create the file src/unix=l listing the dependencies for the unix.a library:

  buffer_1.o
  buffer_put.o
  buffer_write.o
  error.o
  byte_copy.o

Finally, create a top-level default target, by listing in src/it=d the commands to build for the project:

  hello

Now build the project:

  build

This build fails, due to unresolved subroutine references. Provide the missing information:

  echo str_len.o >> src/unix=l
and build the project again. This time it should succeed. List the contents of the src directory to see what files build borrowed.

Packaging

The scripts in package/ support project compilation with make. They expect to find the list of top-level targets in package/commands. Add them:
  cp src/it=d package/commands
Now you can compile targets with
  package/compile
This also copies top-level targets to the command/ directory.

Testing

Create a regression-test script in src/rts.tests:
  PATH=`pwd`:/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
  export PATH

  umask 022

  rm -rf rts-tmp
  mkdir rts-tmp
  cd rts-tmp
  here=`pwd`

  echo '--- hello works'
  hello; echo $?

Run the tests:

  package/rts
The results appear in compile/rts.

Installation

List in package/command-cp and package/command-ln the directories where the install script should respectively copy and soft link commands. Then install the programs:
  package/install

Distribution

Package your new project for distribution:
  build-dist hello 0.01 >hello-0.01.tar.gz
The tarball is configured for compilation with make.

That's It!

Creation of genuinely useful packages is left as an exercise for the reader.