#!/bin/sh # ###################################################### # Build script for Core 14.x # # # # See .info for details # ###################################################### ###################################################### # Prepare extension creation # ###################################################### #download and install the compile tools tce-load -wi compiletc.tcz tce-load -wi squashfs-tools.tcz tce-load -wi cmake.tcz tce-load -wi pcre2-dev.tcz ###################################################### # Configure extension creation parameters # ###################################################### # Variables TODAY=`date +%Y/%m/%d` PACKAGE="libyang" VERSION="2.1.80" DESCRIPTION="libyang is a YANG data modelling language parser and toolkit" DEVDESCRIPTION="Development file of libyang, a YANG data modelling language" AUTHORS="See site" HOMEPAGE="https://github.com/CESNET/libyang" LICENSE="BSD-3-Clause License" ME="rhermsen" TAGS="yang libyang data modelling" DEVTAGS="development yang libyang data modelling" DESTDIR=/tmp/dest/${PACKAGE} TMPDIR=/tmp/submit/${PACKAGE} ARCH=`uname -m` # Workdir sudo rm -r /tmp/${PACKAGE} 2>/dev/null mkdir /tmp/${PACKAGE} cd /tmp/${PACKAGE} # Source wget https://github.com/CESNET/libyang/archive/refs/tags/v${VERSION}.tar.gz tar -xzf /tmp/${PACKAGE}/v${VERSION}.tar.gz cd /tmp/${PACKAGE}/${PACKAGE}-${VERSION} ###################################################### # Compile extension # ###################################################### mkdir build cd build cmake .. make sudo rm -r ${DESTDIR} 2>/dev/null mkdir -p ${DESTDIR} make DESTDIR=${DESTDIR} install sudo rm -r ${TMPDIR}* 2>/dev/null mkdir -p ${TMPDIR}/usr/local/bin mkdir -p ${TMPDIR}/usr/local/lib mkdir -p ${TMPDIR}/usr/local/share/doc/${PACKAGE} mkdir -p ${TMPDIR}/usr/local/share/yang/modules mv ${DESTDIR}/usr/local/bin/* ${TMPDIR}/usr/local/bin/ mv ${DESTDIR}/usr/local/lib/libyang.so* ${TMPDIR}/usr/local/lib/ cp /tmp/${PACKAGE}/${PACKAGE}-${VERSION}/LICENSE $TMPDIR/usr/local/share/doc/${PACKAGE}/ mv ${DESTDIR}/usr/local/share/yang/modules/libyang ${TMPDIR}/usr/local/share/yang/modules/ ################################################### # Create info file # ################################################### cd /tmp/submit/ if [ $ARCH == "i686" ] then cat < ${PACKAGE}.tcz.info Title: ${PACKAGE}.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: 2022/03/24 first version, 2.0.164 (rhermsen) ${TODAY} updated version, ${VERSION} ${ME} Current: ${TODAY} updated version, ${VERSION} (${ME}) EOF elif [ $ARCH == "x86_64" ] then cat < ${PACKAGE}.tcz.info Title: ${PACKAGE}.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: ${TODAY} first version, ${VERSION} (${ME}) Current: ${TODAY} first version, ${VERSION} (${ME}) EOF fi ################################################### # Create .dep file # ################################################### cat < ${PACKAGE}.tcz.dep pcre2.tcz EOF mkdir -p ${TMPDIR}-doc/usr/local/share/man/man1/ mv ${DESTDIR}/usr/local/share/man/man1/* ${TMPDIR}-doc/usr/local/share/man/man1/ ################################################### # Create info file # ################################################### cd /tmp/submit/ if [ $ARCH == "i686" ] then sudo cat < ${PACKAGE}-doc.tcz.info Title: ${PACKAGE}-doc.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: 2022/03/24 first version, 2.0.164 (rhermsen) ${TODAY} updated version, ${VERSION} ${ME} Current: ${TODAY} first version, ${VERSION} (${ME}) EOF elif [ $ARCH == "x86_64" ] then sudo cat < ${PACKAGE}-doc.tcz.info Title: ${PACKAGE}-doc.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: ${TODAY} first version, ${VERSION} (${ME}) Current: ${TODAY} first version, ${VERSION} (${ME}) EOF fi ################################################### # Create info file # ################################################### cd /tmp/submit/ if [ $ARCH == "i686" ] then cat < ${PACKAGE}-dev.tcz.info Title: ${PACKAGE}-dev.tcz Description: ${DEVDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${DEVTAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: 2022/03/24 first version, 2.0.164 (rhermsen) 2022/04/13 Fixed missing dependency, 2.0.164 (rhermsen) ${TODAY} updated version, ${VERSION} (${ME}) Current: ${TODAY} updated version, ${VERSION} (${ME}) EOF elif [ $ARCH == "x86_64" ] then cat < ${PACKAGE}-dev.tcz.info Title: ${PACKAGE}-dev.tcz Description: ${DEVDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${DEVTAGS} Comments: libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. Change-log: ${TODAY} first version, ${VERSION} (${ME}) Current: ${TODAY} first version, ${VERSION} (${ME}) EOF fi mkdir -p $TMPDIR-dev/usr/local/lib/pkgconfig mv $DESTDIR/usr/local/lib/pkgconfig/*.pc ${TMPDIR}-dev/usr/local/lib/pkgconfig mv $DESTDIR/usr/local/include $TMPDIR-dev/usr/local ################################################### # Create .dep file # ################################################### cat < /tmp/submit/${PACKAGE}-dev.tcz.dep ${PACKAGE}.tcz pcre2-dev.tcz EOF find $TMPDIR/ -type d | xargs chmod -v 755; find $TMPDIR | xargs file | grep ELF | cut -f 1 -d : | xargs sudo strip --strip-unneeded cd $TMPDIR find $TMPDIR -perm 777 -exec chmod 755 {} \; find $TMPDIR -perm 555 -exec chmod 755 {} \; find $TMPDIR -perm 444 -exec chmod 644 {} \; find $TMPDIR -perm 666 -exec chmod 644 {} \; find $TMPDIR -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR cd /tmp/submit/ mksquashfs $TMPDIR ${PACKAGE}.tcz cd $TMPDIR sudo sh -c "find usr -not -type d > ${PACKAGE}.tcz.list" sudo mv ../${PACKAGE}.tcz . sudo mv ../${PACKAGE}.tcz.dep . sudo mv ../${PACKAGE}.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}.tcz > ${PACKAGE}.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr ################################################### # create documentation extension # ################################################### cd $TMPDIR-doc find $TMPDIR-doc -perm 777 -exec chmod 755 {} \; find $TMPDIR-doc -perm 555 -exec chmod 755 {} \; find $TMPDIR-doc -perm 444 -exec chmod 644 {} \; find $TMPDIR-doc -perm 666 -exec chmod 644 {} \; find $TMPDIR-doc -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR-doc cd /tmp/submit/ mksquashfs $TMPDIR-doc ${PACKAGE}-doc.tcz cd $TMPDIR-doc sudo sh -c "find usr -not -type d > ${PACKAGE}-doc.tcz.list" sudo mv ../${PACKAGE}-doc.tcz . sudo mv ../${PACKAGE}-doc.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}-doc.tcz > ${PACKAGE}-doc.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr ################################################### # Create dev extension in temp dir # ################################################### cd $TMPDIR-dev find $TMPDIR-dev -perm 777 -exec chmod 755 {} \; find $TMPDIR-dev -perm 555 -exec chmod 755 {} \; find $TMPDIR-dev -perm 444 -exec chmod 644 {} \; find $TMPDIR-dev -perm 666 -exec chmod 644 {} \; find $TMPDIR-dev -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR-dev cd .. mksquashfs $TMPDIR-dev ${PACKAGE}-dev.tcz cd $TMPDIR-dev sudo sh -c "find usr -not -type d > ${PACKAGE}-dev.tcz.list" sudo mv ../${PACKAGE}-dev.tcz* . #sudo mv /tmp/${PACKAGE}/${PACKAGE}-dev.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}-dev.tcz > ${PACKAGE}-dev.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr