summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mingw-cross-env.pri15
-rw-r--r--openscad.pro4
-rw-r--r--scripts/installer.nsi4
-rw-r--r--scripts/mingw-file-association.nsh225
-rwxr-xr-xscripts/mingw-x-build-dependencies.sh40
-rwxr-xr-xscripts/mingw-x-build-installer.sh86
-rw-r--r--scripts/setenv-mingw-xbuild.sh25
7 files changed, 364 insertions, 35 deletions
diff --git a/mingw-cross-env.pri b/mingw-cross-env.pri
index bc6f33a..9b808c0 100644
--- a/mingw-cross-env.pri
+++ b/mingw-cross-env.pri
@@ -11,21 +11,6 @@ CONFIG(mingw-cross-env) {
LIBS += mingw-cross-env/lib/libgmp.a
LIBS += mingw-cross-env/lib/libCGAL.a
QMAKE_CXXFLAGS += -fpermissive
-
-
- # Use different location for the cross-compiled binaries + .o files
- # This allows compiling unix build + mingw build in same tree
-
- DESTDIR=.
-
- Release:DESTDIR = release_mingw32
- Debug:DESTDIR = debug_mingw32
-
- OBJECTS_DIR = $$DESTDIR/objects
- MOC_DIR = $$DESTDIR/moc
- RCC_DIR = $$DESTDIR/rcc
- UI_DIR = $$DESTDIR/ui
-
}
diff --git a/openscad.pro b/openscad.pro
index 3dfd1c5..2f02473 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -103,6 +103,10 @@ netbsd* {
QMAKE_CXXFLAGS *= -fno-strict-aliasing
}
+*lyoob* {
+ message("lyoobyoo")
+}
+
*clang* {
# disable enormous amount of warnings about CGAL
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
diff --git a/scripts/installer.nsi b/scripts/installer.nsi
index 269a30c..1e56422 100644
--- a/scripts/installer.nsi
+++ b/scripts/installer.nsi
@@ -1,11 +1,11 @@
-!include "FileAssociation.nsh"
+!include "mingw-file-association.nsh"
Name "OpenSCAD"
OutFile "openscad_setup.exe"
InstallDir $PROGRAMFILES\OpenSCAD
DirText "This will install OpenSCAD on your computer. Choose a directory"
Section "install"
SetOutPath $INSTDIR
-File openscad.exe
+File release/openscad.exe
File /r examples
File /r libraries
${registerExtension} "$INSTDIR\openscad.exe" ".scad" "OpenSCAD_File"
diff --git a/scripts/mingw-file-association.nsh b/scripts/mingw-file-association.nsh
new file mode 100644
index 0000000..380b468
--- /dev/null
+++ b/scripts/mingw-file-association.nsh
@@ -0,0 +1,225 @@
+/*
+nsis.sourceforge.net COPYRIGHT
+Copyright (C) 1995-2009 Contributors
+
+Note the 'edit' page of the wiki at nsis.sourceforge.net specifically
+states the following:
+
+"All contributions sent to this wiki are generally considered to be in
+the zlib/libpng license (see License for details)."
+
+The NSIS 'license' link on the wiki states the following:
+
+"All NSIS source code, plug-ins, documentation, examples, header files
+and graphics, with the exception of the compression modules and where
+otherwise noted, are licensed under the zlib/libpng license."
+
+http://nsis.sourceforge.net/File_Assocation lists these authors:
+
+Author: Vytautas (talk, contrib)
+Author: intersol (talk, contrib)
+Author: chefkoch (talk, contrib)
+
+ZLIB/LIBPNG LICENSE
+-------------------
+
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/*
+_____________________________________________________________________________
+
+ File Association
+_____________________________________________________________________________
+
+ Based on code taken from http://nsis.sourceforge.net/File_Association
+
+ Usage in script:
+ 1. !include "FileAssociation.nsh"
+ 2. [Section|Function]
+ ${FileAssociationFunction} "Param1" "Param2" "..." $var
+ [SectionEnd|FunctionEnd]
+
+ FileAssociationFunction=[RegisterExtension|UnRegisterExtension]
+
+_____________________________________________________________________________
+
+ ${RegisterExtension} "[executable]" "[extension]" "[description]"
+
+"[executable]" ; executable which opens the file format
+ ;
+"[extension]" ; extension, which represents the file format to open
+ ;
+"[description]" ; description for the extension. This will be display in Windows Explorer.
+ ;
+
+
+ ${UnRegisterExtension} "[extension]" "[description]"
+
+"[extension]" ; extension, which represents the file format to open
+ ;
+"[description]" ; description for the extension. This will be display in Windows Explorer.
+ ;
+
+_____________________________________________________________________________
+
+ Macros
+_____________________________________________________________________________
+
+ Change log window verbosity (default: 3=no script)
+
+ Example:
+ !include "FileAssociation.nsh"
+ !insertmacro RegisterExtension
+ ${FileAssociation_VERBOSE} 4 # all verbosity
+ !insertmacro UnRegisterExtension
+ ${FileAssociation_VERBOSE} 3 # no script
+*/
+
+
+!ifndef FileAssociation_INCLUDED
+!define FileAssociation_INCLUDED
+
+!include Util.nsh
+
+!verbose push
+!verbose 3
+!ifndef _FileAssociation_VERBOSE
+ !define _FileAssociation_VERBOSE 3
+!endif
+!verbose ${_FileAssociation_VERBOSE}
+!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE`
+!verbose pop
+
+!macro FileAssociation_VERBOSE _VERBOSE
+ !verbose push
+ !verbose 3
+ !undef _FileAssociation_VERBOSE
+ !define _FileAssociation_VERBOSE ${_VERBOSE}
+ !verbose pop
+!macroend
+
+
+
+!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION
+ !verbose push
+ !verbose ${_FileAssociation_VERBOSE}
+ Push `${_DESCRIPTION}`
+ Push `${_EXTENSION}`
+ Push `${_EXECUTABLE}`
+ ${CallArtificialFunction} RegisterExtension_
+ !verbose pop
+!macroend
+
+!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION
+ !verbose push
+ !verbose ${_FileAssociation_VERBOSE}
+ Push `${_EXTENSION}`
+ Push `${_DESCRIPTION}`
+ ${CallArtificialFunction} UnRegisterExtension_
+ !verbose pop
+!macroend
+
+
+
+!define RegisterExtension `!insertmacro RegisterExtensionCall`
+!define un.RegisterExtension `!insertmacro RegisterExtensionCall`
+
+!macro RegisterExtension
+!macroend
+
+!macro un.RegisterExtension
+!macroend
+
+!macro RegisterExtension_
+ !verbose push
+ !verbose ${_FileAssociation_VERBOSE}
+
+ Exch $R2 ;exe
+ Exch
+ Exch $R1 ;ext
+ Exch
+ Exch 2
+ Exch $R0 ;desc
+ Exch 2
+ Push $0
+ Push $1
+
+ ReadRegStr $1 HKCR $R1 "" ; read current file association
+ StrCmp "$1" "" NoBackup ; is it empty
+ StrCmp "$1" "$R0" NoBackup ; is it our own
+ WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value
+NoBackup:
+ WriteRegStr HKCR $R1 "" "$R0" ; set our file association
+
+ ReadRegStr $0 HKCR $R0 ""
+ StrCmp $0 "" 0 Skip
+ WriteRegStr HKCR "$R0" "" "$R0"
+ WriteRegStr HKCR "$R0\shell" "" "open"
+ WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0"
+Skip:
+ WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
+ WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
+ WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
+
+ Pop $1
+ Pop $0
+ Pop $R2
+ Pop $R1
+ Pop $R0
+
+ !verbose pop
+!macroend
+
+
+
+!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
+!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
+
+!macro UnRegisterExtension
+!macroend
+
+!macro un.UnRegisterExtension
+!macroend
+
+!macro UnRegisterExtension_
+ !verbose push
+ !verbose ${_FileAssociation_VERBOSE}
+
+ Exch $R1 ;desc
+ Exch
+ Exch $R0 ;ext
+ Exch
+ Push $0
+ Push $1
+
+ ReadRegStr $1 HKCR $R0 ""
+ StrCmp $1 $R1 0 NoOwn ; only do this if we own it
+ ReadRegStr $1 HKCR $R0 "backup_val"
+ StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
+ DeleteRegKey HKCR $R0
+ Goto NoOwn
+
+Restore:
+ WriteRegStr HKCR $R0 "" $1
+ DeleteRegValue HKCR $R0 "backup_val"
+ DeleteRegKey HKCR $R1 ;Delete key with association name settings
+
+NoOwn:
+
+ Pop $1
+ Pop $0
+ Pop $R1
+ Pop $R0
+
+ !verbose pop
+!macroend
+
+!endif # !FileAssociation_INCLUDED
+
diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh
index e820e20..405b7e8 100755
--- a/scripts/mingw-x-build-dependencies.sh
+++ b/scripts/mingw-x-build-dependencies.sh
@@ -19,15 +19,8 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then
echo "Must be run from the OpenSCAD source root directory"
exit 0
fi
-BASEDIR=$HOME/openscad_deps
-MXEDIR=$BASEDIR/mxe
-PATH=$MXEDIR/usr/bin:$PATH
-mkdir -p $BASEDIR
-
-echo MXEDIR: $MXEDIR
-echo BASEDIR: $BASEDIR
echo OPENSCADDIR: $OPENSCADDIR
-echo PATH modified with $MXEDIR/usr/bin
+
if [ ! $NUMCPU ]; then
echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)";
NUMCPU=1
@@ -40,10 +33,18 @@ if [ ! $NUMJOBS ]; then
NUMJOBS=1
fi
fi
-echo NUMCPU: $NUMCPU
-echo NUMJOBS: $NUMJOBS
+
+. ./scripts/setenv-mingw-xbuild.sh
+
+if [ ! -e $BASEDIR ]; then
+ mkdir -p $BASEDIR
+fi
+if [ ! -e $DEPLOYDIR ]; then
+ mkdir -p $DEPLOYDIR
+fi
cd $BASEDIR
+
if [ ! -e mxe ]; then
echo "Downloading MXE into " $MXEDIR
git clone git://github.com/mxe/mxe.git
@@ -53,22 +54,25 @@ echo "entering" $MXEDIR
cd $MXEDIR
echo "make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS"
make mpfr eigen opencsg cgal qt -j $NUMCPU JOBS=$NUMJOBS
-#make mpfr -j$NUMCPU JOBS=$NUMJOBS # for testing
+#make mpfr -j $NUMCPU JOBS=$NUMJOBS # for testing
echo "leaving" $MXEDIR
+
echo "entering $OPENSCADDIR"
cd $OPENSCADDIR
-if [ -e mingw-cross-env ]; then
- rm ./mingw-cross-env
+
+if [ -e $DEPLOYDIR/mingw-cross-env ]; then
+ rm $DEPLOYDIR/mingw-cross-env
fi
-echo "linking mingw-cross-env directory"
-ln -s $MXEDIR/usr/i686-pc-mingw32/ ./mingw-cross-env
+echo "linking mxe to" $DEPLOYDIR/mingw-cross-env
+ln -s $MXEDIR/usr/i686-pc-mingw32/ $DEPLOYDIR/mingw-cross-env
echo
-echo "now copy/paste the following to cross-build openscad"
+echo "now copy/paste the following to cross-build openscad in" $DEPLOYDIR
echo
-echo "export PATH=$MXEDIR/usr/bin:\$PATH"
-echo "i686-pc-mingw32-qmake CONFIG+=mingw-cross-env openscad.pro"
+echo cd $DEPLOYDIR
+echo "i686-pc-mingw32-qmake CONFIG+=mingw-cross-env ../openscad.pro"
#echo "make -j$NUMCPU" # causes parser_yacc.hpp errors
echo "make"
+echo cd $OPENSCADDIR
echo
diff --git a/scripts/mingw-x-build-installer.sh b/scripts/mingw-x-build-installer.sh
new file mode 100755
index 0000000..6fd5407
--- /dev/null
+++ b/scripts/mingw-x-build-installer.sh
@@ -0,0 +1,86 @@
+#!/bin/sh -e
+#
+# This script builds a binary install package of OpenSCAD for Windows
+# using a cross-built mingw OpenSCAD and the NSIS installer system
+#
+# This script must be run from the OpenSCAD source root directory
+#
+# Usage: ./scripts/mingw-x-build-installer.sh
+#
+# Result: binary installer in $DEPLOYDIR directory
+#
+#
+# Prerequisites:
+#
+# source ./scripts/setenv-mingw-xbuild.sh
+# ./scripts/mingw-x-build-dependencues.sh
+#
+# and then build openscad before running this script.
+#
+# You need MCAD. run 'git submodule init && git submodule update'
+#
+# You need the Nullsoft installer system, on ubuntu 'sudo apt-get install nsis'
+#
+# Also see http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
+#
+
+OPENSCADDIR=$PWD
+if [ ! -f $OPENSCADDIR/openscad.pro ]; then
+ echo "Must be run from the OpenSCAD source root directory"
+ exit 0
+fi
+
+. ./scripts/setenv-mingw-xbuild.sh
+
+if [ ! -e $OPENSCADDIR/libraries/MCAD ]; then
+ echo "Downloading MCAD"
+ git submodule init
+ git submodule update
+fi
+
+if [ ! -e $DEPLOYDIR ]; then
+ echo $DEPLOYDIR "empty. Please build OpenSCAD for mingw32 first."
+ exit 0
+fi
+
+OPENSCAD_EXE=$DEPLOYDIR/release/openscad.exe
+
+if [ ! -e $OPESCAD_EXE ]; then
+ echo "Can't find" $OPENSCAD_EXE "Please build OpenSCAD for mingw32 first."
+ exit 0
+fi
+
+if [ ! "`command -v makensis`" ]; then
+ echo "makensis not found. please install nsis"
+ exit 0
+fi
+
+
+echo "Copying files to" $DEPLOYDIR
+
+copy_files()
+{
+ echo "copying" $1
+ cp -a $1 $2
+}
+
+copy_files $OPENSCADDIR/libraries $DEPLOYDIR
+copy_files $OPENSCADDIR/examples $DEPLOYDIR
+copy_files $OPENSCADDIR/scripts/installer.nsi $DEPLOYDIR
+copy_files $OPENSCADDIR/scripts/mingw-file-association.nsh $DEPLOYDIR
+
+echo "running makensis in" $DEPLOYDIR
+
+cd $DEPLOYDIR && makensis -V2 installer.nsi
+
+cd $OPENSCADDIR
+
+INSTALLFILE=$DEPLOYDIR/openscad_setup.exe
+
+if [ -e $INSTALLFILE ]; then
+ echo "Build complete. Install file ready:"
+ echo " " $INSTALLFILE
+else
+ echo "Build failed. Sorry."
+fi
+
diff --git a/scripts/setenv-mingw-xbuild.sh b/scripts/setenv-mingw-xbuild.sh
new file mode 100644
index 0000000..8417e0a
--- /dev/null
+++ b/scripts/setenv-mingw-xbuild.sh
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+#
+# set environment variables for mingw/mxe cross-build
+#
+# Usage: source ./scripts/setenv-mingw-xbuild.sh
+#
+# Prerequisites:
+#
+# 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
+#
+
+if [ ! $BASEDIR ]; then
+ BASEDIR=$HOME/openscad_deps
+fi
+export DEPLOYDIR=$OPENSCADDIR/mingw32
+export MXEDIR=$BASEDIR/mxe
+export PATH=$MXEDIR/usr/bin:$PATH
+
+echo MXEDIR: $MXEDIR
+echo BASEDIR: $BASEDIR
+echo DEPLOYDIR: $DEPLOYDIR
+echo PATH modified with $MXEDIR/usr/bin
+
contact: Jan Huwald // Impressum