• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/odhcpd/scripts/devel-build.sh

  1 #!/bin/bash
  2 
  3 set -euxo pipefail
  4 cd "${0%/*}"
  5 cd ..
  6 
  7 # Sanity checks
  8 if [ ! -e "CMakeLists.txt" ] || [ ! -e "src/odhcpd.c" ]; then
  9         echo "odhcpd checkout not found" >&2
 10         exit 1
 11 fi
 12 
 13 if [ $# -eq 0 ]; then
 14         BUILD_ARGS="-DDHCPV4_SUPPORT=ON"
 15 else
 16         BUILD_ARGS="$@"
 17 fi
 18 
 19 # Create build dirs
 20 ODHCPDDIR="$(pwd)"
 21 BUILDDIR="${ODHCPDDIR}/build"
 22 DEPSDIR="${BUILDDIR}/depends"
 23 [ -e "${BUILDDIR}" ] || mkdir "${BUILDDIR}"
 24 [ -e "${DEPSDIR}" ] || mkdir "${DEPSDIR}"
 25 
 26 # Download deps
 27 cd "${DEPSDIR}"
 28 [ -e "json-c" ] || git clone https://github.com/json-c/json-c.git
 29 [ -e "libnl-tiny" ] || git clone https://github.com/openwrt/libnl-tiny.git
 30 [ -e "libubox" ] || git clone https://github.com/openwrt/libubox.git
 31 [ -e "uci" ] || git clone https://github.com/openwrt/uci.git
 32 [ -e "ubus" ] || git clone https://github.com/openwrt/ubus.git
 33 
 34 # Build json-c
 35 cd "${DEPSDIR}/json-c"
 36 cmake                                                   \
 37         -S .                                            \
 38         -B .                                            \
 39         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 40         -DBUILD_SHARED_LIBS=OFF                         \
 41         -DDISABLE_EXTRA_LIBS=ON                         \
 42         --install-prefix "${BUILDDIR}"
 43 make
 44 make install
 45 
 46 # Build libnl-tiny
 47 cd "${DEPSDIR}/libnl-tiny"
 48 cmake                                                   \
 49         -S .                                            \
 50         -B .                                            \
 51         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 52         --install-prefix "${BUILDDIR}"
 53 make
 54 make install
 55 
 56 # Build libubox
 57 cd "${DEPSDIR}/libubox"
 58 cmake                                                   \
 59         -S .                                            \
 60         -B .                                            \
 61         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 62         -DBUILD_LUA=OFF                                 \
 63         -DBUILD_EXAMPLES=OFF                            \
 64         --install-prefix "${BUILDDIR}"
 65 make
 66 make install
 67 
 68 # Build ubus
 69 cd "${DEPSDIR}/ubus"
 70 cmake                                                   \
 71         -S .                                            \
 72         -B .                                            \
 73         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 74         -DBUILD_LUA=OFF                                 \
 75         -DBUILD_EXAMPLES=OFF                            \
 76         --install-prefix "${BUILDDIR}"
 77 make
 78 make install
 79 
 80 # Build uci
 81 cd "${DEPSDIR}/uci"
 82 cmake                                                   \
 83         -S .                                            \
 84         -B .                                            \
 85         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 86         -DBUILD_LUA=OFF                                 \
 87         --install-prefix "${BUILDDIR}"
 88 make
 89 make install
 90 
 91 # Build odhcpd
 92 cd "${ODHCPDDIR}"
 93 cmake                                                   \
 94         -S .                                            \
 95         -B "${BUILDDIR}"                                \
 96         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 97         ${BUILD_ARGS}
 98 make -C "${BUILDDIR}"
 99 
100 set +x
101 echo "✅ Success - the odhcpd binary is available at ${BUILDDIR}/odhcpd"
102 echo "👷 You can rebuild odhcpd by running 'make -C build'"
103 
104 exit 0

This page was automatically generated by LXR 0.3.1.  •  OpenWrt