1*f7c14bbaSAndroid Build Coastguard Worker.. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) 2*f7c14bbaSAndroid Build Coastguard Worker 3*f7c14bbaSAndroid Build Coastguard WorkerBuilding libbpf 4*f7c14bbaSAndroid Build Coastguard Worker=============== 5*f7c14bbaSAndroid Build Coastguard Worker 6*f7c14bbaSAndroid Build Coastguard Workerlibelf and zlib are internal dependencies of libbpf and thus are required to link 7*f7c14bbaSAndroid Build Coastguard Workeragainst and must be installed on the system for applications to work. 8*f7c14bbaSAndroid Build Coastguard Workerpkg-config is used by default to find libelf, and the program called 9*f7c14bbaSAndroid Build Coastguard Workercan be overridden with PKG_CONFIG. 10*f7c14bbaSAndroid Build Coastguard Worker 11*f7c14bbaSAndroid Build Coastguard WorkerIf using pkg-config at build time is not desired, it can be disabled by 12*f7c14bbaSAndroid Build Coastguard Workersetting NO_PKG_CONFIG=1 when calling make. 13*f7c14bbaSAndroid Build Coastguard Worker 14*f7c14bbaSAndroid Build Coastguard WorkerTo build both static libbpf.a and shared libbpf.so: 15*f7c14bbaSAndroid Build Coastguard Worker 16*f7c14bbaSAndroid Build Coastguard Worker.. code-block:: bash 17*f7c14bbaSAndroid Build Coastguard Worker 18*f7c14bbaSAndroid Build Coastguard Worker $ cd src 19*f7c14bbaSAndroid Build Coastguard Worker $ make 20*f7c14bbaSAndroid Build Coastguard Worker 21*f7c14bbaSAndroid Build Coastguard WorkerTo build only static libbpf.a library in directory build/ and install them 22*f7c14bbaSAndroid Build Coastguard Workertogether with libbpf headers in a staging directory root/: 23*f7c14bbaSAndroid Build Coastguard Worker 24*f7c14bbaSAndroid Build Coastguard Worker.. code-block:: bash 25*f7c14bbaSAndroid Build Coastguard Worker 26*f7c14bbaSAndroid Build Coastguard Worker $ cd src 27*f7c14bbaSAndroid Build Coastguard Worker $ mkdir build root 28*f7c14bbaSAndroid Build Coastguard Worker $ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install 29*f7c14bbaSAndroid Build Coastguard Worker 30*f7c14bbaSAndroid Build Coastguard WorkerTo build both static libbpf.a and shared libbpf.so against a custom libelf 31*f7c14bbaSAndroid Build Coastguard Workerdependency installed in /build/root/ and install them together with libbpf 32*f7c14bbaSAndroid Build Coastguard Workerheaders in a build directory /build/root/: 33*f7c14bbaSAndroid Build Coastguard Worker 34*f7c14bbaSAndroid Build Coastguard Worker.. code-block:: bash 35*f7c14bbaSAndroid Build Coastguard Worker 36*f7c14bbaSAndroid Build Coastguard Worker $ cd src 37*f7c14bbaSAndroid Build Coastguard Worker $ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make