#!/bin/sh set -e # exit on any error APPNAME='linuxcnc' VERSION=${VERSION:-'2.7.15'} ARCH="" # will test later, or put your own BUILD=${BUILD:-1} TAG=${TAG:-'_vii'} # Setting paths: CWD=$(pwd) OUTPUT=$CWD # tar.gz goes to current directory [ "$TMP" = "" ] && TMP=/tmp # set to /tmp if $TMP is empty # 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 cd $TMP # change to the TMP directory ## 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 ## checking out our version: #git checkout v$VERSION # for example checkout v2.7.15 #git pull # 2. or downloading the 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 ## Version check: #[ `cat VERSION` = $VERSION ] || echo "Version mismatch!"; exit 1 cd src # changing to compiling directory # Fixing the linkage issue (github.com/LinuxCNC/linuxcnc/issues/181): sed -i 's/LIBREADLINE=-lreadline/LIBREADLINE=$(READLINE_LIBS)/' \ emc/sai/Submakefile # Fixing module_helper (adding rtai_shm to the module_whitelist[]: sed -i 's/\("rtai_smi",\)/\1 "rtai_shm", /' \ module_helper/module_helper.c # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then case "$( uname -m )" in i386) ARCH=i386 ;; i486) ARCH=i486 ;; i586) ARCH=i586 ;; i686) ARCH=i686 ;; x86_64) ARCH=x86_64;; arm*) ARCH=arm ;; # Unless $ARCH is set, use uname -m for all other archs: *) ARCH=$( uname -m ) ;; esac fi if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mtune=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" else SLKCFLAGS="-O2" fi # Building the thing: ./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 clean make make setuid make install DESTDIR=$PKG # Create the install directory and copy the slack-desc into it mkdir -p $PKG/install cat <> $PKG/install/slack-desc linuxcnc: linuxcnc (CNC machine controller) linuxcnc: linuxcnc: LinuxCNC controls CNC machines. It can drive milling machines, linuxcnc: lathes, 3d printers, laser cutters, plasma cutters, robot arms, linuxcnc: hexapods, and more. linuxcnc: linuxcnc: http://linuxcnc.org linuxcnc: linuxcnc: linuxcnc: linuxcnc: EOT # Reserved for doinst.sh # Build the package cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$APPNAME-$VERSION-$ARCH-$BUILD$TAG.tgz