#!/bin/sh -e APPNAME="linuxcnc" VERSION="2.7.15" PKG_VERSION="2.7.15" BUILD=${BUILD:-1_vii} # Setting paths: CWD=$(pwd) if [ "$TMP" = "" ]; then TMP=/tmp fi # The installation directory of the package: PKG=$TMP/package-$APPNAME-$VERSION # Delete the leftover directories if they exist (due to a previous # build) and (re)create the packaging directory rm -rf $PKG mkdir -p $TMP $PKG rm -rf $TMP/$APPNAME-$VERSION # Change to the TMP directory cd $TMP || exit 1 # Getting the sources. # 1. either by cloning the repository: SOURCE_DIR="$APPNAME-$VERSION" GIT_REPO="https://github.com/LinuxCNC/$APPNAME.git" git clone $GIT_REPO $SOURCE_DIR cd $SOURCE_DIR || exit 1 # checking out our version: git checkout v$VERSION git pull ## 2. or downloding an archive: #wget -c https://github.com/LinuxCNC/$APPNAME/archive/v$VERSION.tar.gz #tar xvzf v$VERSION.tar.gz #SOURCE_DIR=$APPNAME-$VERSION ## Eng getting the sorces. # #cd $SOURCE_DIR || exit 1 ## Version check: #$declared_version = `cat VERSION` #[ $declared_version -eq $VERSION ] || echo "Version mismatch!"; exit 1 cd src || exit 1 # Fixing a linkage issue (github.com/LinuxCNC/linuxcnc/issues/181): sed -i 's/LIBREADLINE=-lreadline/LIBREADLINE=$(READLINE_LIBS)/' \ emc/sai/Submakefile # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i486 ;; arm*) ARCH=arm ;; # Unless $ARCH is set, use uname -m for all other archs: *) ARCH=$( uname -m ) ;; esac fi if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi # Building: make clean ./autogen.sh CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --libdir=/usr/lib \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --docdir=/usr/doc/$APPNAME-$VERSION \ --enable-shared \ --disable-static \ --enable-non-distributable=yes \ --with-realtime=/usr/realtime \ --with-x \ --build=$ARCH-slackware-linux \ --host=$ARCH-slackware-linux make || exit 1 make setuid make install DESTDIR=$PKG || exit 1 # Create the ./install directory and copy the slack-desc into it mkdir -p $PKG/install echo \ 'appname: linuxcnc-2.7.15 CNC machine controller appname: appname: LinuxCNC controls CNC machines. It can drive milling machines, appname: lathes, 3d printers, laser cutters, plasma cutters, robot arms, appname: hexapods, and more. appname: appname: appname: appname: appname: appname: The homepage: http://linuxcnc.org.' \ > $PKG/install/slack-desc # Build the package cd $PKG /sbin/makepkg -l y -c n $CWD/$APPNAME-$PKG_VERSION-$ARCH-$BUILD.tgz