Osmocom Top-level Makefile and dev tools
Go to file
Neels Hofmeyr 3463895cc7 internal MNCC
Change-Id: I1d03fa3f22d55c653f4622fca1d23309c09fe24d
2019-11-13 17:27:47 +01:00
net internal MNCC 2019-11-13 17:27:47 +01:00
src gits: dont ask to push -f to None 2019-03-29 15:43:04 +01:00
ttcn3 ttcn3: run ttcn3 testsuites from osmo-dev 2019-10-18 11:32:51 +02:00
.gitignore ttcn3: run ttcn3 testsuites from osmo-dev 2019-10-18 11:32:51 +02:00
.gitreview Add .gitreview 2019-03-04 11:09:35 +01:00
2G.deps deps: osmo-msc now needs libosmo-gsup-client from osmo-hlr 2018-11-15 16:06:42 +01:00
3G+2G.deps deps: osmo-msc now needs libosmo-gsup-client from osmo-hlr 2018-11-15 16:06:42 +01:00
README ttcn3: run ttcn3 testsuites from osmo-dev 2019-10-18 11:32:51 +02:00
all-tests.opts all-tests.opts: add libosmocore external-tests 2018-09-16 13:49:54 +02:00
default.opts add openbsc.deps to allow building legacy openbsc.git as well 2018-05-25 17:19:42 +02:00
gen_makefile.py don't trigger rebuild on config.h.in 2019-07-12 01:22:50 +02:00
iu.opts add openbsc.deps to allow building legacy openbsc.git as well 2018-05-25 17:19:42 +02:00
manuals.opts add manuals.opts, no_doxygen.opts, no_optimization.opts 2019-03-06 16:49:10 +01:00
no_doxygen.opts add manuals.opts, no_doxygen.opts, no_optimization.opts 2019-03-06 16:49:10 +01:00
no_optimization.opts add manuals.opts, no_doxygen.opts, no_optimization.opts 2019-03-06 16:49:10 +01:00
no_systemd.opts add no_systemd.opts 2018-09-16 13:49:54 +02:00
openbsc.deps add openbsc.deps to allow building legacy openbsc.git as well 2018-05-25 17:19:42 +02:00
osmo-uninstall.sh fix osmo-uninstall.sh: do not clear the entire pkgconfig 2019-02-12 15:12:56 +01:00
prefix_usr.opts add prefix_usr.opts 2018-11-19 02:54:11 +01:00
sanitize.opts sanitize.opts: add osmo-sip-connector --enable-sanitize 2018-11-07 16:54:23 +01:00
sysmobts-calib.py add sysmobts-calib.py 2019-08-08 15:13:46 +02:00
transcoding.opts fix transcoding.opts: osmo-bsc also needs it ATM 2017-08-22 19:34:02 +02:00
werror.opts add werror.opts using 'configure --enable-werror' 2018-03-16 03:45:02 +01:00

README

=== WHAT IS THIS?

* quickly build the entire Osmocom core network stack from source, with a
  generated top-level makefile (see the rest of this README file below).

* quickly configure, launch and tear down an entire Osmocom core network on
  your box (see net/README).


=== Quick Start

sudo apt install \
  build-essential gcc g++ make automake autoconf libtool pkg-config \
  libtalloc-dev libpcsclite-dev libortp-dev libsctp-dev libssl-dev libdbi-dev \
  libdbd-sqlite3 libsqlite3-dev libpcap-dev libc-ares-dev libgnutls28-dev \
  libsctp-dev sqlite3

./gen_makefile.py 3G+2G.deps default.opts iu.opts -I -m make

cd make
make

- 'make' will ask for sudo password to run 'make install' and 'ldconfig'.
  To run non-interactively:

  - 'make install':
    chown $USER: /usr/local
    Then call gen_makefile.py once without the -I option

  - 'ldconfig':
    echo "$USER  ALL= NOPASSWD: /sbin/ldconfig" > /etc/sudoers.d/ldconfig


=== gen_makefile.py

This provides a set of top-level makefiles to build variants of the Osmocom
source trees. It is inteded for the core network components and related
projects, but works generically.

The idea is to have all your Osmocom git clones in ./src, while keeping one or
more separate build trees in ./make-*.

Run ./gen_makefile.py with a choice of projects (2G only or also 3G?)
and a choice of configure options.


Examples:

Full 2G and 3G support:

  ./gen_makefile.py 3G+2G.deps default.opts iu.opts  -m make
  cd make
  make

2G only, and a custom dir name of 'make-2G':

  ./gen_makefile.py 2G.deps default.opts -m make-2G
  cd make-2G
  make

If you make modifications in one of the source trees, this Makefile will pick
it up, rebuild the project and also rebuild all dependencies (according to the
*.deps file the Makefile was generated from).

If you modify the *.deps or *.opts file, you can easily run 'make regen' in a
make-* subdir to regenerate the Makefile from the same files.

In your make-* subdir there are empty status files that are touched for every
completed make target. From these, 'make' can detect what needs to be rebuilt.
You can manually remove them to force a rebuild of a specific target.

For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all
projects depending on libosmocore will be rebuilt from scratch.

For more details on the *.opts and *.deps syntax, read the docs at the top of
./gen_makefile.py.

It is also easily possible to keep sources and build trees in various
configurations, see the command line options of ./gen_makefile.py.


=== Install in /usr

By default, the Osmocom install prefix is /usr/local, while (currently) the
default systemd *.service files expect binaries installed in /usr/bin. To
install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr.


=== Systemd Service Files

If you encounter problems installing *.service files, no_systemd.opts may help:

Systemd recommends installing service files in the distribution's single
service file location; that may sound sane, but if that location is
/lib/systemd/system, that means even a --prefix=/home/private/prefix ends up
trying to install service files system-wide in /lib/systemd/system, making all
attempts to install to a user-writable location fail.

no_systemd.opts disables installing *.service files.


=== Build Environment

For dependencies, see the "External dependencies" on:

  https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source

If /usr/local/ is not writable by your user, pass the --sudo-make-install
option to gen_makefile.py above (a custom --prefix is not yet supported).

If your system doesn't have this by default, you will need:

  export LD_LIBRARY_PATH="/usr/local/lib"

and

  export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"

to your environment. To use the installed binaries after installation, also

  export PATH="$PATH:/usr/local/bin"


=== osmo-uninstall.sh

Remove osmocom built binaries and headers from given prefix,
default is /usr/local.


=== src/*

Find other useful scripts in src/, see src/README.


=== ttcn3/ttcn3.sh

Clone and build all dependencies, then run a given TTCN-3 testsuite and all
required components. This is intended to make test-cycles as short as possible,
without any manual configuration effort and without the need to rebuild the
entire testsuite, SUT (subject under test, e.g. osmo-mgw) and dependencies from
scratch for each code change. Instead, ttcn3.sh will make use of osmo-dev's
generated global makefile and only build what actually changed.

Example usage:

  ./ttcn3/ttcn3.sh mgw

Note that not all testsuites are supported at this point, see the output of
ttcn3.sh without any argument for more information.

More about the testsuites:
https://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Testsuites


=== Troubleshooting

When using sanitize.opts, osmo-trx is not built with the address sanitizer
enabled. Linking a sanitizer-enabled libosmocore will not work.