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

Sources/odhcp6c/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/odhcp6c.c" ]; then
  9         echo "odhcp6c checkout not found" >&2
 10         exit 1
 11 fi
 12 
 13 if [ $# -eq 0 ]; then
 14         BUILD_ARGS=""
 15 else
 16         BUILD_ARGS="$@"
 17 fi
 18 
 19 # Create build dirs
 20 ODHCP6CDIR="$(pwd)"
 21 BUILDDIR="${ODHCP6CDIR}/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 "libubox" ] || git clone https://github.com/openwrt/libubox.git
 30 [ -e "ubus" ] || git clone https://github.com/openwrt/ubus.git
 31 
 32 # Build json-c
 33 cd "${DEPSDIR}/json-c"
 34 cmake                                                   \
 35         -S .                                            \
 36         -B .                                            \
 37         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 38         -DBUILD_SHARED_LIBS=OFF                         \
 39         -DDISABLE_EXTRA_LIBS=ON                         \
 40         --install-prefix "${BUILDDIR}"
 41 make
 42 make install
 43 
 44 # Build libubox
 45 cd "${DEPSDIR}/libubox"
 46 cmake                                                   \
 47         -S .                                            \
 48         -B .                                            \
 49         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 50         -DBUILD_LUA=OFF                                 \
 51         -DBUILD_EXAMPLES=OFF                            \
 52         --install-prefix "${BUILDDIR}"
 53 make
 54 make install
 55 
 56 # Build ubus
 57 cd "${DEPSDIR}/ubus"
 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 odhcp6c
 69 cd "${ODHCP6CDIR}"
 70 cmake                                                   \
 71         -S .                                            \
 72         -B "${BUILDDIR}"                                \
 73         -DCMAKE_PREFIX_PATH="${BUILDDIR}"               \
 74         -DUBUS=ON                                       \
 75         ${BUILD_ARGS}
 76 make -C "${BUILDDIR}"
 77 
 78 set +x
 79 echo "✅ Success - the odhcp6c binary is available at ${BUILDDIR}/odhcp6c"
 80 echo "👷 You can rebuild odhcp6c by running 'make -C build'"
 81 
 82 exit 0

This page was automatically generated by LXR 0.3.1.  •  OpenWrt