Neels Hofmeyr | 697a617 | 2018-08-22 17:32:21 +0200 | [diff] [blame] | 1 | === WHAT IS THIS? |
| 2 | |
| 3 | * quickly build the entire Osmocom core network stack from source, with a |
| 4 | generated top-level makefile (see the rest of this README file below). |
| 5 | |
| 6 | * quickly configure, launch and tear down an entire Osmocom core network on |
| 7 | your box (see net/README). |
| 8 | |
| 9 | |
Neels Hofmeyr | 569f8ff | 2018-01-06 21:20:28 +0100 | [diff] [blame] | 10 | === Quick Start |
| 11 | |
| 12 | sudo apt install \ |
| 13 | build-essential gcc g++ make automake autoconf libtool pkg-config \ |
| 14 | libtalloc-dev libpcsclite-dev libortp-dev libsctp-dev libssl-dev libdbi-dev \ |
| 15 | libdbd-sqlite3 libsqlite3-dev libpcap-dev libc-ares-dev libgnutls28-dev \ |
| 16 | libsctp-dev sqlite3 |
| 17 | |
| 18 | ./gen_makefile.py 3G+2G.deps default.opts iu.opts -I -m make |
| 19 | |
| 20 | cd make |
| 21 | make |
| 22 | |
| 23 | - 'make' will ask for sudo password to run 'make install' and 'ldconfig'. |
| 24 | To run non-interactively: |
| 25 | |
| 26 | - 'make install': |
| 27 | chown $USER: /usr/local |
| 28 | Then call gen_makefile.py once without the -I option |
| 29 | |
| 30 | - 'ldconfig': |
| 31 | echo "$USER ALL= NOPASSWD: /sbin/ldconfig" > /etc/sudoers.d/ldconfig |
| 32 | |
| 33 | |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 34 | === gen_makefile.py |
| 35 | |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 36 | This provides a set of top-level makefiles to build variants of the Osmocom |
| 37 | source trees. It is inteded for the core network components and related |
| 38 | projects, but works generically. |
| 39 | |
| 40 | The idea is to have all your Osmocom git clones in ./src, while keeping one or |
| 41 | more separate build trees in ./make-*. |
| 42 | |
| 43 | Run ./gen_makefile.py with a choice of projects (2G only or also 3G?) |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 44 | and a choice of configure options. |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 45 | |
Neels Hofmeyr | 00e6a57 | 2017-09-20 19:41:09 +0200 | [diff] [blame] | 46 | |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 47 | Examples: |
| 48 | |
| 49 | Full 2G and 3G support: |
| 50 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 51 | ./gen_makefile.py 3G+2G.deps default.opts iu.opts -m make |
| 52 | cd make |
| 53 | make |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 54 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 55 | 2G only, and a custom dir name of 'make-2G': |
Neels Hofmeyr | d3707d0 | 2017-09-03 23:57:55 +0200 | [diff] [blame] | 56 | |
Neels Hofmeyr | 95ea8ec | 2017-09-06 18:54:58 +0200 | [diff] [blame] | 57 | ./gen_makefile.py 2G.deps default.opts -m make-2G |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 58 | cd make-2G |
Neels Hofmeyr | 0a1bdff | 2017-08-13 03:22:42 +0200 | [diff] [blame] | 59 | make |
| 60 | |
| 61 | If you make modifications in one of the source trees, this Makefile will pick |
| 62 | it up, rebuild the project and also rebuild all dependencies (according to the |
| 63 | *.deps file the Makefile was generated from). |
| 64 | |
| 65 | If you modify the *.deps or *.opts file, you can easily run 'make regen' in a |
| 66 | make-* subdir to regenerate the Makefile from the same files. |
| 67 | |
| 68 | In your make-* subdir there are empty status files that are touched for every |
| 69 | completed make target. From these, 'make' can detect what needs to be rebuilt. |
| 70 | You can manually remove them to force a rebuild of a specific target. |
| 71 | |
| 72 | For example, if you 'rm .make.libosmocore.autoconf', libosmocore and all |
| 73 | projects depending on libosmocore will be rebuilt from scratch. |
| 74 | |
| 75 | For more details on the *.opts and *.deps syntax, read the docs at the top of |
| 76 | ./gen_makefile.py. |
| 77 | |
| 78 | It is also easily possible to keep sources and build trees in various |
| 79 | configurations, see the command line options of ./gen_makefile.py. |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 80 | |
| 81 | |
Neels Hofmeyr | 7aeaf42 | 2018-11-19 02:54:11 +0100 | [diff] [blame^] | 82 | === Install in /usr |
| 83 | |
| 84 | By default, the Osmocom install prefix is /usr/local, while (currently) the |
| 85 | default systemd *.service files expect binaries installed in /usr/bin. To |
| 86 | install in /usr instead, use prefix_usr.opts, which sets --prefix=/usr. |
| 87 | |
| 88 | |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 89 | === Build Environment |
| 90 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 91 | For dependencies, see the "External dependencies" on: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 92 | |
| 93 | https://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source |
| 94 | |
Neels Hofmeyr | 015f301 | 2017-12-10 13:39:08 +0100 | [diff] [blame] | 95 | If /usr/local/ is not writable by your user, pass the --sudo-make-install |
| 96 | option to gen_makefile.py above (a custom --prefix is not yet supported). |
| 97 | |
| 98 | If your system doesn't have this by default, you will need: |
Neels Hofmeyr | a0ccef3 | 2017-10-02 00:26:12 +0200 | [diff] [blame] | 99 | |
| 100 | export LD_LIBRARY_PATH="/usr/local/lib" |
| 101 | |
| 102 | and |
| 103 | |
| 104 | export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" |
| 105 | |
| 106 | to your environment. To use the installed binaries after installation, also |
| 107 | |
| 108 | export PATH="$PATH:/usr/local/bin" |
| 109 | |
| 110 | |
Neels Hofmeyr | feeedad | 2017-08-23 00:13:33 +0200 | [diff] [blame] | 111 | === osmo-uninstall.sh |
| 112 | |
| 113 | Remove osmocom built binaries and headers from given prefix, |
| 114 | default is /usr/local. |
Neels Hofmeyr | f6402d8 | 2017-09-04 04:32:21 +0200 | [diff] [blame] | 115 | |
| 116 | |
| 117 | === src/* |
| 118 | |
| 119 | Find other useful scripts in src/, see src/README. |