#!/bin/sh # ###################################################### ## Build script for Core 9.0 # ## # ## See .info for details # ###################################################### ###################################################### # Configure extension creation parameters # ###################################################### # Variables EXTNAM=protobuf VERSION="3.5.1" # version 3.6.x look to require -march=i586 as compiler flag for CXXFLAGS. SRCNAM=v$VERSION.tar.gz WRKDIR=$EXTNAM-$VERSION BASEDIR=/tmp/$EXTNAM SRCDIR=/tmp/$EXTNAM/source TMPDIR=/tmp/$EXTNAM/package DESTDIR=/tmp/$EXTNAM/build TODAY=`date +%Y/%m/%d` DESCRIPTION="Protocol Buffers - Google's data interchange format" DOCDESCRIPTION="Documentation part of Protocol Buffers - Google's data interchange format" DEVDESCRIPTION="Development files part of Protocol Buffers - Google's data interchange format" AUTHORS="Google Inc." HOMEPAGE="https://developers.google.com/protocol-buffers/" LICENSE="Copyright 2008 Google Inc. All rights reserved." ME="rhermsen" TAGS="protobuf protocol buffers" DOCTAGS="man pages protobuf protocol buffers" DEVTAGS="development protobuf protocol buffers" ###################################################### # Prepare extension creation # ###################################################### tce-load -wi ca-certificates.tcz echo "ca_directory = /usr/local/etc/ssl/certs" > ~/.wgetrc # Compile tools: tce-load -wi compiletc.tcz tce-load -wi squashfs-tools.tcz tce-load -wi autoconf.tcz tce-load -wi automake.tcz tce-load -wi libtool-dev.tcz #tce-load -wi libtool.tcz tce-load -wi curl.tcz #tce-load -wi libltdl.tcz #tce-load -wi pkg-config.tcz #tce-load -wi intltool.tcz # Other tce-load -wi ipv6-KERNEL.tcz # Remove dirs and files left from previous creation rm -r -f $SRCDIR 2>/dev/null rm -r -f $WRKDIR 2>/dev/null rm -r -f $DESTDIR 2>/dev/null sudo rm -r -f $TMPDIR 2>/dev/null sudo rm -r -f $TMPDIR-doc 2>/dev/null sudo rm -r -f $TMPDIR-dev 2>/dev/null ###################################################### # Compile extension # ###################################################### # Export variables needed for compilation export CFLAGS="-Os -pipe -march=i486 -mtune=i686" # http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/C_002b_002b-Dialect-Options.html #export CXXFLAGS="-O2 -pipe -fno-exceptions -fno-rtti -march=i486 -mtune=i686" #export CXXFLAGS="-O2 -pipe -fno-exceptions -march=i486 -mtune=i686" # For compiling 3.x use -D_GLIBCXX_USE_C99_MATH with CXXFLAGS # For compiling 3.6.x use -march=i586 with CXXFLAGS export CXXFLAGS="-Os -pipe -fno-exceptions -march=i486 -mtune=i686 -D_GLIBCXX_USE_C99_MATH" #export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Download source in SRCDIR # wget --no-check-certificate #git -c http.sslVerify=false mkdir -p $SRCDIR cd $SRCDIR wget https://github.com/google/protobuf/archive/$SRCNAM # Unpack source in current directory tar -xzf $SRCNAM cd $WRKDIR #Trying to correct 'mathlimits.h:238:20: error: '__builtin_isinf_xxxx' is not a member of 'std'' #Instead of below two lines use -D_GLIBCXX_USE_C99_MATH as additional CXXFLAGS. #sed -i 's/#include /#include /g' ./src/google/protobuf/stubs/mathlimits.h #sed -i '/#define GOOGLE_PROTOBUF_USE_STD_CMATH/d' ./src/google/protobuf/stubs/mathlimits.h # Create configure script # below lines where for compiling protobuf 2.x # https://github.com/datacratic/protobuf/issues/2 #curl -k #sed -i 's/curl http:\/\/googletest.googlecode.com.*jx/curl -L https:\/\/github.com\/google\/googletest\/archive\/release-1.5.0.tar.gz | tar zx/g' ./autogen.sh #sed -i 's/mv gtest-1.5.0 gtest/mv googletest-release-1.5.0 gtest/g' ./autogen.sh ./autogen.sh # Configure it ./configure --prefix=/usr/local \ --sysconfdir=/usr/local/etc/$EXTNAM \ --localstatedir=/var/$EXTNAM # Compile # https://github.com/google/protobuf/issues/3930 # increase memory from 256MB to 1024MB make mkdir -p $DESTDIR make DESTDIR=$DESTDIR install # Install in base temp dir mkdir -p $TMPDIR/usr/local/bin mkdir -p $TMPDIR/usr/local/lib mkdir -p $TMPDIR/usr/local/share/doc/$EXTNAM mv $DESTDIR/usr/local/bin/* $TMPDIR/usr/local/bin mv $DESTDIR/usr/local/lib/*.so* $TMPDIR/usr/local/lib/ cp $SRCDIR/$WRKDIR/LICENSE $TMPDIR/usr/local/share/doc/$EXTNAM/ ################################################### # Create info file # ################################################### cat < /tmp/$EXTNAM/${EXTNAM}.tcz.info Title: ${EXTNAM}.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: A language-neutral, platform-neutral, way of serializing structured data. Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format. Change-log: 2018/07/14 First Version, 2.6.1 ${TODAY} Update to a later version, $VERSION Current: ${TODAY} Update to a later version, $VERSION EOF # Delete compilation work directory cd .. #rm -r -f $WRKDIR # Adjust directory access rigths find $TMPDIR/ -type d | xargs chmod -v 755; # Strip executables find $TMPDIR | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded ################################################### # Create info file # ################################################### cat < /tmp/$EXTNAM/${EXTNAM}-dev.tcz.info Title: ${EXTNAM}-dev.tcz Description: ${DEVDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${DEVTAGS} Comments: A language-neutral, platform-neutral, way of serializing structured data. Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format. Change-log: 2018/07/14 First Version, 2.6.1 ${TODAY} Update to a later version, $VERSION Current: ${TODAY} Update to a later version, $VERSION EOF mkdir -p $TMPDIR-dev/usr/local/lib mkdir -p $TMPDIR-dev/usr/local/include mkdir -p $TMPDIR-dev/usr/local/lib/pkgconfig mv $DESTDIR/usr/local/lib/*.la $TMPDIR-dev/usr/local/lib/ mv $DESTDIR/usr/local/lib/*.a $TMPDIR-dev/usr/local/lib/ mv $DESTDIR/usr/local/include $TMPDIR-dev/usr/local/ mv $DESTDIR/usr/local/lib/pkgconfig/*.pc $TMPDIR-dev/usr/local/lib/pkgconfig ################################################### # Create .dep file # ################################################### cat < /tmp/$EXTNAM/${EXTNAM}-dev.tcz.dep ${EXTNAM}.tcz EOF ################################################### # Create base extension in temp dir # ################################################### 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 #sudo chown -R tc:staff $TMPDIR/usr/local/etc/$EXTNAM #sudo chown -R root:staff $TMPDIR/usr/local/tce.installed #sudo chmod -R 775 $TMPDIR/usr/local/tce.installed cd .. mksquashfs $TMPDIR $EXTNAM.tcz cd $TMPDIR sudo sh -c "find usr -not -type d > $EXTNAM.tcz.list" sudo mv ../$EXTNAM.tcz* . #sudo mv /tmp/${EXTNAM}/${EXTNAM}.tcz.info . # Create md5 file sudo sh -c "md5sum $EXTNAM.tcz > $EXTNAM.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 $EXTNAM-dev.tcz cd $TMPDIR-dev sudo sh -c "find usr -not -type d > $EXTNAM-dev.tcz.list" sudo mv ../$EXTNAM-dev.tcz* . #sudo mv /tmp/${EXTNAM}/${EXTNAM}-dev.tcz.info . # Create md5 file sudo sh -c "md5sum $EXTNAM-dev.tcz > $EXTNAM-dev.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr