Merge branch 'fbsdbuild' into msys2

This commit is contained in:
Don Bright 2016-10-26 21:02:42 -05:00
commit d1f4c775f8
28 changed files with 1155 additions and 2105 deletions

130
README.md
View file

@ -33,7 +33,7 @@ STL and OFF file formats.
# Getting started
You can download the latest binaries of OpenSCAD at
<http://www.openscad.org>. Install binaries as you would any other
<http://www.openscad.org/downloads>. Install binaries as you would any other
software.
When you open OpenSCAD, you'll see three frames within the window. The
@ -84,10 +84,9 @@ To build OpenSCAD, you need some libraries and tools. The version
numbers in brackets specify the versions which have been used for
development. Other versions may or may not work as well.
If you're using a newer version of Ubuntu, you can install these
libraries from aptitude. If you're using Mac, or an older Linux/BSD, there
are build scripts that download and compile the libraries from source.
Follow the instructions for the platform you're compiling on below.
There are helper scripts that may be able to assist you in downloading
and/or building these dependencies on your machine. Please follow the
instructions for the platform you're compiling on below.
* A C++ compiler supporting C++11
* [Qt (4.4 -> 5.x)](http://qt.io/)
@ -108,15 +107,21 @@ Follow the instructions for the platform you're compiling on below.
* [Flex (2.5.35 -> )](http://flex.sourceforge.net/)
* [pkg-config (0.26 -> )](http://www.freedesktop.org/wiki/Software/pkg-config/)
Note that many of these package in turn have their own dependencies not
listed here. These will typically be installed automatically by the
package manager on your system when you install the packages listed above.
### Getting the source code
Install git (http://git-scm.com/) onto your system. Then run a clone:
Install git (http://git-scm.com/) onto your system. The package may be
called 'git-core' or 'scmgit' on some systems. Then run a clone:
git clone git://github.com/openscad/openscad.git
This will download the latest sources into a directory named 'openscad'.
To pull the MCAD library (http://reprap.org/wiki/MCAD), do the following:
Now cd into the openscad directory and pull the MCAD library
(http://reprap.org/wiki/MCAD):
cd openscad
git submodule update --init
@ -158,101 +163,84 @@ Then run the script to compile all the dependencies:
sudo port install opencsg qscintilla boost cgal pkgconfig eigen3 harfbuzz fontconfig
### On Windows
### Building for Linux/BSD
First, make sure that you have git installed (often packaged as 'git-core'
or 'scmgit'). Once you've cloned this git repository, download and install
the dependency packages listed above using your system's package
manager. A convenience script is provided that can help with this
process on some systems:
sudo ./scripts/uni-get-dependencies.sh
After installing dependencies, check their versions. You can run this
script to help you:
./scripts/check-dependencies.sh
Take care that you don't have old local copies anywhere (/usr/local/).
If all dependencies are present and of a high enough version, skip ahead
to the Compilation instructions.
### Building for Windows
OpenSCAD for Windows can be built using the MSYS2 system. First,
download and install MSYS2 from
OpenSCAD can be built on Windows using the MSYS2 system. First, download
and install MSYS2 from
http://msys2.github.io
Please make sure to carefully follow the instructions to fully update your
MSYS2 installation.
MSYS2 installation. This may take several hours and GB of space. Then continue
Now start a new clean MSYS2-MINGW 64bit shell and run the script that
sets up the environment variables.
### Building on Linux, BSD, or MSYS2
The basic formula is the same for all of these platforms. First, setup environment
variables.
source ./scripts/setenv.sh
Then run the script to download & compile all the prerequisite libraries above:
Then get dependencies
./scripts/msys2-get-dependencies.sh
sudo ./scripts/get-dependencies.sh
Next, build OpenSCAD and package it to an installer and/or .zip archive:
Build Makefile with qmake, then make binary
./scripts/release-common.sh
If you only want to build openscad.exe, not make a package, then run this
qmake CONFIG=Release
qmake
make
### Cross building
To build an installable package for your system, run
To cross-build, first make sure that you have all necessary dependencies
of the MXE project ( listed at http://mxe.cc/#requirements ). Don't install
MXE itself, the scripts below will do that for you under $HOME/openscad_deps/mxe
./scripts/make_package.sh
Then get your development tools installed to get GCC. Then after you've
cloned this git repository, start a new clean bash shell and run the
script that sets up the environment variables.
The resulting package will be under the bin/ directory. It supports
Debian gdebi style .deb, Windows .exe/.zip, and Mac .dmg
source ./scripts/setenv-mingw-xbuild.sh 64
### Linux without root
Fist run the script that sets up the environment variables.
Use the linuxbrew setenv option. It installs dependencies into
$HOME/.linuxbrew using the Linuxbrew / Homebrew packaging system.
source ./scripts/setenv.sh
source ./scripts/setenv.sh homebrew
./scripts/get-dependencies.sh
qmake && make
./scripts/mingw-x-build-dependencies.sh 64
### Cross build from linux to Windows with MXE.cc
Note that this process can take several hours, and tens of gigabytes of
disk space, as it uses the http://mxe.cc system to cross-build many
libraries. After it is complete, build OpenSCAD and package it to an
installer:
This setenv option will setup a cross compiler, so that you can build
Windows binaries on a Linux build machine. These instructions will also
work using "Bash on Ubuntu on Windows" running under the Windows Linux
Subsystem included with Windows 10.
./scripts/release-common.sh mingw64
First install MXE requirements from <http://mxe.cc/#requirements>. Then run
This is how official releases are created. It uses the http://mxe.cc
cross-build system. See doc/win-cross-build.txt for more information.
source ./scripts/setenv.sh mingw64
./scripts/get-dependencies.sh
qmake && make
cd mingw64
qmake ../openscad.pro CONFIG+=mingw-cross-env
make
Use mingw32 if you wish a 32 bit build.
For a 32-bit Windows cross-build, replace 64 with 32 in the above instructions.
### Test suite
### Compilation
To run the self-tests, first build the main openscad program above, then run
First, run 'qmake openscad.pro' from Qt to generate a Makefile.
cd tests
cmake .
make
ctest
On some systems, depending on which version(s) of Qt you have installed, you may need to specify which version you want to use, e.g. by running 'qmake4', 'qmake-qt4', 'qmake -qt=qt5', or something alike.
### Problems building
Then run make. Finally you might run 'make install' as root or simply copy the
'openscad' binary (OpenSCAD.app on Mac OS X) to the bin directory of your choice.
If you had problems compiling from source, raise a new issue in the
If you had problems compiling from source, please raise a new issue in the
[issue tracker on the github page](https://github.com/openscad/openscad/issues).
On some systems, depending on which version(s) of Qt you have installed,
you may need to specify which version you want to use, e.g. by running
'qmake4', 'qmake-qt4', 'qmake -qt=qt5', or something alike.
See doc/testing.txt for more information on test builds.
This site and it's subpages can also be helpful:
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_OpenSCAD_from_Sources
Thank you for using OpenSCAD.

View file

@ -21,6 +21,11 @@ FONTCONFIG_DIR = $$(FONTCONFIGDIR)
}
}
!exists($$FONTCONFIG_INCLUDEPATH/fontconfig.h) {
FONTCONFIG_INCLUDEPATH =
FONTCONFIG_LIBPATH =
}
isEmpty(FONTCONFIG_INCLUDEPATH) {
FONTCONFIG_CFLAGS = $$system("pkg-config --cflags fontconfig")
} else {

View file

@ -12,7 +12,7 @@ gettext {
OPENSCAD_LIBRARIES_DIR = $$(OPENSCAD_LIBRARIES)
GETTEXT_DIR = $$(GETTEXTDIR)
macx: {
macx|freebsd*: {
isEmpty(GETTEXT_INCLUDEPATH) {
!isEmpty(OPENSCAD_LIBRARIES_DIR) {
GETTEXT_INCLUDEPATH = $$OPENSCAD_LIBRARIES_DIR/include

View file

@ -20,6 +20,11 @@ LIBXML2_DIR = $$(LIBXML2DIR)
}
}
!exists($$LIBXML2_INCLUDEPATH/libxml/xmlversion.h) {
LIBXML2_INCLUDEPATH =
LIBXML2_LIBPATH =
}
isEmpty(LIBXML2_INCLUDEPATH) {
LIBXML2_CFLAGS = $$system("pkg-config --cflags libxml-2.0")
} else {

View file

@ -1,3 +1,4 @@
<<<<<<< HEAD
# cross compilation unix->win using the MXE system (mxe.cc)
# To use mostly static lib linking, pass CONFIG+=mingw-cross-env to qmake
# To use mostly shared lib DLL linking, pass CONFIG+=mingw-cross-env-shared
@ -26,14 +27,45 @@ CONFIG(mingw-cross-env): {
LIBS += $$(MXE_SYS_DIR_STATIC)/lib/libexpat.a
LIBS += $$(MXE_SYS_DIR_STATIC)/lib/libintl.a
LIBS += $$(MXE_SYS_DIR_STATIC)/lib/libiconv.a
=======
# cross compilation unix->win32
# depends on env variables set under scripts/setenv-mingw-xbuild.sh
CONFIG(mingw-cross-env) {
LIBS += $$_MXE_TARGET_DIR/lib/libglew32s.a
LIBS += $$_MXE_TARGET_DIR/lib/libglut.a
LIBS += $$_MXE_TARGET_DIR/lib/libopengl32.a
LIBS += $$_MXE_TARGET_DIR/lib/libGLEW.a
# exists( $$_MXE_TARGET_DIR/lib/libglaux.a ) {
# LIBS += $$_MXE_TARGET_DIR/lib/libglaux.a
# }
LIBS += $$_MXE_TARGET_DIR/lib/libglu32.a
LIBS += $$_MXE_TARGET_DIR/lib/libopencsg.a
LIBS += $$_MXE_TARGET_DIR/lib/libmpfr.a
LIBS += $$_MXE_TARGET_DIR/lib/libgmp.a
LIBS += $$_MXE_TARGET_DIR/lib/libCGAL.a
LIBS += $$_MXE_TARGET_DIR/lib/libfontconfig.a
LIBS += $$_MXE_TARGET_DIR/lib/libfreetype.a
LIBS += $$_MXE_TARGET_DIR/lib/libharfbuzz.a
LIBS += $$_MXE_TARGET_DIR/lib/libbz2.a
LIBS += $$_MXE_TARGET_DIR/lib/libexpat.a
LIBS += $$_MXE_TARGET_DIR/lib/libintl.a
LIBS += $$_MXE_TARGET_DIR/lib/libiconv.a
LIBS += $$_MXE_TARGET_DIR/lib/liblzma.a
>>>>>>> fbsdbuild
}
## Shared library link, to .dll files
CONFIG(mingw-cross-env-shared): {
# on MXE, the shared library .dll files are under 'bin' not 'lib'.
<<<<<<< HEAD
QMAKE_LFLAGS += -L./$$(MXE_SYS_DIR_SHARED)/bin
LIBS += -lgmp -lmpfr -lCGAL
LIBS += -lopencsg -lglew32 -lglut -lopengl32 -lGLEW -lglu32
=======
QMAKE_LFLAGS += -L./$$_MXE_TARGET_DIR/bin
LIBS += -lglew32 -lglut -lopengl32 -lGLEW -lglu32
LIBS += -lopencsg -lmpfr -lgmp -lCGAL
>>>>>>> fbsdbuild
LIBS += -lfontconfig -lfreetype -lharfbuzz -lbz2 -lexpat -lintl -liconv
}

View file

@ -122,13 +122,6 @@ win* {
QMAKE_CXXFLAGS += -DNOGDI
}
mingw* {
# needed to prevent compilation error on MSYS2:
# as.exe: objects/cgalutils.o: too many sections (76541)
# using -Wa,-mbig-obj did not help
debug: QMAKE_CXXFLAGS += -O1
}
CONFIG += qt
QT += widgets concurrent
@ -173,6 +166,7 @@ netbsd* {
QMAKE_CXXFLAGS_WARN_ON += -Wno-format-security
# might want to actually turn this on once in a while
QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare
QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-warning-option
}
CONFIG(skip-version-check) {
@ -213,6 +207,16 @@ mdi {
DEFINES += ENABLE_MDI
}
# config MINGW before other .pri includes
_MXE_TARGET_DIR = $$(MXE_TARGET_DIR)
!isEmpty(_MXE_TARGET_DIR) {
contains(_MXE_TARGET_DIR, shared) {
CONFIG += mingw-cross-env-shared
} else {
CONFIG += mingw-cross-env
}
}
include(common.pri)
# mingw has to come after other items so OBJECT_DIRS will work properly

View file

@ -1,453 +0,0 @@
#!/usr/bin/env bash
# build&upload script for linux & windows snapshot binaries
#
# Usage:
#
# Start with a clean directory. For example:
#
# mkdir builder
# cd builder
#
# Then run this script, or optionally the 'build only' or 'upload only' version
#
# /some/path/openscad/builder.sh # standard build & upload
# /some/path/openscad/builder.sh buildonly # only do build, dont upload
# /some/path/openscad/builder.sh uploadonly # only upload, dont build
# Notes:
#
# This script is designed to build a 'clean' version of openscad directly
# from the openscad github master source code. It will then optionally
# upload the build to the OpenSCAD official file repository, and modify
# the OpenSCAD website with links to the most recently built files.
#
#
# For the mingw- cross build for Windows(TM) this script does a massive
# 'from nothing' build, including downloading and building an MXE cross
# environment, and dependencies, into $HOME/openscad_deps. This can take
# many many many hours and use several gigabytes of disk space.
#
# This script itself is designed to call other scripts that do the heavy
# lifting. This script itself should be kept relatively simple.
#
#
# requirements -
# see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc)
#
# todo - can we build 32 bit linux from within 64 bit linux?
#
# todo - make linux work
#
# todo - detect failure and stop
#
# todo - generalize to build release binaries as well
#
init_variables()
{
#BRANCH_TO_BUILD=unstable
BRANCH_TO_BUILD=master
STARTPATH=$PWD
# kilobit (not kilobyte!) per second for scp upload
RATELIMIT=420
DOBUILD=1
DOUPLOAD=1
DRYRUN=
DOSNAPSHOT=1
DOLOOP=
#solar day
LOOPSLEEP=86400
DATECODE=`date +"%Y.%m.%d"`
if [ "`echo $* | grep loop`" ]; then
echo "----------------------------"
echo "loop mode activated! woopee!"
echo "----------------------------"
DOLOOP=1
fi
if [ "`echo $* | grep release`" ]; then
echo "this script cannot yet build releases, only snapshots"
DOSNAPSHOT=
exit 1
fi
if [ "`echo $* | grep uploadonly`" ]; then
DOUPLOAD=1
DOBUILD=
fi
if [ "`echo $* | grep buildonly`" ]; then
DOUPLOAD=
DOBUILD=1
fi
if [ "`echo $* | grep dry`" ]; then
DRYRUN=1
fi
export STARTPATH
export BRANCH_TO_BUILD
export DOBUILD
export DOUPLOAD
export DRYRUN
export DATECODE
export DOSNAPSHOT
export DOLOOP
export LOOPSLEEP
export RATELIMIT
export DATECODE
}
check_starting_path()
{
cd $STARTPATH
if [ -e openscad.pro ]; then
echo 'please start from a clean directory outside of openscad'
exit
fi
}
check_nsis()
{
# 64 bit mingw-cross build MXE cannot build nsis.... for now, we can
# just ask the user to install their system's nsis package.
# (it might be possible to d/l & build nsis here, or use pre-existing
# 32-bit-mxe nsis)
if [ ! "`command -v makensis`" ]; then
echo the makensis command was not found.
echo please install nsis for your system. for example
echo on debian, sudo apt-get install nsis
exit 1
else
echo makensis found.
fi
}
check_zip()
if [ ! "`command -v zip`" ]; then
echo the zip command was not found. please install zip
echo on debian, sudo apt-get install zip
exit 1
else
echo zip found.
fi
}
get_openscad_source_code()
{
if [ -d openscad ]; then
cd openscad
if [ $? -ne 0 ]; then
echo cd to 'openscad' directory failed
exit 1
fi
git checkout $BRANCH_TO_BUILD
if [ $? -ne 0 ]; then
echo git checkout $BRANCH_TO_BUILD failed
exit 1
fi
git fetch -a
if [ $? -ne 0 ]; then
echo git fetch -a openscad source code failed
exit 1
fi
git pull origin $BRANCH_TO_BUILD
if [ $? -ne 0 ]; then
echo git pull origin $BRANCH_TO_BUILD failed
exit 1
fi
git submodule update # MCAD
return
else
git clone http://github.com/openscad/openscad.git
fi
if [ $? -eq 0 ]; then
echo clone of source code is ok
else
if [ $DOUPLOAD ]; then
if [ ! $DOBUILD ]; then
echo upload only - skipping openscad git clone
fi
else
echo clone of openscad source code failed. exiting
exit 1
fi
fi
cd openscad
git checkout $BRANCH_TO_BUILD
if [ $? -ne 0 ]; then
echo git checkout $BRANCH_TO_BUILD failed
exit 1
fi
git submodule update --init # MCAD
}
build_win32()
{
. ./scripts/setenv-mingw-xbuild.sh clean
. ./scripts/setenv-mingw-xbuild.sh
./scripts/mingw-x-build-dependencies.sh
if [ $DOSNAPSHOT ] ; then
./scripts/release-common.sh snapshot mingw32 tests
else
echo "this script cant yet build releases, only snapshots"
exit 1
fi
if [ $? -eq 0 ]; then
echo build of win32 stage over
else
echo build of win32 failed. exiting
exit 1
fi
}
build_win64()
{
. ./scripts/setenv-mingw-xbuild.sh clean
. ./scripts/setenv-mingw-xbuild.sh 64
./scripts/mingw-x-build-dependencies.sh 64
if [ $DOSNAPSHOT ] ; then
./scripts/release-common.sh snapshot mingw64 tests
else
echo "this script cant yet build releases, only snapshots"
exit 1
fi
if [ $? -eq 0 ]; then
echo build of win64 stage over
else
echo build of win64 failed. exiting
exit 1
fi
}
build_lin32()
{
. ./scripts/setenv-unibuild.sh
./scripts/uni-build-dependencies.sh
if [ $DOSNAPSHOT ] ; then
./scripts/release-common.sh snapshot
else
echo "this script cant yet build releases, only snapshots"
exit 1
fi
}
upload_win_common()
{
summary="$1"
username=$2
filename=$3
if [ -f $filename ]; then
echo 'file "'$filename'" found'
else
echo 'file "'$filename'" not found'
exit 1
fi
opts=
opts="$opts -p openscad"
opts="$opts -u $username"
opts="$opts $filename"
remotepath=www/
if [ $DOSNAPSHOT ]; then
remotepath=www/snapshots/
fi
if [ $DRYRUN ]; then
echo dry run, not uploading to files.openscad.org
echo scp -v -l $RATELIMIT $filename openscad@files.openscad.org:$remotepath
else
scp -v -l $RATELIMIT $filename openscad@files.openscad.org:$remotepath
fi
}
upload_win32()
{
SUMMARY1="Windows x86-32 Snapshot Installer"
SUMMARY2="Windows x86-32 Snapshot Zipfile"
SUMMARY3="Windows x86-32 Snapshot Tests"
BASEDIR=./mingw32.static/
WIN32_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-32-Installer.exe
WIN32_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-32.zip
WIN32_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-32.zip
upload_win_common "$SUMMARY1" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE1
upload_win_common "$SUMMARY2" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE2
upload_win_common "$SUMMARY3" $USERNAME $BASEDIR/$WIN32_PACKAGEFILE3
export WIN32_PACKAGEFILE1
export WIN32_PACKAGEFILE2
export WIN32_PACKAGEFILE3
WIN32_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE1 | awk ' {print $1} ';`
WIN32_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE2 | awk ' {print $1} ';`
WIN32_PACKAGEFILE3_SIZE=`ls -sh $BASEDIR/$WIN32_PACKAGEFILE3 | awk ' {print $1} ';`
WIN32_PACKAGEFILE1_SIZE=`echo "$WIN32_PACKAGEFILE1_SIZE""B"`
WIN32_PACKAGEFILE2_SIZE=`echo "$WIN32_PACKAGEFILE2_SIZE""B"`
WIN32_PACKAGEFILE3_SIZE=`echo "$WIN32_PACKAGEFILE3_SIZE""B"`
export WIN32_PACKAGEFILE1_SIZE
export WIN32_PACKAGEFILE2_SIZE
export WIN32_PACKAGEFILE3_SIZE
}
upload_win64()
{
SUMMARY1="Windows x86-64 Snapshot Zipfile"
SUMMARY2="Windows x86-64 Snapshot Installer"
SUMMARY3="Windows x86-64 Snapshot Tests"
BASEDIR=./mingw64.static/
WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe
WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip
WIN64_PACKAGEFILE3=OpenSCAD-Tests-$DATECODE-x86-64.zip
upload_win_common "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1
upload_win_common "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2
upload_win_common "$SUMMARY3" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE3
export WIN64_PACKAGEFILE1
export WIN64_PACKAGEFILE2
export WIN64_PACKAGEFILE3
WIN64_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE1 | awk ' {print $1} ';`
WIN64_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE2 | awk ' {print $1} ';`
WIN64_PACKAGEFILE3_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE3 | awk ' {print $1} ';`
WIN64_PACKAGEFILE1_SIZE=`echo "$WIN64_PACKAGEFILE1_SIZE""B"`
WIN64_PACKAGEFILE2_SIZE=`echo "$WIN64_PACKAGEFILE2_SIZE""B"`
WIN64_PACKAGEFILE3_SIZE=`echo "$WIN64_PACKAGEFILE3_SIZE""B"`
export WIN64_PACKAGEFILE1_SIZE
export WIN64_PACKAGEFILE2_SIZE
export WIN64_PACKAGEFILE3_SIZE
}
read_username_from_user()
{
if [ $DRYRUN ]; then USERNAME=none;export USERNAME; return; fi
echo 'Google code upload is deprecated'
USERNAME=$USER
echo 'username is ' $USERNAME
return
echo 'Please enter your username for https://code.google.com/hosting/settings'
echo -n 'Username:'
read USERNAME
echo 'username is ' $USERNAME
return
}
read_password_from_user()
{
if [ $DRYRUN ]; then return; fi
echo 'Google code upload is deprecated'
return
echo 'Please enter your password for https://code.google.com/hosting/settings'
echo -n 'Password:'
read -s PASSWORD1
echo
echo -n 'Verify :'
read -s PASSWORD2
echo
if [ ! $PASSWORD1 = $PASSWORD2 ]; then
echo 'error - passwords dont match'
exit
fi
OSUPL_PASSWORD=$PASSWORD1
export OSUPL_PASSWORD
}
update_win_www_download_links()
{
cd $STARTPATH
rm -rf ./openscad.github.com
git clone git@github.com:openscad/openscad.github.com.git
cd openscad.github.com
cd inc
echo `pwd`
# BASEURL='https://openscad.googlecode.com/files/'
BASEURL='http://files.openscad.org/'
if [ $DOSNAPSHOT ]; then
BASEURL='http://files.openscad.org/snapshots/'
fi
mv win_snapshot_links.js win_snapshot_links.js.backup
rm win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT2_URL'] = '$BASEURL$WIN64_PACKAGEFILE2'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT3_URL'] = '$BASEURL$WIN64_PACKAGEFILE3'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT2_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT3_NAME'] = 'OpenSCAD Tests $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT1_SIZE'] = '$WIN64_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT2_SIZE'] = '$WIN64_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js
echo "fileinfo['WIN64_SNAPSHOT3_SIZE'] = '$WIN64_PACKAGEFILE3_SIZE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT1_URL'] = '$BASEURL$WIN32_PACKAGEFILE1'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT2_URL'] = '$BASEURL$WIN32_PACKAGEFILE2'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT3_URL'] = '$BASEURL$WIN32_PACKAGEFILE3'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT2_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT3_NAME'] = 'OpenSCAD Tests $DATECODE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT1_SIZE'] = '$WIN32_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT2_SIZE'] = '$WIN32_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js
echo "fileinfo['WIN32_SNAPSHOT3_SIZE'] = '$WIN32_PACKAGEFILE3_SIZE'" >> win_snapshot_links.js
echo 'modified win_snapshot_links.js'
PAGER=cat git diff
if [ ! $DRYRUN ]; then
git commit -a -m 'builder.sh - updated snapshot links'
git push origin master
else
echo dry run, not updating www links
fi
cd $STARTPATH
}
# FIXME: We might be running this locally and not need an ssh agent.
# Before checking $SSH_AUTH_SOCK, try 'ssh -T git@github.com' to verify that we
# can access github over ssh
check_ssh_agent()
{
if [ $DRYRUN ]; then echo 'skipping ssh, dry run'; return; fi
if [ $SSH_AUTH_SKIP ]; then
return
fi
if [ ! $SSH_AUTH_SOCK ]; then
echo 'please start an ssh-agent for github.com/openscad/openscad.github.com uploads'
echo 'for example:'
echo
echo ' ssh-agent > .tmp && source .tmp && ssh-add'
echo
echo 'to force a run anyway, set SSH_AUTH_SKIP environment variable to 1'
exit 1
fi
}
main()
{
init_variables $*
if [ $DOUPLOAD ]; then
check_ssh_agent
fi
check_starting_path
check_nsis
check_zip
read_username_from_user
read_password_from_user
get_openscad_source_code
if [ $DOBUILD ]; then
build_win32
build_win64
fi
if [ $DOUPLOAD ]; then
upload_win32
upload_win64
update_win_www_download_links
fi
}
if [ $DOLOOP ]; then
while [ 1 ]; do
init_variables $*
main $*
echo ---------------------------------------------------
echo main loop finished. repeating in $LOOPSLEEP seconds
echo ---------------------------------------------------
sleep $LOOPSLEEP
#if [ "`uname | grep -i linux`" ]; then
# rtcwake -m mem -s 86400
#fi
done
else
main $*
fi

View file

@ -1,766 +0,0 @@
/***************************************************************************
* *
* This is a pre-configured single file version of chrpath for linux. *
* It is used in the binary installer for OpenSCAD on Linux. *
* *
* This file has been created by running *
* cat *.h *.c | sed 's, *# *include *",//&,' > ../chrpath_linux.c *
* in the configured chrpath-0.13 source directory (as found in the debian *
* package repository as the original download site seams to be down). *
* *
* chrpath is licensed under the terms of GPLv2: *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* The Authors are: *
* *
* Geoffrey Keating <geoffk@ozemail.com.au> *
* Implemented first version of chrpath.c based on first version of *
* killrpath. *
* Peeter Joot <peeterj@ca.ibm.com> *
* Implemented first version of killrpath.c. *
* Petter Reinholdtsen <pere@hungry.com> *
* Collected both implementations and made userfriendly wrapper. *
* *
* With patches from: *
* *
* Darren Salt <linux@youmustbejoking.demon.co.uk> *
* David Hull <hull@paracel.com> *
* Bradford W. Johnson <bradford@math.umn.edu> *
* Thomas Anders <anders@hmi.de> *
* Tollef Fog Heen <tollef@add.no> *
* *
***************************************************************************/
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <elf.h> header file. */
#define HAVE_ELF_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define to 1 if you have the `getopt_long' function. */
#define HAVE_GETOPT_LONG 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <link.h> header file. */
#define HAVE_LINK_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/link.h> header file. */
/* #undef HAVE_SYS_LINK_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "chrpath"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "pere@hungry.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME ""chrpath""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""chrpath" "0.13""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "-chrpath-"
/* Define to the version of this package. */
#define PACKAGE_VERSION ""0.13""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.13"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
#ifndef PROTOS_H
#define PROTOS_H
#include <elf.h>
//#include "config.h"
#ifdef WORDS_BIGENDIAN
#define ELFDATA2 ELFDATA2MSB
#else
#define ELFDATA2 ELFDATA2LSB
#endif
#if SIZEOF_VOID_P == 8
#define Elf_Ehdr Elf64_Ehdr
#define ELFCLASS ELFCLASS64
#define Elf_Phdr Elf64_Phdr
#define Elf_Shdr Elf64_Shdr
#define Elf_Dyn Elf64_Dyn
#elif SIZEOF_VOID_P == 4
#define Elf_Ehdr Elf32_Ehdr
#define ELFCLASS ELFCLASS32
#define Elf_Phdr Elf32_Phdr
#define Elf_Shdr Elf32_Shdr
#define Elf_Dyn Elf32_Dyn
#else
#error "Unknown word size (SIZEOF_VOID_P)!"
#endif
int killrpath(const char *filename);
int chrpath(const char *filename, const char *newpath, int convert);
int elf_open(const char *filename, int flags, Elf_Ehdr *ehdr);
void elf_close(int fd);
int elf_find_dynamic_section(int fd, Elf_Ehdr *ehdr, Elf_Phdr *phdr);
const char *elf_tagname(int tag);
int elf_dynpath_tag(int tag);
#endif /* PROTOS_H */
/*
<URL:http://gcc.gnu.org/ml/gcc/1999-04n/msg01105.html>
Re: changing embedded RPATH in existing executables.
To: geoffk@ozemail.com.au
Subject: Re: changing embedded RPATH in existing executables.
From: <peeter_joot@VNET.IBM.COM> (peeter joot)
Date: Fri, 30 Apr 1999 16:14:44 -0400 (EDT)
Cc: peeterj@ca.ibm.com, egcs@cygnus.com, libc-hacker@cygnus.com, linux-gcc@vger.rutgers.edu
Reply-To: <peeter_joot@VNET.IBM.COM>
> _Changing_ is a little tricky, but the attached program strips rpaths
> from executables (I find it essential for debugging the binutils).
> It's endian-dependent, if you want this for x86 you can just change
> the occurrences of 'MSB' to 'LSB' and compile (I should really fix
> that).
Hi Geoff,
With your program as a guide (and some peeks into libbfd, elf.h, a bit
of the glibc dynamic loader code, objdump, and a hex-editor) I was able to
figure out enough to find and change the rpath string. That was fun!
This program assumes (unlike your original program) that there is only
one DT_RPATH tag in the dynamic section as even with multiple '-Wl,-rpath,'
commands in the link this seems to occur (they all get concatonated into
a : separated path).
Thanks for your help. If you want to use this on non-x86 you have to change
the occurances of LSB back to MSB:)
Peeter
--
*/
#ifdef HAVE_CONFIG_H
//# include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <elf.h>
#if defined(HAVE_LINK_H)
# include <link.h>
#endif /* HAVE_LINK_H */
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
//#include "protos.h"
/**
* Reads an ELF file, and reads or alters the RPATH setting.
*
* TODO:
* modify to add RPATH setting if none exists.
*/
int
chrpath(const char *filename, const char *newpath, int convert)
{
int fd;
Elf_Ehdr ehdr;
int i;
Elf_Phdr phdr;
Elf_Shdr shdr;
Elf_Dyn *dyns;
int rpathoff;
char * strtab;
char * rpath;
unsigned int rpathlen;
int oflags;
int rpath_dyns_index;
if (NULL == newpath && 0 == convert)
oflags = O_RDONLY;
else
oflags = O_RDWR;
fd = elf_open(filename, oflags, &ehdr);
if (fd == -1)
{
perror ("elf_open");
return 1;
}
if (0 != elf_find_dynamic_section(fd, &ehdr, &phdr))
{
perror("found no dynamic section");
return 1;
}
dyns = malloc(phdr.p_filesz);
if (dyns == NULL)
{
perror ("allocating memory for dynamic section");
return 1;
}
memset(dyns, 0, phdr.p_filesz);
if (lseek(fd, phdr.p_offset, SEEK_SET) == -1
|| read(fd, dyns, phdr.p_filesz) != (int)phdr.p_filesz)
{
perror ("reading dynamic section");
free(dyns);
return 1;
}
rpathoff = -1;
for ( rpath_dyns_index = 0; dyns[rpath_dyns_index].d_tag != DT_NULL;
++rpath_dyns_index )
{
if ( elf_dynpath_tag(dyns[rpath_dyns_index].d_tag) )
{
rpathoff = dyns[rpath_dyns_index].d_un.d_ptr;
break;
}
}
if (rpathoff == -1)
{
printf("%s: no rpath or runpath tag found.\n", filename);
free(dyns);
return 2;
}
if (lseek(fd, ehdr.e_shoff, SEEK_SET) == -1)
{
perror ("positioning for sections");
free(dyns);
return 1;
}
for (i = 0; i < ehdr.e_shnum; i++)
{
if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
{
perror ("reading section header");
free(dyns);
return 1;
}
if (shdr.sh_type == SHT_STRTAB)
break;
}
if (i == ehdr.e_shnum)
{
fprintf (stderr, "No string table found.\n");
free(dyns);
return 2;
}
strtab = (char *)malloc(shdr.sh_size);
if (strtab == NULL)
{
perror ("allocating memory for string table");
free(dyns);
return 1;
}
memset(strtab, 0, shdr.sh_size);
if (lseek(fd, shdr.sh_offset, SEEK_SET) == -1)
{
perror ("positioning for string table");
free(strtab);
free(dyns);
return 1;
}
if (read(fd, strtab, shdr.sh_size) != (int)shdr.sh_size)
{
perror ("reading string table");
free(strtab);
free(dyns);
return 1;
}
if ((int)shdr.sh_size < rpathoff)
{
fprintf(stderr, "%s string offset not contained in string table",
elf_tagname(dyns[rpath_dyns_index].d_tag));
free(strtab);
free(dyns);
return 5;
}
rpath = strtab+rpathoff;
#if defined(DT_RUNPATH)
if (convert && dyns[rpath_dyns_index].d_tag == DT_RPATH)
{
dyns[rpath_dyns_index].d_tag = DT_RUNPATH;
if (lseek(fd, phdr.p_offset, SEEK_SET) == -1
|| write(fd, dyns, phdr.p_filesz) != (int)phdr.p_filesz)
{
perror ("converting RPATH to RUNPATH");
return 1;
}
printf("%s: RPATH converted to RUNPATH\n", filename);
}
#endif /* DT_RUNPATH */
printf("%s: %s=%s\n", filename, elf_tagname(dyns[rpath_dyns_index].d_tag),
rpath);
if (NULL == newpath)
{
free(dyns);
free(strtab);
return 0;
}
rpathlen = strlen(rpath);
/*
* Calculate the maximum rpath length (will be equal to rpathlen unless
* we have previously truncated it).
*/
for ( i = rpathoff + rpathlen ; (i < (int)shdr.sh_size
&& strtab[i] == '\0') ; i++ )
;
i--;
if (i > (int)(rpathoff + rpathlen))
rpathlen = i - rpathoff;
if (strlen(newpath) > rpathlen)
{
fprintf(stderr, "new rpath '%s' too large; maximum length %i\n",
newpath, rpathlen);
free(dyns);
free(strtab);
return 7;
}
memset(rpath, 0, rpathlen);
strcpy(rpath, newpath);
if (lseek(fd, shdr.sh_offset+rpathoff, SEEK_SET) == -1)
{
perror ("positioning for RPATH");
free(dyns);
free(strtab);
return 1;
}
if (write(fd, rpath, rpathlen) != (int)rpathlen)
{
perror ("writing RPATH");
free(dyns);
free(strtab);
return 1;
}
printf("%s: new %s: %s\n", filename,
elf_tagname(dyns[rpath_dyns_index].d_tag), rpath);
elf_close(fd);
free(dyns);
dyns = NULL;
free(strtab);
return 0;
}
#ifdef HAVE_CONFIG_H
//# include "config.h"
#endif
#include <elf.h>
#if defined(HAVE_SYS_LINK_H)
# include <sys/link.h> /* Find DT_RPATH on Solaris 2.6 */
#endif /* HAVE_SYS_LINK_H */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
//#include "protos.h"
int
elf_open(const char *filename, int flags, Elf_Ehdr *ehdr)
{
int fd;
fd = open(filename, flags);
if (fd == -1)
{
perror ("open");
return -1;
}
if (read(fd, ehdr, sizeof(*ehdr)) != sizeof(*ehdr))
{
perror ("reading header");
close(fd);
return -1;
}
if (0 != memcmp(ehdr->e_ident, ELFMAG, SELFMAG) ||
ehdr->e_ident[EI_CLASS] != ELFCLASS ||
ehdr->e_ident[EI_DATA] != ELFDATA2 ||
ehdr->e_ident[EI_VERSION] != EV_CURRENT)
{
fprintf(stderr,
#ifdef WORDS_BIGENDIAN
"`%s' probably isn't a %d-bit MSB-first ELF file.\n",
#else /* not WORD_BIGENDIAN */
"`%s' probably isn't a %d-bit LSB-first ELF file.\n",
#endif /* not WORD_BIGENDIAN */
filename, SIZEOF_VOID_P * 8);
close(fd);
errno = ENOEXEC; /* Hm, is this the best errno code to use? */
return -1;
}
if (ehdr->e_phentsize != sizeof(Elf_Phdr))
{
fprintf(stderr, "section size was read as %d, not %d!\n",
ehdr->e_phentsize, (int)sizeof(Elf_Phdr));
close(fd);
return -1;
}
return fd;
}
int
elf_find_dynamic_section(int fd, Elf_Ehdr *ehdr, Elf_Phdr *phdr)
{
int i;
if (lseek(fd, ehdr->e_phoff, SEEK_SET) == -1)
{
perror ("positioning for sections");
return 1;
}
for (i = 0; i < ehdr->e_phnum; i++)
{
if (read(fd, phdr, sizeof(*phdr)) != sizeof(*phdr))
{
perror ("reading section header");
return 1;
}
if (phdr->p_type == PT_DYNAMIC)
break;
}
if (i == ehdr->e_phnum)
{
fprintf (stderr, "No dynamic section found.\n");
return 2;
}
if (0 == phdr->p_filesz)
{
fprintf (stderr, "Length of dynamic section is zero.\n");
return 3;
}
return 0;
}
void
elf_close(int fd)
{
close(fd);
}
const char *
elf_tagname(int tag)
{
switch (tag) {
case DT_RPATH:
return "RPATH";
break;
#if defined(DT_RUNPATH)
case DT_RUNPATH:
return "RUNPATH";
break;
#endif /* DT_RUNPATH */
}
return "UNKNOWN";
}
int
elf_dynpath_tag(int tag)
{
return ( tag == DT_RPATH
#if defined(DT_RUNPATH)
|| tag == DT_RUNPATH
#endif /* DT_RUNPATH */
);
}
/*
Taken from another list:
_Changing_ is a little tricky, but the attached program strips rpaths
from executables (I find it essential for debugging the binutils).
It's endian-dependent, if you want this for x86 you can just change
the occurrences of 'MSB' to 'LSB' and compile (I should really fix
that).
--
Geoffrey Keating <geoffk@ozemail.com.au>
*/
#ifdef HAVE_CONFIG_H
//# include "config.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <elf.h>
#if defined(HAVE_LINK_H)
# include <link.h>
#endif /* HAVE_LINK_H */
#include <stdlib.h>
//#include "protos.h"
#include <string.h>
/* Reads an ELF file, nukes all the RPATH entries. */
int
killrpath(const char *filename)
{
int fd;
Elf_Ehdr ehdr;
int i;
Elf_Phdr phdr;
Elf_Dyn *dyns;
int dynpos;
fd = elf_open(filename, O_RDWR, &ehdr);
if (fd == -1)
{
perror ("elf_open");
return 1;
}
if (0 != elf_find_dynamic_section(fd, &ehdr, &phdr))
{
perror("found no dynamic section");
return 1;
}
dyns = malloc(phdr.p_memsz);
if (dyns == NULL)
{
perror ("allocating memory for dynamic section");
return 1;
}
memset(dyns, 0, phdr.p_memsz);
if (lseek(fd, phdr.p_offset, SEEK_SET) == -1
|| read(fd, dyns, phdr.p_filesz) != (int)phdr.p_filesz)
{
perror ("reading dynamic section");
return 1;
}
dynpos = 0;
for (i = 0; dyns[i].d_tag != DT_NULL; i++)
{
dyns[dynpos] = dyns[i];
if ( ! elf_dynpath_tag(dyns[i].d_tag) )
dynpos++;
}
for (; dynpos < i; dynpos++)
dyns[dynpos].d_tag = DT_NULL;
if (lseek(fd, phdr.p_offset, SEEK_SET) == -1
|| write(fd, dyns, phdr.p_filesz) != (int)phdr.p_filesz)
{
perror ("writing dynamic section");
return 1;
}
elf_close(fd);
return 0;
}
/*
* Author: Petter Reinholdtsen <pere@hungry.com>
* date: 2001-01-20
*
* Alter ELF rpath information (insert, modify, remove).
*
* Based on source from Peeter Joot <peeterj@ca.ibm.com> and Geoffrey
* Keating <geoffk@ozemail.com.au>.
*/
#ifdef HAVE_CONFIG_H
//# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
//#include "protos.h"
#ifdef HAVE_GETOPT_LONG
# define GETOPT_LONG getopt_long
static struct option long_options[] =
{
{"convert", 0, 0, 'c'},
{"delete", 0, 0, 'd'},
{"help", 0, 0, 'h'},
{"keepgoing", 0, 0, 'k'},
{"list", 0, 0, 'l'},
{"replace", 1, 0, 'r'},
{"version", 0, 0, 'v'}
};
#else /* not HAVE_GETOPT_LONG */
# define GETOPT_LONG(argc,argv,optstr,lopts,lidx) getopt(argc,argv,optstr)
#endif /* not HAVE_GETOPT_LONG */
static void
usage(char *progname)
{
printf("Usage: %s [-v|-d|-c|-r <path>] <program> [<program> ...]\n\n",
progname);
printf(" -v|--version Display program version number\n");
printf(" -d|--delete Delete current rpath/runpath setting\n");
#if defined(DT_RUNPATH)
printf(" -c|--convert Convert rpath to runpath\n");
#endif /* DT_RUNPATH */
printf(" -r <path>|--replace <path> Replace current rpath/runpath setting\n");
printf(" with the path given\n");
printf(" -l|--list List the current rpath/runpath (default)\n");
printf(" -h|--help Show this usage information.\n");
#ifndef HAVE_GETOPT_LONG
printf("\n *** The long options are not available on this platform");
#endif /* not HAVE_GETOPT_LONG */
#if !defined(DT_RUNPATH)
printf("\n *** There is no support for runpath on this platform");
#endif /* DT_RUNPATH */
printf("\n");
}
int
main(int argc, char * const argv[])
{
int retval = 0;
int convert = 0; /* convert to given type */
int remove = 0; /* remove or not */
int keep_going = 0; /* Break on first error, or keep going? */
char *newpath = NULL; /* insert this path */
int opt;
#ifdef HAVE_GETOPT_LONG
int option_index = 0;
#endif /* HAVE_GETOPT_LONG */
if (argc < 2)
{
usage(argv[0]);
return 1;
}
do {
opt = GETOPT_LONG(argc, argv, "cdhklr:v", long_options, &option_index);
switch (opt)
{
#if defined(DT_RUNPATH)
case 'c':
convert = 1;
break;
#endif /* DT_RUNPATH */
case 'd':
remove = 1;
break;
case 'k':
keep_going = 1;
break;
case 'r':
newpath = optarg;
break;
case 'v':
printf("%s version %s\n", PACKAGE, VERSION);
exit(0);
break;
case 'l': /* This is the default action */
newpath = NULL;
break;
case -1:
break;
default:
printf("Invalid argument '%c'\n", opt);
case 'h':
usage(argv[0]);
exit(0);
break;
}
} while (-1 != opt);
while (optind < argc && (!retval || keep_going))
{
if (remove)
retval |= killrpath(argv[optind++]);
else
/* list by default, replace if path is set */
retval |= chrpath(argv[optind++], newpath, convert);
}
return retval;
}

View file

@ -26,8 +26,20 @@ build_freetype()
tar xzf "freetype-$version.tar.gz"
cd "freetype-$version"
./configure --prefix="$DEPLOYDIR" $extra_config_flags
make -j"$NUMCPU"
make install
MAKEBIN=make
if [ "`uname -a | grep -i bsd`" ]; then
MAKEBIN=gmake
SAVEPATH=$PATH
PATH=.:$PATH
fi
$MAKEBIN -j"$NUMCPU"
$MAKEBIN install
if [ "`uname -a | grep -i bsd`" ]; then
PATH=$SAVEPATH
fi
}
build_libxml2()
@ -48,8 +60,14 @@ build_libxml2()
tar xzf "libxml2-$version.tar.gz"
cd "libxml2-$version"
./configure --prefix="$DEPLOYDIR" --without-ftp --without-http --without-python
make -j$NUMCPU
make install
MAKEBIN=make
if [ "`uname -a | grep -i bsd`" ]; then
MAKEBIN=gmake
fi
$MAKEBIN -j$NUMCPU
$MAKEBIN install
}
build_fontconfig()
@ -107,6 +125,10 @@ build_gettext()
echo "gettext already installed. not building"
return
fi
if [ -f "$DEPLOYDIR"/lib/libgettextpo.dll ]; then
echo "gettext already installed. not building"
return
fi
echo "Building gettext $version..."
cd "$BASEDIR"/src
@ -117,7 +139,8 @@ build_gettext()
tar xzf "gettext-$version.tar.gz"
cd "gettext-$version"
./configure --prefix="$DEPLOYDIR" --disable-java --disable-native-java
./configure --prefix="$DEPLOYDIR" --disable-java --disable-native-java --enable-shared
#exit
make -j$NUMCPU
make install
}
@ -142,10 +165,19 @@ build_glib2()
cd "glib-$version"
export PKG_CONFIG_PATH="$DEPLOYDIR/lib/pkgconfig"
./configure --disable-gtk-doc --disable-man --prefix="$DEPLOYDIR" CFLAGS="-I$DEPLOYDIR/include" LDFLAGS="-L$DEPLOYDIR/lib"
MAKEBIN=make
DTRACEFLAG=
if [ "`uname -a | grep -i bsd`" ]; then
DTRACEFLAG=--disable-dtrace
MAKEBIN=gmake
fi
./configure $DTRACEFLAG --disable-gtk-doc --disable-man --prefix="$DEPLOYDIR" CFLAGS="-I$DEPLOYDIR/include" LDFLAGS="-L$DEPLOYDIR/lib"
unset PKG_CONFIG_PATH
make -j$NUMCPU
make install
$MAKEBIN -j$NUMCPU
$MAKEBIN install
}
build_ragel()
@ -178,7 +210,7 @@ build_harfbuzz()
if [ -e $DEPLOYDIR/include/harfbuzz ]; then
echo "harfbuzz already installed. not building"
return
echo return
fi
echo "Building harfbuzz $version..."
@ -189,12 +221,23 @@ build_harfbuzz()
fi
tar xzf "harfbuzz-$version.tar.gz"
cd "harfbuzz-$version"
# we do not need gtkdocize
sed -e "s/gtkdocize/echo/g" autogen.sh > autogen.sh.bak && mv autogen.sh.bak autogen.sh
# disable doc directories as they make problems on Mac OS Build
sed -e "s/SUBDIRS = src util test docs/SUBDIRS = src util test/g" Makefile.am > Makefile.am.bak && mv Makefile.am.bak Makefile.am
sed -e "s/^docs.*$//" configure.ac > configure.ac.bak && mv configure.ac.bak configure.ac
export PKG_CONFIG_PATH="$DEPLOYDIR/lib/pkgconfig"
export PKG_CONFIG=$DEPLOYDIR/bin/pkg-config
sh ./autogen.sh --prefix="$DEPLOYDIR" --with-freetype=yes --with-gobject=no --with-cairo=no --with-icu=no $extra_config_flags
make -j$NUMCPU
make install
unset PKG_CONFIG_PATH
unset PKG_CONFIG
MAKEBIN=make
if [ "`uname -a | grep -i bsd`" ]; then
MAKEBIN=gmake
fi
$MAKEBIN -j$NUMCPU
$MAKEBIN install
}

5
scripts/fakescad.cc Normal file
View file

@ -0,0 +1,5 @@
#include <iostream>
int main() {
std::cout << "fake openscad for testing release-common.sh\n";
}

7
scripts/fakescad.pro Normal file
View file

@ -0,0 +1,7 @@
# fake pro file to help testing release-common.sh
TEMPLATE = app
SOURCES = fakescad.cc
TARGET = openscad

View file

@ -1,48 +0,0 @@
#!/bin/bash
# change to the install source directory
cd "$( dirname "$( type -p $0 )" )"
if ! [ -f bin/openscad -a -d lib/openscad -a -d examples -a -d libraries ]; then
echo "Error: Can't change to install source directory!" >&2
exit 1
fi
echo "This will install openscad. Please enter the install prefix"
echo "or press Ctrl-C to abort the install process:"
read -p "[/usr/local]: " prefix
if [ "$prefix" = "" ]; then
prefix="/usr/local"
fi
if [ ! -d "$prefix" ]; then
echo; echo "Install prefix \`$prefix' does not exist. Press ENTER to continue"
echo "or press Ctrl-C to abort the install process:"
read -p "press enter to continue> "
fi
mkdir -p "$prefix"/{bin,lib/openscad,share/openscad/examples,share/openscad/libraries}
if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/openscad -a -w "$prefix"/share/openscad ]; then
echo "You does not seam to have write permissions for prefix \`$prefix'!" >&2
echo "Maybe you should have run this install script using \`sudo'?" >&2
exit 1
fi
echo "Copying application wrappers..."
cp -rv bin/. "$prefix"/bin/
echo "Copying application..."
cp -rv lib/. "$prefix"/lib/
echo "Copying examples..."
cp -rv examples/. "$prefix"/share/openscad/examples/
echo "Copying libraries..."
cp -rv libraries/. "$prefix"/share/openscad/libraries/
echo "Copying support files..."
cp -rv share/. "$prefix"/share/
echo "Installation finished. Have a nice day."

120
scripts/makedpkg.sh Executable file
View file

@ -0,0 +1,120 @@
#!/bin/sh
# build a simple .deb package.
# this does not conform to debian or ubuntu rules and is not suitable
# for putting into a repository. however it is good for simple installation
# on your local system for experimentation.
if [ ! -e ./openscad.pro ]; then
echo please run from openscad root source dir.
exit
fi
if [ ! -e /etc/os-release ]; then
echo sorry this requires an OS with a file /etc/os-release
exit
fi
if [ ! "`command -v dpkg`" ]; then
echo this requires dpkg
exit
fi
# set variables
OSINFO=`cat /etc/os-release`
eval $OSINFO
DEBINFO=`dpkg-architecture`
eval $DEBINFO
TARGETOS=`echo $ID'_'$VERSION_ID`
ARCH=$DEB_HOST_ARCH
MACHINE_TRIPLE=$DEB_HOST_GNU_TYPE
OSCADVERSION=`date "+%Y.%m.%d"`
OPENSCADDIR=`pwd`
DEPLOYDIR=$OPENSCADDIR/bin/$MACHINE_TRIPLE
BINARYFILE=$DEPLOYDIR/openscad
DPKGNAME=openscad_$OSCADVERSION-$TARGETOS-$ARCH
DPKGFILE=$DPKGNAME.deb
ESCAPED_VERSION_ID=`echo $VERSION_ID | sed -e s/\\\./_/g -`
mkdir -p $DEPLOYDIR
cd $DEPLOYDIR
qmake ../..
if [ "`echo $* | grep dry`" ]; then
cp `which ls` openscad
else
make
fi
if [ ! $? -eq 0 ]; then
echo make failed. exiting makedpkg
exit
fi
# find dependency package list using ldd and dpkg -S
DEPLIBS=`ldd $BINARYFILE | awk ' { print $3 } ';`
PKGLIST=
for dlib in `echo $DEPLIBS`; do
if [ -e $dlib ]; then
RAWPKGNAME=`dpkg -S $dlib`
if [ ! $? -eq 0 ]; then
echo 'unknown package for dependency '$dlib
echo 'please use system dependencies when building deb'
exit
fi
PKGNAME=`echo $RAWPKGNAME | sed -e s/":.*"//g - `
echo -n 'dpkg -S:' `basename $dlib`' is from'
echo ' '$PKGNAME
if [ ! "`echo $PKGLIST | grep $PKGNAME`" ]; then
PKGLIST=$PKGLIST' '$PKGNAME
else
echo ' already added '$PKGNAME
fi
fi
done
echo 'dependency package list: '$PKGLIST
# make package
cd $DEPLOYDIR
BINDIR=$DEPLOYDIR/$DPKGNAME/usr/local/bin
DEBDIR=$DEPLOYDIR/$DPKGNAME/DEBIAN
CONTROLFILE=$DEBDIR/control
mkdir -p $BINDIR
mkdir -p $DEBDIR
cp -a ./openscad $BINDIR/
cat << EOF > $CONTROLFILE
Package: openscad
Version: $OSCADVERSION
Section: graphics
Priority: optional
Architecture: $ARCH
Maintainer: $USER ($USER@$HOSTNAME)
Description: OpenSCAD
The programmer's solid modeller
Depends: debhelper,
EOF
sed -i '/^\s*$/d' $CONTROLFILE
for dep in $PKGLIST; do
echo " "$dep"," >> $CONTROLFILE
done
echo " debhelper" >> $CONTROLFILE
cat $CONTROLFILE
dpkg-deb -v -D --build $DPKGNAME
if [ ! $? -eq 0 ]; then
echo dpkg-deb failed. exiting makedpkg
exit
fi
echo in directory $DEPLOYDIR
echo to install, please run:
echo ' 'sudo gdebi $DPKGFILE

View file

@ -1,20 +1,18 @@
#!/bin/sh -e
#
# This script builds all library dependencies of OpenSCAD for cross-compilation
# from linux to mingw32/64 for windows, using the MXE cross build system.
#
# This script must be run from the OpenSCAD source root directory
#
# This script must be run after running the following:
#
# source ./scripts/setenv-mingw-xbuild.sh
#
# It will create the build target (32/64 static/shared) as given to that script.
# from linux to mingw32/64 for windows(TM), using the MXE cross build system.
#
# Usage:
# . ./scripts/setenv-mingw-xbuild.sh [64|32] [static|shared]
# ./scripts/mingw-x-build-dependencies.sh
#
# ./scripts/mingw-x-build-dependencies.sh download # download only
# ./scripts/mingw-x-build-dependencies.sh # build targets from setenv
# As of 2016 MXE allows these targets with the MXE_TARGETS environment variable.
#
# 64 bit static linked libraries MXE_TARGETS=x86_64-w64-mingw32.static
# 32 bit static linked libraries MXE_TARGETS=i686-w64-mingw32.static
# 64 bit shared libraries MXE_TARGETS=x86_64-w64-mingw32.shared
# 32 bit shared libraries MXE_TARGETS=i686-w64-mingw32.shared
#
# Prerequisites:
#
@ -25,12 +23,10 @@
# Shout out to Tony Theodore for updating MXE to 64 bit
#
OPENSCADDIR=$PWD
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
exit 0
if [ ! "`command -v zip`" ]; then
echo please install zip
exit
fi
echo OPENSCADDIR: $OPENSCADDIR
if [ ! $NUMCPU ]; then
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
@ -50,41 +46,54 @@ if [ ! $OPENSCAD_BUILD_TARGET_OSTYPE ]; then
echo "please check the README.MD"
fi
if [ ! -e $BASEDIR ]; then
mkdir -p $BASEDIR
docmd()
{
echo $*
$*
}
PACKAGES='qtbase qscintilla2 mpfr eigen opencsg cgal'
PACKAGES=$PACKAGES' glib freetype fontconfig harfbuzz libxml2'
if [ "`echo $MXE_TARGET | grep i686`" ]; then
PACKAGES=$PACKAGES' nsis'
fi
if [ ! -e $MXEDIR ]; then
mkdir -p $MXEDIR
cd $MXEDIR/..
echo "Downloading MXE into " $PWD
git clone git://github.com/openscad/mxe.git $MXEDIR
fi
mxe_get_debian_binary_deps()
{
debline="deb http://pkg.mxe.cc/repos/apt/debian wheezy main"
echo $debline > /etc/apt/sources.list.d/mxeapt.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D43A795B73B16ABE9643FE1AFD8FFF16DB45C6AB
apt-get update
MXE_PREFIX=`echo $MXE_TARGET | sed -e s/_/-/g`
PKGLIST=
for pkg in $PACKAGES; do
PKGLIST=$PKGLIST' '$MXE_PREFIX'-'$pkg
done
apt-get -y install $PKGLIST
apt-get install nsis
}
echo "entering" $MXEDIR
cd $MXEDIR
echo 'checkout openscad-snapshot-build branch'
git checkout openscad-snapshot-build
if [ "`echo $* | grep 64`" ]; then
MXE_TARGETS='x86_64-w64-mingw32.static'
if [ "`echo $* | grep download`" ]; then
PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qtbase download-glib download-libxml2 download-freetype download-fontconfig download-harfbuzz'
else
PACKAGES='qtbase qscintilla2 mpfr eigen opencsg cgal glib libxml2 freetype fontconfig harfbuzz'
fi
else
MXE_TARGETS='i686-w64-mingw32.static'
if [ "`echo $* | grep download`" ]; then
PACKAGES='download-mpfr download-eigen download-opencsg download-cgal download-qtbase download-nsis download-glib download-libxml2 download-freetype download-fontconfig download-harfbuzz'
else
PACKAGES='qtbase qscintilla2 mpfr eigen opencsg cgal nsis glib libxml2 freetype fontconfig harfbuzz'
fi
fi
cmd="make MXE_TARGETS=$MXE_TARGET -j $NUMCPU JOBS=$NUMJOBS $plist"
echo $cmd
eval $cmd
mxe_build_from_src()
{
if [ ! $MXE_TARGET ]; then
echo please run '. scripts/setenv-mingw-xbuild.sh'
exit
fi
if [ ! -e $MXEDIR ]; then
mkdir -p $MXEDIR
cd $MXEDIR/..
echo "Downloading MXE into " $PWD
git clone git://github.com/openscad/mxe.git $MXEDIR
fi
docmd cd $MXEDIR
docmd git checkout openscad-snapshot-build
docmd make $PACKAGES MXE_TARGETS=$MXE_TARGET -j $NUMCPU JOBS=$NUMJOBS
docmd cd $OPENSCADDIR
}
mxe_get_debian_binary_deps
echo "leaving" $MXEDIR
echo "entering $OPENSCADDIR"
cd $OPENSCADDIR

View file

@ -1,9 +0,0 @@
#!/bin/bash
cd "$( dirname "$( type -p $0 )" )"
libdir=$PWD/../lib/openscad/
cd "$OLDPWD"
export LIBGL_DRIVERS_PATH="$libdir"/dri
export LD_LIBRARY_PATH="$libdir${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
exec $libdir/openscad "$@"

View file

@ -1,31 +1,22 @@
#!/usr/bin/env bash
#
# This script creates a binary release of OpenSCAD. It creates a file named
# OpenSCAD-<versionstring>.<extension> in the current directory.
# This script creates a binary release of OpenSCAD. This should work
# under Mac OS X, Linux 32bit, Linux 64bit, and Linux->Win32 MXE cross-build.
#
# Non-OSX systems require running 'scripts/setenv.sh' before building.
# The script will create a file called openscad-<versionstring>.<extension>
# in the current directory.
#
# Portability works by special naming of bash functions and the run() function.
# "_generic" is a generic build, _darwin _linux, _msys, etc are specialized
printUsage()
{
echo "Usage: release-common.sh [-v <versionstring>] [-d <versiondate>] -c"
echo ""
echo " -v Version string (e.g. -v 2010.01)"
echo " -d Version date (e.g. -d 2010.01.23)"
echo " -snapshot Build a snapshot binary (make e.g. experimental features "
echo " available, build with commit info)"
echo " -fakebinary Debug the packaging process by skipping 'make' "
echo
echo "If no version string or version date is given, todays date will be used"
echo "(YYYY-MM-DD) If only version date is given, it will be used also as"
echo "version string. If no make target is given, none will be used"
echo "on Mac OS X"
echo
echo " Example: $0 -v 2010.01"
paralell_note
}
# For cross build, do 'source scripts/setenv-mingw-xbuild.sh [32|64]' before
# running this. The result will be under bin/machine-triple aka $DEPLOYDIR
#
# Usage: release-common.sh [-v <versionstring>] [-dryrun] [-snapshot]
# -v Version string (e.g. -v 2010.01)
# -d Version date (e.g. -d 2010.01.23)
# -dryrun Quickly build a dummy openscad.exe file to test this release script
# -snapshot Build a snapshot binary (make e.g. experimental features available, build with commit info)
#
# If no version string or version date is given, todays date will be used (YYYY-MM-DD)
# If only version date is given, it will be used also as version string.
paralell_note()
{
@ -393,60 +384,7 @@ create_archive_mxe()
create_archive_netbsd()
{
cd $BUILDDIR
pkdir=openscad-$VERSION
mkdir $pkdir/bin
mkdir $pkdir/lib
cp ./$MAKE_TARGET/openscad $pkdir/bin/
chmod 755 -R openscad-$VERSION/
PACKAGEFILE=OpenSCAD-$VERSION.$OPENSCAD_BUILD_TARGET_TRIPLE.tar.gz
tar cf $PACKAGEFILE openscad-$VERSION
echo
echo "Binary created:" $PACKAGEFILE
echo
mv $PACKAGEFILE $OPENSCADDIR/
}
create_archive_linux()
{
cd $BUILDDIR
# Do stuff from release-linux.sh
mkdir openscad-$VERSION/bin
mkdir -p openscad-$VERSION/lib/openscad
cp scripts/openscad-linux openscad-$VERSION/bin/openscad
cp openscad openscad-$VERSION/lib/openscad/
if [[ $OPENSCAD_BUILD_TARGET_ARCH == x86_64 ]]; then
gcc -o chrpath_linux -DSIZEOF_VOID_P=8 scripts/chrpath_linux.c
else
gcc -o chrpath_linux -DSIZEOF_VOID_P=4 scripts/chrpath_linux.c
fi
./chrpath_linux -d openscad-$VERSION/lib/openscad/openscad
QTLIBDIR=$(dirname $(ldd openscad | grep Qt5Gui | head -n 1 | awk '{print $3;}'))
( ldd openscad ; ldd "$QTLIBDIR"/qt5/plugins/platforms/libqxcb.so ) \
| sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/^$/d' -e '/libc\.so|libm\.so|libdl\.so|libgcc_|libpthread\.so/d' \
| sort -u \
| xargs cp -vt "openscad-$VERSION/lib/openscad/"
PLATFORMDIR="openscad-$VERSION/lib/openscad/platforms/"
mkdir -p "$PLATFORMDIR"
cp -av "$QTLIBDIR"/qt5/plugins/platforms/libqxcb.so "$PLATFORMDIR"
DRIDRIVERDIR=$(find /usr/lib -xdev -type d -name dri)
if [ -d "$DRIDRIVERDIR" ]
then
DRILIB="openscad-$VERSION/lib/openscad/dri/"
mkdir -p "$DRILIB"
cp -av "$DRIDRIVERDIR"/swrast_dri.so "$DRILIB"
fi
strip openscad-$VERSION/lib/openscad/*
mkdir -p openscad-$VERSION/share/appdata
cp icons/openscad.{desktop,png,xml} openscad-$VERSION/share/appdata
cp scripts/installer-linux.sh openscad-$VERSION/install.sh
chmod 755 -R openscad-$VERSION/
PACKAGEFILE=OpenSCAD-$VERSION.$OPENSCAD_BUILD_TARGET_TRIPLE.tar.gz
tar cz openscad-$VERSION > $PACKAGEFILE
mv $PACKAGEFILE $OPENSCADDIR/
echo "Usage: $0 -v <versionstring> -d <versiondate>
echo
echo "Binary created:" $PACKAGEFILE
echo
@ -580,25 +518,41 @@ build_fake_gui_binary_msys()
build_fake_gui_binary_mxe
}
OPENSCADDIR=$PWD
if [ ! $OPENSCADDIR ]; then
OPENSCADDIR=$PWD
fi
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
echo "Cannot find OPENSCADDIR/openscad.pro, OPENSCADDIR should be src root "
exit 1
fi
echo OPENSCADDIR:$OPENSCADDIR
if [ ! -d $DEPLOYDIR ]; then
mkdir -p $DEPLOYDIR
fi
echo DEPLOYDIR: $DEPLOYDIR
CONFIG=deploy
if [[ "$OSTYPE" == "darwin"* ]]; then
OPENSCAD_BUILD_TARGET_OSTYPE=darwin
BUILDDIR=$OPENSCADDIR
elif [ ! $SETENV_SAVED_ORIGINAL_PATH ]; then
echo "please run . ./scripts/setenv.sh first (note the . )"
exit 1
if [ $MXE_TARGET ]; then
OS=UNIX_CROSS_WIN
elif [[ "$OSTYPE" =~ "darwin" ]]; then
OS=MACOSX
elif [[ $OSTYPE == "msys" ]]; then
OS=WIN
elif [[ $OSTYPE == "linux-gnu" ]]; then
OS=LINUX
ARCH=`uname -m`
fi
if [ "`echo $* | grep fake`" ]; then
echo faking binary build
FAKEMAKE=1
if [ $OS = UNIX_CROSS_WIN ]; then
echo MXE cross build environment variables detected
echo MXE_TARGET_DIR $MXE_TARGET_DIR
echo MXE_TARGET $MXE_TARGET
echo MXE_LIB_TYPE $MXE_LIB_TYPE
echo DEPLOYDIR $DEPLOYDIR
fi
if [ "`echo $* | grep snapshot`" ]; then
@ -606,6 +560,13 @@ if [ "`echo $* | grep snapshot`" ]; then
OPENSCAD_COMMIT=`git log -1 --pretty=format:"%h"`
fi
if [ $OS ]; then
echo "Detected OS: $OS"
else
echo "Error: Couldn't detect OSTYPE"
exit
fi
while getopts 'v:d:c' c
do
case $c in
@ -624,23 +585,404 @@ fi
export VERSIONDATE
export VERSION
echo "Checking pre-requisites..."
case $OS in
UNIX_CROSS_WIN)
MAKENSIS=
if [ "`command -v makensis`" ]; then
MAKENSIS=makensis
elif [ -e $MXE_DIR/usr/bin/i686-pc-mingw32-makensis ]; then
# MXE has its own makensis, but its only available under
# 32-bit MXE. it works the same as a native linux version so
# its not really a 'cross' nsis
MAKENSIS=i686-pc-mingw32-makensis
else
echo "makensis not found. please install nsis on your system."
echo "(for example, on debian linux, try apt-get install nsis)"
exit 1
fi
echo NSIS makensis found: $MAKENSIS
;;
esac
if [ ! -e $OPENSCADDIR/libraries/MCAD/__init__.py ]; then
echo "Downloading MCAD"
git submodule init
git submodule update
if [ ! -e $OPENSCADDIR/libraries/MCAD/__init__.py ]; then
echo "Downloading MCAD failed. exiting"
exit
fi
else
echo "MCAD found:" $OPENSCADDIR/libraries/MCAD
fi
if [ -d .git ]; then
git submodule update
fi
echo "Building openscad-$VERSION ($VERSIONDATE) $CONFIG..."
run check_prereq
paralell_note
echo "NUMCPU: " $NUMCPU
run update_mcad
run setup_misc
run qmaker
run make_clean
run touch_parser_lexer
run make_gui_binary
run verify_binary
exit
run setup_directories
if [ -n $EXAMPLESDIR ]; then run copy_examples ; fi
if [ -n $FONTSDIR ]; then run copy_fonts ; fi
if [ -n $COLORSCHEMESDIR ]; then run copy_colorschemes ; fi
if [ -n $LIBRARYDIR ]; then run copy_mcad ; fi
if [ -n $TRANSLATIONDIR ]; then run copy_translations ; fi
run create_archive
case $OS in
LINUX|MACOSX)
# for QT4 set QT_SELECT=4
QT_SELECT=5
export QT_SELECT
;;
UNIX_CROSS_WIN)
ZIP="zip"
ZIPARGS="-r -q"
;;
esac
case $OS in
UNIX_CROSS_WIN)
QPROFILE=$OPENSCADDIR/openscad.pro
if [ "`echo $* | grep dryrun`" ]; then
QPROFILE=$OPENSCADDIR/scripts/fakescad.pro
fi
cd $DEPLOYDIR
qmake VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+="$CONFIG" CONFIG-=debug $QPROFILE
cd $OPENSCADDIR
;;
*)
QMAKE="`command -v qmake-qt5`"
if [ ! -x "$QMAKE" ]
then
QMAKE=qmake
fi
"$QMAKE" VERSION=$VERSION OPENSCAD_COMMIT=$OPENSCAD_COMMIT CONFIG+="$CONFIG" CONFIG-=debug openscad.pro
;;
esac
case $OS in
UNIX_CROSS_WIN)
cd $DEPLOYDIR
make clean
cd $OPENSCADDIR
;;
*)
make -s clean
;;
esac
case $OS in
MACOSX)
rm -rf OpenSCAD.app
;;
WIN)
#if the following files are missing their tried removal stops the build process on msys
touch -t 200012121010 parser_yacc.h parser_yacc.cpp lexer_lex.cpp
;;
UNIX_CROSS_WIN)
# kludge to enable paralell make
touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.h
touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.cpp
touch -t 200012121010 $OPENSCADDIR/src/parser_yacc.hpp
touch -t 200012121010 $OPENSCADDIR/src/lexer_lex.cpp
;;
esac
echo "Building GUI binary..."
case $OS in
UNIX_CROSS_WIN)
cd $DEPLOYDIR
make -j$NUMCPU
;;
*)
make -j$NUMCPU
;;
esac
if [[ $? != 0 ]]; then
echo "Error building OpenSCAD. Stopping."
exit 1
fi
case $OS in
UNIX_CROSS_WIN)
# make console pipe-able openscad.com - see winconsole.pro for info
cd $DEPLOYDIR
qmake $OPENSCADDIR/winconsole/winconsole.pro
make
if [[ $? != 0 ]]; then
echo "Error building $DEPLOYDIR/openscad.com. Stopping."
exit 1
fi
cd $OPENSCADDIR
;;
esac
echo "Creating directory structure..."
case $OS in
MACOSX)
EXAMPLESDIR=OpenSCAD.app/Contents/Resources/examples
LIBRARYDIR=OpenSCAD.app/Contents/Resources/libraries
FONTDIR=OpenSCAD.app/Contents/Resources/fonts
TRANSLATIONDIR=OpenSCAD.app/Contents/Resources/locale
COLORSCHEMESDIR=OpenSCAD.app/Contents/Resources/color-schemes
;;
UNIX_CROSS_WIN)
cd $OPENSCADDIR
EXAMPLESDIR=$DEPLOYDIR/openscad-$VERSION/examples/
LIBRARYDIR=$DEPLOYDIR/openscad-$VERSION/libraries/
FONTDIR=$DEPLOYDIR/openscad-$VERSION/fonts/
TRANSLATIONDIR=$DEPLOYDIR/openscad-$VERSION/locale/
COLORSCHEMESDIR=$DEPLOYDIR/openscad-$VERSION/color-schemes/
rm -rf $DEPLOYDIR/openscad-$VERSION
mkdir $DEPLOYDIR/openscad-$VERSION
;;
*)
EXAMPLESDIR=openscad-$VERSION/examples/
LIBRARYDIR=openscad-$VERSION/libraries/
FONTDIR=openscad-$VERSION/fonts/
TRANSLATIONDIR=openscad-$VERSION/locale/
COLORSCHEMESDIR=openscad-$VERSION/color-schemes/
rm -rf openscad-$VERSION
mkdir openscad-$VERSION
;;
esac
if [ -n $EXAMPLESDIR ]; then
echo $EXAMPLESDIR
mkdir -p $EXAMPLESDIR
rm -f examples.tar
tar cf examples.tar examples
cd $EXAMPLESDIR/.. && tar xf $OPENSCADDIR/examples.tar && cd $OPENSCADDIR
rm -f examples.tar
chmod -R 644 $EXAMPLESDIR/*/*
fi
if [ -n $FONTDIR ]; then
echo $FONTDIR
mkdir -p $FONTDIR
cp -a fonts/10-liberation.conf $FONTDIR
cp -a fonts/Liberation-2.00.1 $FONTDIR
case $OS in
MACOSX)
cp -a fonts/05-osx-fonts.conf $FONTDIR
cp -a fonts-osx/* $FONTDIR
;;
UNIX_CROSS_WIN)
cp -a $MXE_TARGET_DIR/etc/fonts/. "$FONTDIR"
;;
esac
fi
if [ -n $COLORSCHEMESDIR ]; then
echo $COLORSCHEMESDIR
mkdir -p $COLORSCHEMESDIR
cp -a color-schemes/* $COLORSCHEMESDIR
fi
if [ -n $LIBRARYDIR ]; then
echo $LIBRARYDIR
mkdir -p $LIBRARYDIR
# exclude the .git stuff from MCAD which is a git submodule.
# tar is a relatively portable way to do exclusion, without the
# risks of rm
rm -f libraries.tar
tar cf libraries.tar --exclude=.git* libraries
cd $LIBRARYDIR/.. && tar xf $OPENSCADDIR/libraries.tar && cd $OPENSCADDIR
rm -f libraries.tar
chmod -R u=rwx,go=r,+X $LIBRARYDIR/*
fi
if [ -n $TRANSLATIONDIR ]; then
echo $TRANSLATIONDIR
mkdir -p $TRANSLATIONDIR
cd locale && tar cvf $OPENSCADDIR/translations.tar */*/*.mo && cd $OPENSCADDIR
cd $TRANSLATIONDIR && tar xvf $OPENSCADDIR/translations.tar && cd $OPENSCADDIR
rm -f translations.tar
fi
echo "Creating archive.."
mxe_shared()
{
flprefix=$MXE_TARGET_DIR/bin
echo Copying dlls for shared library build
echo from $flprefix
echo to $DEPLOYDIR/release
flist=
# fl="$fl opengl.dll" # use Windows version?
# fl="$fl libmpfr.dll" # does not exist
fl="$fl libgmp-10.dll"
fl="$fl libgmpxx-4.dll"
fl="$fl libboost_filesystem-mt.dll"
fl="$fl libboost_program_options-mt.dll"
fl="$fl libboost_regex-mt.dll"
fl="$fl libboost_chrono-mt.dll"
fl="$fl libboost_system-mt.dll"
fl="$fl libboost_thread_win32-mt.dll"
fl="$fl libCGAL.dll"
fl="$fl libCGAL_Core.dll"
fl="$fl GLEW.dll"
fl="$fl libglib-2.0-0.dll"
fl="$fl libopencsg-1.dll"
fl="$fl libharfbuzz-0.dll"
# fl="$fl libharfbuzz-gobject-0.dll" # ????
fl="$fl libfontconfig-1.dll"
fl="$fl libexpat-1.dll"
fl="$fl libbz2.dll"
fl="$fl libintl-8.dll"
fl="$fl libiconv-2.dll"
fl="$fl libfreetype-6.dll"
fl="$fl libpcre16-0.dll"
fl="$fl zlib1.dll"
fl="$fl libpng16-16.dll"
fl="$fl icudt54.dll"
fl="$fl icudt.dll"
fl="$fl icuin.dll"
fl="$fl libstdc++-6.dll"
fl="$fl ../qt5/lib/qscintilla2.dll"
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
fl="$fl ../qt5/bin/Qt5Core.dll"
fl="$fl ../qt5/bin/Qt5Gui.dll"
fl="$fl ../qt5/bin/Qt5OpenGL.dll"
# fl="$fl ../qt5/bin/QtSvg4.dll" # why is this here?
fl="$fl ../qt5/bin/Qt5Widgets.dll"
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
fl="$fl ../qt5/bin/Qt5PrintSupport.dll"
for dllfile in $fl; do
if [ -e $flprefix/$dllfile ]; then
echo $flprefix/$dllfile
cp $flprefix/$dllfile $DEPLOYDIR/release/
else
echo cannot find $flprefix/$dllfile
echo stopping build.
exit 1
fi
done
}
case $OS in
MACOSX)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSIONDATE" OpenSCAD.app/Contents/Info.plist
macdeployqt OpenSCAD.app -dmg -no-strip
mv OpenSCAD.dmg OpenSCAD-$VERSION.dmg
hdiutil internet-enable -yes -quiet OpenSCAD-$VERSION.dmg
echo "Binary created: OpenSCAD-$VERSION.dmg"
;;
WIN)
#package
cp win32deps/* openscad-$VERSION
cp release/openscad.exe openscad-$VERSION
cp release/openscad.com openscad-$VERSION
rm -f openscad-$VERSION.x86-$ARCH.zip
"$ZIP" $ZIPARGS openscad-$VERSION.x86-$ARCH.zip openscad-$VERSION
rm -rf openscad-$VERSION
echo "Binary created: openscad-$VERSION.zip"
;;
UNIX_CROSS_WIN)
cd $OPENSCADDIR
cd $DEPLOYDIR
ARCH=x86_64
if [ "`echo $MXE_TARGET | grep i686`" ]; then ARCH=x86_32 ; fi
ZIPFILE=$DEPLOYDIR/OpenSCAD-$VERSION-$ARCH.zip
INSTFILE=$DEPLOYDIR/OpenSCAD-$VERSION-$ARCH-Installer.exe
#package
if [ $MXE_LIB_TYPE = "shared" ]; then
mxe_shared
fi
echo "Copying main binary .exe, .com, and dlls"
echo "from $DEPLOYDIR/release"
echo "to $DEPLOYDIR/openscad-$VERSION"
TMPTAR=$DEPLOYDIR/tmpmingw.$ARCH.$MXE_LIB_TYPE.tar
cd $DEPLOYDIR
cd release
tar cvf $TMPTAR --exclude=winconsole.o .
cd $DEPLOYDIR
cd ./openscad-$VERSION
tar xvf $TMPTAR
cd $DEPLOYDIR
rm -f $TMPTAR
echo "Creating binary zip package"
rm -f OpenSCAD-$VERSION.x86-$ARCH.zip
"$ZIP" $ZIPARGS $ZIPFILE openscad-$VERSION
cd $OPENSCADDIR
echo "Binary zip package created"
echo "Creating installer"
echo "Copying NSIS files to $DEPLOYDIR/openscad-$VERSION"
BITS=64
if [ "`echo $MXE_TARGET | grep i686`" ]; then BITS=32 ; fi
cp ./scripts/installer$BITS.nsi $DEPLOYDIR/openscad-$VERSION/installer_arch.nsi
cp ./scripts/installer.nsi $DEPLOYDIR/openscad-$VERSION/
cp ./scripts/mingw-file-association.nsh $DEPLOYDIR/openscad-$VERSION/
cp ./scripts/x64.nsh $DEPLOYDIR/openscad-$VERSION/
cp ./scripts/LogicLib.nsh $DEPLOYDIR/openscad-$VERSION/
cd $DEPLOYDIR/openscad-$VERSION
NSISDEBUG=-V2
# NSISDEBUG= # leave blank for full log
echo $MAKENSIS $NSISDEBUG "-DVERSION=$VERSION" installer.nsi
$MAKENSIS $NSISDEBUG "-DVERSION=$VERSION" installer.nsi
cp $DEPLOYDIR/openscad-$VERSION/openscad_setup.exe $INSTFILE
cd $OPENSCADDIR
if [ -e $ZIPFILE ]; then
echo "Zipfile created:" $ZIPFILE
else
echo "zipfile creation failed. stopping"
exit 1
fi
if [ -e $INSTFILE ]; then
echo "Installer created:" $INSTFILE
else
echo "installer creation failed. stopping"
exit 1
fi
;;
LINUX)
# Do stuff from release-linux.sh
mkdir openscad-$VERSION/bin
mkdir -p openscad-$VERSION/lib/openscad
cp scripts/openscad-linux openscad-$VERSION/bin/openscad
cp openscad openscad-$VERSION/lib/openscad/
if [[ $ARCH == 64 ]]; then
gcc -o chrpath_linux -DSIZEOF_VOID_P=8 scripts/chrpath_linux.c
else
gcc -o chrpath_linux -DSIZEOF_VOID_P=4 scripts/chrpath_linux.c
fi
./chrpath_linux -d openscad-$VERSION/lib/openscad/openscad
QTLIBDIR=$(dirname $(ldd openscad | grep Qt5Gui | head -n 1 | awk '{print $3;}'))
( ldd openscad ; ldd "$QTLIBDIR"/qt5/plugins/platforms/libqxcb.so ) \
| sed -re 's,.* => ,,; s,[\t ].*,,;' -e '/^$/d' -e '/libc\.so|libm\.so|libdl\.so|libgcc_|libpthread\.so/d' \
| sort -u \
| xargs cp -vt "openscad-$VERSION/lib/openscad/"
PLATFORMDIR="openscad-$VERSION/lib/openscad/platforms/"
mkdir -p "$PLATFORMDIR"
cp -av "$QTLIBDIR"/qt5/plugins/platforms/libqxcb.so "$PLATFORMDIR"
DRIDRIVERDIR=$(find /usr/lib -xdev -type d -name dri)
if [ -d "$DRIDRIVERDIR" ]
then
DRILIB="openscad-$VERSION/lib/openscad/dri/"
mkdir -p "$DRILIB"
cp -av "$DRIDRIVERDIR"/swrast_dri.so "$DRILIB"
fi
strip openscad-$VERSION/lib/openscad/*
mkdir -p openscad-$VERSION/share/appdata
cp icons/openscad.{desktop,png,xml} openscad-$VERSION/share/appdata
cp scripts/installer-linux.sh openscad-$VERSION/install.sh
chmod 755 -R openscad-$VERSION/
PACKAGEFILE=openscad-$VERSION.x86-$ARCH.tar.gz
tar cz openscad-$VERSION > $PACKAGEFILE
echo
echo "Binary created:" $PACKAGEFILE
echo
;;
esac

View file

@ -4,123 +4,99 @@
#
# Usage:
#
# source ./scripts/setenv-mingw-xbuild.sh # 32 bit build
# source ./scripts/setenv-mingw-xbuild.sh shared # 32 bit build, shared libs
# source ./scripts/setenv-mingw-xbuild.sh 64 # 64 bit build
# source ./scripts/setenv-mingw-xbuild.sh 64 shared # 64 bit build, shared libs
# source ./scripts/setenv-mingw-xbuild.sh clean # Clean up exported variables
# source ./scripts/setenv-mingw-xbuild.sh qt5 # use qt5 (experimental)
# source ./scripts/setenv-mingw-xbuild.sh [32|64] [shared|static] [qt4]
#
# Prerequisites:
#
# Please see http://mxe.cc/#requirements
# Please see http://mxe.cc/#requirements
#
# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
#
OPENSCADDIR=$PWD
if [ ! -e openscad.pro ]; then
echo "please run from root openscad source"
fi
if [ ! $BASEDIR ]; then
BASEDIR=$HOME/openscad_deps
fi
MXELIBTYPE=static
if [ "`echo $* | grep shared `" ]; then
MXELIBTYPE=shared
fi
DEPLOYDIR64=$OPENSCADDIR/mingw64.$MXELIBTYPE
DEPLOYDIR32=$OPENSCADDIR/mingw32.$MXELIBTYPE
if [ ! $DEPLOYDIR ]; then
if [ "`echo $* | grep 64 `" ]; then
DEPLOYDIR=$DEPLOYDIR64
else
DEPLOYDIR=$DEPLOYDIR32
fi
fi
if [ ! $MXEDIR ]; then
if [ "`echo $* | grep 64 `" ]; then
MXEDIR=$BASEDIR/mxe
else
MXEDIR=$BASEDIR/mxe
fi
MXEDIR=$BASEDIR/mxe
if [ ! -e $MXEDIR ]; then
if [ -e /opt/mxe ]; then
MXEDIR=/opt/mxe
MXEDIR=/opt/mxe # mxe on custom build machines
fi
#if [ -e /usr/lib/mxe ]; then
# MXEDIR=/usr/lib/mxe # mxe dpkg binary on debian
#fi
fi
fi
if [ ! $MXEQTSUBDIR ]; then
if [ "`echo $* | grep qt4 `" ]; then
# qt4 is just 'qt' in MXE, see http://mxe.cc
MXEQTSUBDIR=qt
else
# default is qt5 see issue #252
MXEQTSUBDIR=qt5
fi
MXE_TRIPLET_64=x86_64-w64-mingw32
MXE_TRIPLET_32=i686-w64-mingw32
MXE_TRIPLET=$MXE_TRIPLET_64
if [ "`echo $* | grep 32 `" ]; then
MXE_TRIPLET=$MXE_TRIPLET_32
fi
if [ ! -e $DEPLOYDIR ]; then
mkdir -p $DEPLOYDIR
MXE_LIB_TYPE=static
if [ "`echo $* | grep shared `" ]; then
MXE_LIB_TYPE=shared
fi
if [ "`echo $* | grep 64 `" ]; then
MXETARGETDIR=$MXEDIR/usr/x86_64-w64-mingw32.$MXELIBTYPE
else
MXETARGETDIR=$MXEDIR/usr/i686-w64-mingw32.$MXELIBTYPE
MXE_QTSUBDIR=qt5
if [ "`echo $* | grep qt4 `" ]; then
MXE_QTSUBDIR=qt
fi
if [ ! $MINGWX_SAVED_ORIGINAL_PATH ]; then
MINGWX_SAVED_ORIGINAL_PATH=$PATH
echo current path saved
fi
MXE_TARGET=$MXE_TRIPLET'.'$MXE_LIB_TYPE
MXE_TARGET_DIR=$MXEDIR/usr/$MXE_TARGET
MXE_QTBIN_DIR=$MXE_TARGET_DIR/$MXE_QTSUBDIR/bin
MXE_BIN_DIR=$MXEDIR/usr/bin
DEPLOYDIR=$OPENSCADDIR/bin/$MXE_TARGET
OPENSCAD_LIBRARIES=$MXE_TARGET_DIR
PATH=$MXEDIR/usr/bin:$PATH
PATH=$MXETARGETDIR/$MXEQTSUBDIR/bin:$PATH
cleanpath()
{
D1=$MXEDIR/usr/$MXE_TRIPLET_32.s...../qt/bin:
D2=$MXEDIR/usr/$MXE_TRIPLET_32.s...../qt5/bin:
D3=$MXEDIR/usr/$MXE_TRIPLET_64.s...../qt/bin:
D4=$MXEDIR/usr/$MXE_TRIPLET_64.s...../qt5/bin:
PATH=`echo $PATH | sed -e s~$D1~~g`
PATH=`echo $PATH | sed -e s~$D2~~g`
PATH=`echo $PATH | sed -e s~$D3~~g`
PATH=`echo $PATH | sed -e s~$D4~~g`
PATH=`echo $PATH | sed -e s~$MXEDIR/usr/bin:~~g`
}
OPENSCAD_LIBRARIES=$MXETARGETDIR
cleanpath
PATH=$MXE_BIN_DIR:$MXE_QTBIN_DIR:$PATH
if [ "`echo $* | grep clean`" ]; then
OPENSCAD_LIBRARIES=
BASEDIR=
MXEDIR=
MXETARGETDIR=
DEPLOYDIR=
PATH=$MINGWX_SAVED_ORIGINAL_PATH
MINGWX_SAVED_ORIGINAL_PATH=
MXEQTSUBDIR=
else
echo 'linking' $MXETARGETDIR
echo ' to' $DEPLOYDIR/mingw-cross-env
rm -f $DEPLOYDIR/mingw-cross-env
ln -s $MXETARGETDIR $DEPLOYDIR/mingw-cross-env
fi
export OPENSCAD_LIBRARIES
export OPENSCADDIR
export BASEDIR
export MXEDIR
export MXETARGETDIR
export MXELIBTYPE
export MXE_TARGET
export MXE_LIB_TYPE
export MXE_TARGET_DIR
export DEPLOYDIR
export OPENSCAD_LIBRARIES
export PATH
export MINGWX_SAVED_ORIGINAL_PATH
export MXEQTSUBDIR
echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES
echo OPENSCADDIR: $OPENSCADDIR
echo BASEDIR: $BASEDIR
echo MXEDIR: $MXEDIR
echo MXETARGETDIR: $MXETARGETDIR
echo MXELIBTYPE: $MXELIBTYPE
echo MXE_TARGET: $MXE_TARGET
echo MXE_LIB_TYPE: $MXE_LIB_TYPE
echo MXE_TARGET_DIR: $MXE_TARGET_DIR
echo DEPLOYDIR: $DEPLOYDIR
echo MXEQTSUBDIR: $MXEQTSUBDIR
if [ "`echo $* | grep clean`" ]; then
echo PATH restored to pre-setenv-mingw-x state
else
echo PATH modified: $MXEDIR/usr/bin
echo PATH modified: $MXETARGETDIR/$MXEQTSUBDIR/bin
echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES
echo PATH: $PATH
if [ ! -e $DEPLOYDIR ]; then
echo creating $DEPLOYDIR
mkdir -p $DEPLOYDIR
fi

181
scripts/setenv-unibuild.sh Normal file
View file

@ -0,0 +1,181 @@
# setup environment variables for building OpenSCAD against custom built
# dependency libraries. works on Linux/BSD.
#
# Please see the 'uni-build-dependencies.sh' file for usage information
#
linuxbrew()
{
#LDFLAGS: -L$HOME/.linuxbrew/opt/qt5/lib
#CPPFLAGS: -I$HOME/.linuxbrew/opt/qt5/include
BASEDIR=$HOME/.linuxbrew
PKG_CONFIG_PATH=$BASEDIR/opt/qt5/lib/pkgconfig:$PKG_CONFIG_PATH
PATH=$BASEDIR/bin:$PATH
PATH=$BASEDIR/opt/qt5/bin:$PATH
LD_LIBRARY_PATH=$BASEDIR/lib:$BASEDIR/lib64:$BASEDIR/opt/qt5/lib
LD_RUN_PATH=$BASEDIR/lib:$BASEDIR/lib64:$BASEDIR/opt/qt5/lib
OPENSCAD_LIBRARIES=$BASEDIR
GLEWDIR=$BASEDIR
DEPLOYDIR=`pwd`/binbrew/
export BASEDIR
export PKG_CONFIG_PATH
export PATH
export LD_LIBRARY_PATH
export LD_RUN_PATH
export OPENSCAD_LIBRARIES
export GLEWDIR
echo BASEDIR: $BASEDIR
echo PKG_CONFIG_PATH: $PKG_CONFIG_PATH
echo DEPLOYDIR: $DEPLOYDIR
echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
echo LD_RUN_PATH: $LD_RUN_PATH
echo OPENSCAD_LIBRARIES: $OPENSCAD_LIBRARIES
echo GLEWDIR: $GLEWDiR
echo PATH: $PATH
}
setenv_common()
{
if [ ! $BASEDIR ]; then
if [ -f openscad.pro ]; then
# if in main openscad dir, put under $HOME
BASEDIR=$HOME/openscad_deps
else
# otherwise, assume its being run 'out of tree'. treat it somewhat like
# "configure" or "cmake", so you can build dependencies where u wish.
echo "Warning: Not in OpenSCAD src dir... using current directory as base of build"
BASEDIR=$PWD/openscad_deps
fi
fi
DEPLOYDIR=$BASEDIR
export BASEDIR
export PATH=$BASEDIR/bin:$PATH
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
export OPENSCAD_LIBRARIES=$DEPLOYDIR
export GLEWDIR=$DEPLOYDIR
echo BASEDIR: $BASEDIR
echo DEPLOYDIR: $DEPLOYDIR
echo PATH modified
echo LD_LIBRARY_PATH modified
echo LD_RUN_PATH modified
echo OPENSCAD_LIBRARIES modified
echo GLEWDIR modified
if [ "`uname -m | grep sparc64`" ]; then
echo detected sparc64. forcing 32 bit with export ABI=32
ABI=32
export ABI
fi
}
setenv_freebsd()
{
echo .... freebsd detected.
setenv_common
if [ "`uname -a |grep -i freebsd.9`" ]; then
echo freebsd9 is unsupported, please use freebsd 11
elif [ "`uname -a |grep -i freebsd.10`" ]; then
echo freebsd10 is unsupported, please use freebsd 11
else
QMAKESPEC=freebsd-clang
CC=clang
CXX=clang++
fi
QTDIR=/usr/local/share/qt4
PATH=/usr/local/lib/qt4/bin:$PATH
export PATH
export QMAKESPEC
export QTDIR
export CC
export CXX
echo QMAKESPEC $QMAKESPEC
echo QTDIR $QTDIR
echo CXX CC $CXX $CC
}
setenv_netbsd()
{
setenv_common
if [ "` uname -a |grep NetBSD.6 `" ]; then
echo sorry, recommend NetBSD 7 or more, you will have to hack 6 yourself
fi
# we have to use qt4 here because netbsd7 has no qscintilla for qt5
QMAKESPEC=netbsd-g++
QTDIR=/usr/pkg/qt4
PATH=/usr/pkg/qt4/bin:$PATH
LD_LIBRARY_PATH=/usr/pkg/qt4/lib:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/X11R7/lib:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=/usr/pkg/lib:$LD_LIBRARY_PATH
export QMAKESPEC
export QTDIR
export PATH
export LD_LIBRARY_PATH
}
setenv_linux_clang()
{
export CC=clang
export CXX=clang++
export QMAKESPEC=unsupported/linux-clang
echo CC has been modified: $CC
echo CXX has been modified: $CXX
echo QMAKESPEC has been modified: $QMAKESPEC
}
setenv_netbsd_clang()
{
echo --------------------- this is not yet supported. netbsd 6 lacks
echo --------------------- certain things needed for clang support
export CC=clang
export CXX=clang++
export QMAKESPEC=./patches/mkspecs/netbsd-clang
echo CC has been modified: $CC
echo CXX has been modified: $CXX
echo QMAKESPEC has been modified: $QMAKESPEC
}
clean_note()
{
if [ "`command -v qmake-qt4`" ]; then
QMAKEBIN=qmake-qt4
else
QMAKEBIN=qmake
fi
echo "Please re-run" $QMAKEBIN "and run 'make clean' if necessary"
}
if [ "`echo $* | grep brew`" ]; then
linuxbrew
elif [ "`uname | grep -i 'linux\|debian'`" ]; then
setenv_common
if [ "`echo $* | grep clang`" ]; then
setenv_linux_clang
fi
elif [ "`uname | grep -i freebsd`" ]; then
setenv_freebsd
elif [ "`uname | grep -i netbsd`" ]; then
setenv_netbsd
if [ "`echo $* | grep clang`" ]; then
setenv_netbsd_clang
fi
else
# guess
setenv_common
echo unknown system. guessed env variables. see 'setenv-unibuild.sh'
fi
if [ -e $DEPLOYDIR/include/Qt ]; then
echo "Qt found under $DEPLOYDIR ... "
QTDIR=$DEPLOYDIR
export QTDIR
echo "QTDIR modified to $DEPLOYDIR"
fi
clean_note

View file

@ -17,6 +17,10 @@ if [[ $? != 0 ]]; then
exit 1
fi
# dump the logs of the virtual framebuffer system ( Xvfb, Xvnc, etc )
DEBUG_VIRTUALFB=1
export DEBUG_VIRTUALFB
if [[ "$DIST" == "trusty" ]]; then
PARALLEL=-j1
else

View file

@ -1,57 +1,21 @@
#!/bin/sh -e
# uni-build-dependencies by don bright 2012. copyright assigned to
# Marius Kintel and Clifford Wolf, 2012. released under the GPL 2, or
# later, as described in the file named 'COPYING' in OpenSCAD's project root.
# This script builds most dependencies, both libraries and binary tools,
# of OpenSCAD for Linux/BSD. It is based on macosx-build-dependencies.sh
#
# By default it builds under $HOME/openscad_deps. You can alter this by
# setting the BASEDIR environment variable or with the 'out of tree'
# feature
# Build openscad without root access
#
# Usage:
# cd openscad
# . ./scripts/setenv-unibuild.sh
# ./scripts/uni-build-dependencies.sh
#
# Out-of-tree usage:
#
# cd somepath
# . /path/to/openscad/scripts/setenv-unibuild.sh
# /path/to/openscad/scripts/uni-build-dependencies.sh
#
# Prerequisites:
# - wget or curl
# - OpenGL (GL/gl.h)
# - GLU (GL/glu.h)
# - gcc
# - Qt4
#
# If your system lacks qt4, build like this:
#
# ./scripts/uni-build-dependencies.sh qt4
# . ./scripts/setenv-unibuild.sh #(Rerun to re-detect qt4)
#
# If your system lacks glu, gettext, or glib2, you can build them as well:
#
# ./scripts/uni-build-dependencies.sh glu
# ./scripts/uni-build-dependencies.sh glib2
# ./scripts/uni-build-dependencies.sh gettext
#
# If you want to try Clang compiler (experimental, only works on linux):
#
# . ./scripts/setenv-unibuild.sh clang
#
# If you want to try Qt5 (experimental)
#
# . ./scripts/setenv-unibuild.sh qt5
# - see http://linuxbrew.sh/
#
OPENSCADDIR=$PWD
printUsage()
{
echo "Usage: $0"
<<<<<<< HEAD
echo
}
@ -467,395 +431,40 @@ build_cgal()
fi
make -j$NUMCPU
make install
=======
>>>>>>> fbsdbuild
}
build_glew()
{
GLEW_INSTALLED=
if [ -e $DEPLOYDIR/lib64/libGLEW.so ]; then
GLEW_INSTALLED=1
fi
if [ -e $DEPLOYDIR/lib/libGLEW.so ]; then
GLEW_INSTALLED=1
fi
if [ $GLEW_INSTALLED ]; then
echo "glew already installed. not building"
return
fi
version=$1
echo "Building GLEW" $version "..."
cd $BASEDIR/src
rm -rf glew-$version
if [ ! -f glew-$version.tgz ]; then
curl --insecure -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz
fi
tar xzf glew-$version.tgz
cd glew-$version
mkdir -p $DEPLOYDIR/lib/pkgconfig
# Glew's makefile is not built for Linux Multiarch. We aren't trying
# to fix everything here, just the test machines OScad normally runs on
# Fedora 64-bit
if [ "`uname -m | grep 64`" ]; then
if [ -e /usr/lib64/libXmu.so.6 ]; then
sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
fi
fi
# debian hurd i386
if [ "`uname -m | grep 386`" ]; then
if [ -e /usr/lib/i386-gnu/libXi.so.6 ]; then
sed -ibak s/"-lXi"/"\-L\/usr\/lib\/i386-gnu\/libXi.so.6"/ config/Makefile.gnu
fi
fi
# clang linux
if [ $CC ]; then
sed -ibak s/"CC = cc"/"# CC = cc"/ config/Makefile.linux
fi
MAKER=make
if [ "`uname | grep BSD`" ]; then
if [ "`command -v gmake`" ]; then
MAKER=gmake
else
echo "building glew on BSD requires gmake (gnu make)"
exit
fi
fi
GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU
GLEW_DEST=$DEPLOYDIR $MAKER install
}
build_opencsg()
{
if [ -e $DEPLOYDIR/lib/libopencsg.so ]; then
echo "OpenCSG already installed. not building"
return
fi
version=$1
echo "Building OpenCSG" $version "..."
cd $BASEDIR/src
rm -rf OpenCSG-$version
if [ ! -f OpenCSG-$version.tar.gz ]; then
curl --insecure -O http://www.opencsg.org/OpenCSG-$version.tar.gz
fi
tar xzf OpenCSG-$version.tar.gz
cd OpenCSG-$version
# modify the .pro file for qmake, then use qmake to
# manually rebuild the src/Makefile (some systems don't auto-rebuild it)
cp opencsg.pro opencsg.pro.bak
cat opencsg.pro.bak | sed s/example// > opencsg.pro
detect_glu
GLU_INCLUDE=$detect_glu_include
if [ ! $detect_glu_result ]; then
build_glu 9.0.0
fi
if [ "`command -v qmake-qt4`" ]; then
OPENCSG_QMAKE=qmake-qt4
elif [ "`command -v qmake4`" ]; then
OPENCSG_QMAKE=qmake4
elif [ "`command -v qmake-qt5`" ]; then
OPENCSG_QMAKE=qmake-qt5
elif [ "`command -v qmake5`" ]; then
OPENCSG_QMAKE=qmake5
elif [ "`command -v qmake`" ]; then
OPENCSG_QMAKE=qmake
else
echo qmake not found... using standard OpenCSG makefiles
OPENCSG_QMAKE=make
cp Makefile Makefile.bak
cp src/Makefile src/Makefile.bak
cat Makefile.bak | sed s/example// |sed s/glew// > Makefile
cat src/Makefile.bak | sed s@^INCPATH.*@INCPATH\ =\ -I$BASEDIR/include\ -I../include\ -I..\ -I$GLU_INCLUDE -I.@ > src/Makefile
cp src/Makefile src/Makefile.bak2
cat src/Makefile.bak2 | sed s@^LIBS.*@LIBS\ =\ -L$BASEDIR/lib\ -L/usr/X11R6/lib\ -lGLU\ -lGL@ > src/Makefile
tmp=$version
version=$tmp
fi
if [ ! $OPENCSG_QMAKE = "make" ]; then
OPENCSG_QMAKE=$OPENCSG_QMAKE' "QMAKE_CXXFLAGS+=-I'$GLU_INCLUDE'"'
fi
echo OPENCSG_QMAKE: $OPENCSG_QMAKE
cd $BASEDIR/src/OpenCSG-$version/src
$OPENCSG_QMAKE
cd $BASEDIR/src/OpenCSG-$version
$OPENCSG_QMAKE
make
ls lib/* include/*
if [ -e lib/.libs ]; then ls lib/.libs/*; fi # netbsd
echo "installing to -->" $DEPLOYDIR
mkdir -p $DEPLOYDIR/lib
mkdir -p $DEPLOYDIR/include
install lib/* $DEPLOYDIR/lib
install include/* $DEPLOYDIR/include
if [ -e lib/.libs ]; then install lib/.libs/* $DEPLOYDIR/lib; fi #netbsd
cd $BASEDIR
}
build_eigen()
{
version=$1
if [ -e $DEPLOYDIR/include/eigen3 ]; then
if [ `echo $version | grep 3....` ]; then
echo "Eigen3 already installed. not building"
return
fi
fi
echo "Building eigen" $version "..."
cd $BASEDIR/src
rm -rf eigen-$version
EIGENDIR="none"
if [ $version = "3.2.2" ]; then EIGENDIR=eigen-eigen-1306d75b4a21; fi
if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi
if [ $EIGENDIR = "none" ]; then
echo Unknown eigen version. Please edit script.
exit 1
fi
rm -rf ./$EIGENDIR
if [ ! -f eigen-$version.tar.bz2 ]; then
curl --insecure -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2
mv $version.tar.bz2 eigen-$version.tar.bz2
fi
tar xjf eigen-$version.tar.bz2
ln -s ./$EIGENDIR eigen-$version
cd eigen-$version
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NO_OPENGL=1 ..
make -j$NUMCPU
make install
}
# glib2 and dependencies
#build_gettext()
#{
# version=$1
# ls -l $DEPLOYDIR/include/gettext-po.h
# if [ -e $DEPLOYDIR/include/gettext-po.h ]; then
# echo "gettext already installed. not building"
# return
# fi
#
# echo "Building gettext $version..."
#
# cd "$BASEDIR"/src
# rm -rf "gettext-$version"
# if [ ! -f "glib-$version.tar.gz" ]; then
# curl --insecure -LO "http://ftpmirror.gnu.org/gettext/gettext-$version.tar.gz"
# fi
# tar xzf "gettext-$version.tar.gz"
# cd "gettext-$version"
#
# ./configure --prefix="$DEPLOYDIR"
# make -j$NUMCPU
# make install
#}
build_pkgconfig()
{
if [ "`command -v pkg-config`" ]; then
echo "pkg-config already installed. not building"
return
fi
version=$1
echo "Building pkg-config $version..."
cd "$BASEDIR"/src
rm -rf "pkg-config-$version"
if [ ! -f "pkg-config-$version.tar.gz" ]; then
curl --insecure -LO "http://pkgconfig.freedesktop.org/releases/pkg-config-$version.tar.gz"
fi
tar xzf "pkg-config-$version.tar.gz"
cd "pkg-config-$version"
./configure --prefix="$DEPLOYDIR" --with-internal-glib
make -j$NUMCPU
make install
}
build_libffi()
{
if [ -e $DEPLOYDIR/include/ffi.h ]; then
echo "libffi already installed. not building"
return
fi
version=$1
echo "Building libffi $version..."
cd "$BASEDIR"/src
rm -rf "libffi-$version"
if [ ! -f "libffi-$version.tar.gz" ]; then
curl --insecure -LO "ftp://sourceware.org/pub/libffi/libffi-$version.tar.gz"
curl --insecure -LO "http://www.linuxfromscratch.org/patches/blfs/svn/libffi-$version-includedir-1.patch"
fi
tar xzf "libffi-$version.tar.gz"
cd "libffi-$version"
if [ ! "`command -v patch`" ]; then
echo cannot proceed, need 'patch' program
exit 1
fi
patch -Np1 -i ../libffi-3.0.13-includedir-1.patch
./configure --prefix="$DEPLOYDIR"
make -j$NUMCPU
make install
}
#build_glib2()
#{
# version="$1"
# maj_min_version="${version%.*}" #Drop micro#
#
# if [ -e $DEPLOYDIR/lib/glib-2.0 ]; then
# echo "glib2 already installed. not building"
# return
# fi
#
# echo "Building glib2 $version..."
# cd "$BASEDIR"/src
# rm -rf "glib-$version"
# if [ ! -f "glib-$version.tar.xz" ]; then
# curl --insecure -LO "http://ftp.gnome.org/pub/gnome/sources/glib/$maj_min_version/glib-$version.tar.xz"
# fi
# tar xJf "glib-$version.tar.xz"
# cd "glib-$version"
# ./configure --disable-gtk-doc --disable-man --prefix="$DEPLOYDIR" CFLAGS="-I$DEPLOYDIR/include" LDFLAGS="-L$DEPLOYDIR/lib"
# make -j$NUMCPU
# make install
#}
## end of glib2 stuff
# this section allows 'out of tree' builds, as long as the system has
# the 'dirname' command installed
if [ "`command -v dirname`" ]; then
RUNDIR=$PWD
OPENSCAD_SCRIPTDIR=`dirname $0`
cd $OPENSCAD_SCRIPTDIR
OPENSCAD_SCRIPTDIR=$PWD
cd $RUNDIR
else
if [ ! -f openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')"
exit 1
else
OPENSCAD_SCRIPTDIR=$PWD
fi
if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
exit 0
fi
check_env
. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source'
. $OPENSCAD_SCRIPTDIR/common-build-dependencies.sh
SRCDIR=$BASEDIR/src
if [ ! $NUMCPU ]; then
echo "Note: The NUMCPU environment variable can be set for parallel builds"
NUMCPU=1
if [ ! "`uname -m`|grep x86_64" ]; then
echo "requires x86_64 bit cpu sorry, please see linuxbrew.sh"
fi
if [ ! -d $BASEDIR/bin ]; then
mkdir -p $BASEDIR/bin
fi
echo "Using basedir:" $BASEDIR
echo "Using deploydir:" $DEPLOYDIR
echo "Using srcdir:" $SRCDIR
echo "Number of CPUs for parallel builds:" $NUMCPU
mkdir -p $SRCDIR $DEPLOYDIR
# this section builds some basic tools, if they are missing or outdated
# they are installed under $BASEDIR/bin which we have added to our PATH
if [ ! "`command -v curl`" ]; then
# to prevent "end of file" NSS error -5938 (ssl) use a newer version of curl
build_curl 7.49.0
fi
if [ ! "`command -v bison`" ]; then
build_bison 2.6.1
fi
# NB! For cmake, also update the actual download URL in the function
if [ ! "`command -v cmake`" ]; then
build_cmake 2.8.8
fi
# see README for needed version (this should match 1<minimum)
if [ "`cmake --version | grep 'version 2.[1-8][^0-9][1-4] '`" ]; then
build_cmake 2.8.8
fi
# Singly build certain tools or libraries
if [ $1 ]; then
if [ $1 = "git" ]; then
build_git 1.7.10.3
exit $?
fi
if [ $1 = "cgal" ]; then
build_cgal 4.4 use-sys-libs
exit $?
fi
if [ $1 = "opencsg" ]; then
build_opencsg 1.3.2
exit $?
fi
if [ $1 = "qt4" ]; then
# such a huge build, put here by itself
build_qt4 4.8.4
exit $?
fi
if [ $1 = "qt5scintilla2" ]; then
build_qt5scintilla2 2.8.3
exit $?
fi
if [ $1 = "qt5" ]; then
build_qt5 5.3.1
build_qt5scintilla2 2.8.3
exit $?
fi
if [ $1 = "glu" ]; then
# Mesa and GLU split in late 2012, so it's not on some systems
build_glu 9.0.0
exit $?
fi
if [ $1 = "gettext" ]; then
# such a huge build, put here by itself
build_gettext 0.18.3.1
exit $?
fi
if [ $1 = "harfbuzz" ]; then
# debian 7 lacks only harfbuzz
build_harfbuzz 0.9.35 --with-glib=yes
exit $?
fi
if [ $1 = "glib2" ]; then
# such a huge build, put here by itself
build_pkgconfig 0.28
build_libffi 3.0.13
#build_gettext 0.18.3.1
build_glib2 2.38.2
exit $?
fi
. ./scripts/setenv-unibuild.sh
cd $HOME
brewurl=https://raw.githubusercontent.com/Linuxbrew/install/master/install
if [ ! -e ~/.linuxbrew ]; then
ruby -e "$(curl -fsSL "$brewurl")"
fi
brew update
pkgs='eigen boost cgal glew glib opencsg freetype libxml2 fontconfig'
pkgs=$pkgs' harfbuzz qt5 qscintilla2 imagemagick'
for formula in $pkgs; do
brew install $formula
brew outdated $formula || brew upgrade $formula
done
brew link --force gettext
brew link --force qt5
brew link --force qscintilla2
<<<<<<< HEAD
# todo - cgal 4.02 for gcc<4.7, gcc 4.2 for above
#
@ -884,5 +493,6 @@ build_libxml2 2.9.1
build_fontconfig 2.11.0 --with-add-fonts=/usr/X11R6/lib/X11/fonts,/usr/local/share/fonts
build_ragel 6.9
build_harfbuzz 0.9.35 --with-glib=yes
=======
>>>>>>> fbsdbuild
echo "OpenSCAD dependencies built and installed to " $BASEDIR

View file

@ -45,14 +45,31 @@ get_freebsd_deps()
pkg_add -r bison boost-libs cmake git bash eigen3 flex gmake gmp mpfr \
xorg libGLU libXmu libXi xorg-vfbserver glew \
qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic \
opencsg cgal curl imagemagick glib2-devel gettext
opencsg cgal curl imagemagick glib2-devel gettext harfbuzz libxml2 \
qscintilla2
}
get_netbsd_deps()
get_freebsd_10_3_deps()
{
pkg install bison boost-libs cmake git bash eigen flex gmake gmp mpfr \
xorg libGLU libXmu libXi xorg-vfbserver glew \
opencsg cgal curl imagemagick glib gettext \
qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic \
qscintilla2 \
harfbuzz ragel imagemagick gettext libxml2 libxslt
# on freebsd10 opencsg is linked to qt4 so qt5 cannot be used on default
# qt5 qscintilla2-qt5 qt5-3d qt5-buildtools qt5-core \
# qt5-gui qt5-opengl qt5-qmake \
}
get_netbsd7_deps()
{
pkgin install bison boost cmake git bash eigen3 flex gmake gmp mpfr \
qt4 glew cgal opencsg python27 curl \
ImageMagick glib2 gettext
ImageMagick glib2 gettext \
fontconfig qt4-qscintilla harfbuzz freetype2 ragel libxml2 \
modular-xorg-server modular-xorg-fonts
# xorg-server has Xvfb virtual framebuffer
}
get_opensuse_deps()
@ -290,6 +307,14 @@ try_using_uname()
get_freebsd_deps
elif [ "`uname | grep -i netbsd`" ]; then
get_netbsd_deps
elif [ "`uname -a | grep -i freebsd.1[0-9].[0-9]`" ]; then
get_freebsd_10_3_deps
elif [ "`uname -a | grep -i freebsd`" ]; then
get_freebsd_deps
elif [ "`uname -a | grep -i netbsd.6`" ]; then
echo sorry netbsd 6 is not advised, you have to hack it yourself
elif [ "`uname -a | grep -i netbsd`" ]; then
get_netbsd7_deps
else
try_result=0
fi

View file

@ -264,8 +264,9 @@ bool create_glx_dummy_context(OffscreenContext &ctx)
bool result = false;
ctx.xdisplay = XOpenDisplay(NULL);
if (ctx.xdisplay == NULL) {
cerr << "Unable to open a connection to the X server.\n";
cerr << "Unable to open a connection to the X server.\n";
char * dpyenv = getenv("DISPLAY");
cerr << "DISPLAY=" << (dpyenv?dpyenv:"") << "\n";
return false;

View file

@ -17,7 +17,8 @@ OffscreenView::OffscreenView(int width, int height)
OffscreenView::~OffscreenView()
{
teardown_offscreen_context(this->ctx);
bool teardown_result = teardown_offscreen_context(this->ctx);
PRINTDB("Offscreen Context Teardown Result: %i", teardown_result );
}
#ifdef ENABLE_OPENCSG

View file

@ -165,19 +165,19 @@ static void version()
exit(0);
}
static void info()
static int info()
{
std::cout << LibraryInfo::info() << "\n\n";
std::cout << LibraryInfo::info() << std::endl;
try {
OffscreenView glview(512,512);
std::cout << glview.getRendererInfo() << "\n";
std::cout << glview.getRendererInfo() << std::endl;
} catch (int error) {
PRINTB("Can't create OpenGL OffscreenView. Code: %i. Exiting.\n", error);
exit(1);
return 1;
}
exit(0);
return 0;
}
/**
@ -330,7 +330,7 @@ int cmdline(const char *deps_output_file, const std::string &filename, Camera &c
GeometryEvaluator geomevaluator(tree);
#endif
if (arg_info) {
info();
return info();
}
const char *stl_output_file = NULL;

View file

@ -154,7 +154,6 @@ if ( ${DIFFPNG} )
endif()
message(STATUS "Detecting GL subsystem for Windows(TM)")
if (MSYS)
execute_process(${OPENSCAD_BINARY} ${EXAMPLES_DIR}/Basics/CSG.scad -o testgl.png RESULT_VARIABLE gl_result)

View file

@ -1,11 +0,0 @@
@echo off
@echo Welcome to the OpenSCAD test console. Basic commands:
@echo.
@echo ctest :: run standard set of tests
@echo ctest -C All :: run all tests
@echo ctest -R cgal.*circle :: run all tests named 'cgal ... circle'
@echo.
@echo (For full instructions please see ..\doc\testing.txt)
@echo.
@echo on

View file

@ -3,7 +3,33 @@
# Toggle the Virtual Framebuffer
# If started, stop. If stopped, start.
debug=1
debug=$DEBUG_VIRTUALFB
verify_pid()
{
verify_pid_result=0
PID0=$1
PID1=$2
BIN=$3
if [ "`ps cax | grep $PID0 | grep $BIN`" ]; then
verify_pid_result=$PID0
elif [ "`ps cax | grep $PID1 | grep $BIN`" ]; then
verify_pid_result=$PID1
fi
return
}
guess_pid_from_ps()
{
guess_pid_from_ps_result=0
BIN=$1
if [ "`ps cx | grep $BIN`" ]; then
echo guessing PID from ps cx '|' grep $BIN
echo `ps cx | grep $BIN`
guess_pid_from_ps_result=`ps cx | grep $BIN | awk '{ print $1 }';`
fi
return
}
verify_pid()
{
@ -74,7 +100,7 @@ start()
VFB_PID=$verify_pid_result
count=0
else
echo "failed to find PID $VFB_PID_MINUS0 or $VFB_PID_MINUS1. Retrying"
echo "failed to find PID $VFB_PID_MINUS0 or $VFB_PID_MINUS1 from "'$!'" Retrying"
sleep 1
count=`expr $count - 1`
fi
@ -117,11 +143,15 @@ stop()
if [ -e $LOCKFILE ]; then
rm $LOCKFILE
fi
cat virtualfb1.log
cat virtualfb2.log
echo 'dump ~/.xession-errors:'
cat ~/.xsession-errors
echo 'end ~/.xession-errors'
if [ $debug ]; then
echo 'virtualfb1.log:(stdout)'
cat virtualfb1.log
echo 'virtualfb2.log:(stderr)'
cat virtualfb2.log
echo 'dump ~/.xession-errors:'
cat ~/.xsession-errors
echo 'end ~/.xession-errors'
fi
rm ./virtualfb.PID
rm ./virtualfb.DISPLAY
}

View file

@ -1,57 +1,7 @@
# get VERSION from system date
isEmpty(VERSION) {
win32*:!mingw-cross-env:!mingw-cross-env-shared {
#
# Windows XP date command only has one argument, /t
# and it can print the date in various localized formats.
# This code will detect MM/DD/YYYY, YYYY/MM/DD, and DD/MM/YYYY
#
SYSDATE = $$system(date /t)
SYSDATE = $$replace(SYSDATE,"/",".")
SYSDATE ~= s/[A-Za-z]*// # remove name of day
DATE_SPLIT=$$split(SYSDATE, ".")
DATE_X=$$member(DATE_SPLIT, 0)
DATE_Y=$$member(DATE_SPLIT, 1)
DATE_Z=$$member(DATE_SPLIT, 2)
TEST1=$$find(DATE_X, [0-9]{4} )
TEST2=$$find(DATE_Z, [0-9]{4} )
QDATE = $$_DATE_
QDATE_SPLIT = $$split(QDATE)
QDAY = $$member(QDATE_SPLIT,2)
!isEmpty(TEST1) {
contains( QDAY, $$DATE_Z ) {
# message("Assuming YYYY/MM/DD format")
VERSION_YEAR = $$DATE_X
VERSION_MONTH = $$DATE_Y
VERSION_DAY = $$DATE_Z
}
} else {
!isEmpty(TEST2) {
contains( DATE_X, $$QDAY ) {
# message("Assuming DD/MM/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z )
VERSION_DAY = $$DATE_X
VERSION_MONTH = $$DATE_Y
VERSION_YEAR = $$DATE_Z
} else {
# message("Assuming MM/DD/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z )
VERSION_MONTH = $$DATE_X
VERSION_DAY = $$DATE_Y
VERSION_YEAR = $$DATE_Z
}
} else {
# test1 and test2 both empty
error("Couldn't parse Windows date. please run 'qmake VERSION=YYYY.MM.DD' with todays date")
}
} # isEmpty(TEST1)
VERSION = $$VERSION_YEAR"."$$VERSION_MONTH"."$$VERSION_DAY
# message("YMD Version:" $$VERSION)
} else {
# Unix/Mac
VERSION = $$system(date "+%Y.%m.%d")
}
VERSION = $$system(date "+%Y.%m.%d")
}
# Split off patch level indicator