diff --git a/src/minimal_overlay/bundles/jq/.config b/src/minimal_overlay/bundles/jq/.config new file mode 100644 index 00000000..454fc855 --- /dev/null +++ b/src/minimal_overlay/bundles/jq/.config @@ -0,0 +1,9 @@ +# Some of the functionality depends on third party +# libraries, e.g. 'ncurses' and 'termcap'. Also note +# that the build process requires root permissions. +# +# You can find the latest util_linux archives here: +# +# https://www.kernel.org/pub/linux/utils/util-linux/ +# +JQ_SOURCE_URL=https://github.com/jqlang/jq/releases/download/jq-$JQ_VERSION/jq-$JQ_VERSION.tar.gz diff --git a/src/minimal_overlay/bundles/jq/01_get.sh b/src/minimal_overlay/bundles/jq/01_get.sh new file mode 100755 index 00000000..b4a7aec8 --- /dev/null +++ b/src/minimal_overlay/bundles/jq/01_get.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +set -e + +. ../../common.sh +. ../../../settings + +# Read the common configuration properties. +DOWNLOAD_URL=`read_property JQ_SOURCE_URL` +USE_LOCAL_SOURCE=`read_property USE_LOCAL_SOURCE` + +# Grab everything after the last '/' character. +ARCHIVE_FILE=${DOWNLOAD_URL##*/} + +if [ "$USE_LOCAL_SOURCE" = "true" -a ! -f $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE ] ; then + echo "Source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE is missing and will be downloaded." + USE_LOCAL_SOURCE="false" +fi + +cd $MAIN_SRC_DIR/source/overlay + +if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then + # Downloading util-linux source bundle file. The '-c' option allows the download to resume. + echo "Downloading jq source bundle from $DOWNLOAD_URL" + wget -c $DOWNLOAD_URL +else + echo "Using local jq source bundle $MAIN_SRC_DIR/source/overlay/$ARCHIVE_FILE" +fi + +# Delete folder with previously extracted jq. +echo "Removing util-linux work area. This may take a while." +rm -rf $WORK_DIR/overlay/$BUNDLE_NAME +mkdir $WORK_DIR/overlay/$BUNDLE_NAME + +# Extract util-linux to folder 'work/overlay/util_linux'. +# Full path will be something like 'work/overlay/util_linux/util-linux-2.31'. +tar -xvf $ARCHIVE_FILE -C $WORK_DIR/overlay/$BUNDLE_NAME + +cd $SRC_DIR diff --git a/src/minimal_overlay/bundles/jq/02_build.sh b/src/minimal_overlay/bundles/jq/02_build.sh new file mode 100755 index 00000000..8a98a887 --- /dev/null +++ b/src/minimal_overlay/bundles/jq/02_build.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e + +. ../../common.sh +. ../../../settings + +cd $WORK_DIR/overlay/$BUNDLE_NAME + +# Change to the util-linux source directory which ls finds, e.g. 'util-linux-2.34'. +cd $(ls -d jq-$JQ_VERSION) + +if [ -f Makefile ] ; then + echo "Preparing '$BUNDLE_NAME' work area. This may take a while." + make -j $NUM_JOBS clean +else + echo "The clean phase for '$BUNDLE_NAME' has been skipped." +fi + +rm -rf $DEST_DIR +mkdir -p $DEST_DIR/bin + +echo "Configuring '$BUNDLE_NAME'." + +CFLAGS="$CFLAGS" ./configure \ + --with-oniguruma=builtin + +echo "Building '$BUNDLE_NAME'." +make -j $NUM_JOBS + +echo "Installing '$BUNDLE_NAME'." +make check +make -j $NUM_JOBS install + +cp -r jq $DEST_DIR/bin/jq + +echo "Reducing '$BUNDLE_NAME' size." +reduce_size $DEST_DIR + +install_to_overlay + +echo "Bundle '$BUNDLE_NAME' has been installed." + +cd $SRC_DIR + diff --git a/src/minimal_overlay/bundles/jq/bundle.sh b/src/minimal_overlay/bundles/jq/bundle.sh new file mode 100755 index 00000000..e132bc25 --- /dev/null +++ b/src/minimal_overlay/bundles/jq/bundle.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +. ../../common.sh + +./01_get.sh +./02_build.sh + +cd $SRC_DIR diff --git a/src/settings b/src/settings index 7541642c..7886cec2 100644 --- a/src/settings +++ b/src/settings @@ -1,7 +1,8 @@ KERNEL_VERSION=6.7.5 GLIBC_VERSION=2.39 BUSYBOX_VERSION=1.36.1 -ADD_BUNDLES=dhcp,util_linux,passwd +ADD_BUNDLES=dhcp,util_linux,passwd,jq UTIL_LINUX_VERSION=2.39.3 NCURSES_VERSION=6.3 PKG_CONFIG_VERSION=0.29.2 +JQ_VERSION=1.7.1