Build Script — Compiling and installing the source

The build scripts are used to compile and install the source. It is stored in builds/<os>-<arch>.

Note

The appropiate build script will be automatically run by upe-cli build make <manifest>, so you have to enter the name exactly:

OS Code
Linux linux
Mac OS X darwin [1]
Windows [2] win32 — standard Windows
cygwin — if using CygWin

Warning

If you are building for Windows, take note that:

  • Most Windows doesn’t have build tools.
  • Windows uses a different directory structure: C:\ instead of /.

Hint

The OS code (and arch) can be found with:

>>> # Let's assume a 64-bits Linux computer
>>> from platform import system, machine
>>> system().lower()  # Will get the OS
'linux'
>>> machine()  # Will get the arch
'x86_64'

Commands

These commands can be used in a script file (commands inside [] or written in italics are optional):

init

Create the build directory (Usually build). This is required to be run on the start of the script.

adddir directory [perm=0o777]

Create a directory inside the build dir:

/usr/bin/./build/usr/bin/

  • directory – Directory to be created (without the ./build).
  • perm – Permission mode for the new directory. By default, 0o777 (rwxrwxrwx).

Hint

0o000 means 000 in octal (the permissions are set in octal, not in decimal).

Note

You have to create every directory, even those that must exist (/usr, /opt...)

install src dst [perm=0o755] [ownerid=0] [groupid=0]

Copy a file from src/ to build/:

install foo /usr/bin/foo
# Copy ./src/foo to ./build/usr/bin/foo
  • src – Source (without the ./src).
  • dst – Destination (without the ./build).
  • perm – Permission mode for the copied file. By default, 755 (rwxr-xr-x)
  • ownerid – Owner UID for the new file. By default, it won’t be modified.
  • groupid – Owner GID. Same as ownerid but with the group. Again, by default, it won’t be modified.
shell command

Run a shell command. It’ll be notified to the user.

Warning

The user may choose to disable shell commands or to be asked before running.


[1]This is based on Mac OS X’s kernel: Darwin. See issue 7850.
[2]Note that Windows may or may not work, we haven’t tested it yet.

Table Of Contents

Previous topic

upe.build — Create UPE packages

Next topic

upe.pkgmgmt — Install, remove and update packages