1#!/bin/sh -x 2GC=7.6.2 3 4MACHINE=`uname -m` 5if [ $MACHINE == i686 ]; then 6BINDIR=i386-windows 7else 8BINDIR=x86_64-windows 9fi 10SHARED=~/shared/asy 11MAKEFLAGS=-j8 12export MAKEFLAGS 13VERSION=$1 14if [ -z $VERSION ]; then 15VERSION=`grep AC_INIT configure.ac | cut -s -d[ -f3 | cut -s -d] -f1` 16if [ -z $VERSION ]; then 17echo Usage: $0 VERSION 18exit 19fi 20else 21echo Building asymptote-$VERSION 22cd ~/ 23rm -rf asymptote-$VERSION 24mkdir -p CTAN 25rm -rf CTAN/asymptote-$VERSION 26tar -zxf $SHARED/asymptote-$VERSION.src.tgz -C CTAN 27tar -zxf $SHARED/asymptote-$VERSION.src.tgz 28mkdir -p CTAN/asymptote-$VERSION/binaries/$BINDIR/texlive 29cd asymptote-$VERSION 30fi 31BUILD=build-$VERSION 32ln -sf ../gc-$GC.tar.gz . 33ln -sf ../gc-$GC . 34make -n MSDOS=1 >& /dev/null || ./configure OSTYPE=msdos --enable-gc=$GC --with-latex=/usr/local/share --with-context=/usr/local/share 35rm -rf $BUILD 36mkdir -p $BUILD 37cp -a $HOME/dll/cygwin/*.dll $BUILD 38cp /etc/pki/tls/certs/ca-bundle.crt $BUILD 39chmod 0644 $BUILD/*.dll 40cp -a $BUILD/*.dll ~/CTAN/asymptote-$VERSION/binaries/$BINDIR/ 41make MSDOS=1 DESTDIR="$BUILD/" docdir="$BUILD/" 42test -f asy.list || make MSDOS=1 keywords DESTDIR="$BUILD/" docdir="$BUILD/" 43make MSDOS=1 install-asy DESTDIR="$BUILD/" docdir="$BUILD/" 44cp asy.ico README LICENSE* $BUILD 45pushd $BUILD 46mv usr/local/bin/* . 47mv usr/local/share/asymptote/GUI . 48rm -rf usr/local/share/asymptote/GUI 49mv usr/local/share/asymptote/* . 50cp $SHARED/asydoc/*.pdf . 51rm -rf bin share doc usr 52popd 53echo \!define PRODUCT_VERSION \"$VERSION\" > AsymptoteInstallInfo.nsi 54# generate uninstallation commands 55ls -p1 $BUILD \ 56 | awk '{ if(index($0,"/")==length($0)) print "RMDir /r $INSTDIR\\" substr($0,0,length($0)-1); else print "Delete $INSTDIR\\" $0 }' \ 57 > AsymptoteUninstallList.nsi 58 59rm $BUILD/xasy 60if [ $MACHINE == i686 ]; then 61sed asymptote.nsi -e 's/$PROGRAMFILES64/$PROGRAMFILES/g' > asymptote32.nsi 62/cygdrive/c/Program\ Files\ \(x86\)/NSIS/makensis.exe asymptote32.nsi 63SUFFIX=-i386_32 64else 65/cygdrive/c/Program\ Files\ \(x86\)/NSIS/makensis.exe asymptote.nsi 66SUFFIX= 67fi 68cp -a --no-preserve=mode asymptote-$VERSION-setup.exe $SHARED/asymptote-$VERSION-setup$SUFFIX.exe 69mv asymptote-$VERSION-setup.exe ~/asymptote-$VERSION-setup$SUFFIX.exe 70 71cd ~/ 72rm -rf asymptote-${VERSION}TL || exit 73cp -a asymptote-$VERSION asymptote-${VERSION}TL 74sed asymptote-$VERSION/config.h -e 's/ASYMPTOTE_SYSDIR ".*"/ASYMPTOTE_SYSDIR ""/g' > asymptote-${VERSION}TL/config.h 75#sed asymptote-$VERSION/configure.ac -e 's/\-std=c++11//g' > asymptote-${VERSION}TL/configure.ac 76touch -r asymptote-$VERSION/config.h asymptote-${VERSION}TL/config.h 77touch -r asymptote-$VERSION/configure.ac asymptote-${VERSION}TL/configure.ac 78cd asymptote-${VERSION}TL 79rm settings.o 80rm -f doc/*.aux doc/*.log doc/*.dvi 81make MSDOS=1 DESTDIR="$BUILD/" 82make MSDOS=1 install-asy DESTDIR="$BUILD/" 83mv $BUILD/usr/local/bin/asy.exe $BUILD 84cp $BUILD/asy.exe ~/CTAN/asymptote-$VERSION/binaries/$BINDIR/texlive 85cp -a configure.ac ~/CTAN/asymptote-$VERSION/ 86cp -a $SHARED/asydoc/* ~/CTAN/asymptote-$VERSION/doc 87cd ~/CTAN/asymptote-$VERSION/binaries/$BINDIR 88cp -a ../../README . 89cd ~/CTAN 90cp -a ~/asymptote/build-scripts/README-binaries asymptote-$VERSION/binaries/$BINDIR/texlive/README 91SHAREDBIN=$SHARED/CTAN/asymptote-$VERSION 92if [ $MACHINE == i686 ]; then 93mkdir -p $SHAREDBIN 94cp -a asymptote-$VERSION/binaries/$BINDIR $SHAREDBIN 95else 96cp -a $SHAREDBIN/i386-windows ~/CTAN/asymptote-$VERSION/binaries 97fi 98tar cfz asymptote-$VERSION-CTAN.tgz asymptote-$VERSION 99cp -a --no-preserve=mode asymptote-$VERSION-CTAN.tgz $SHARED 100