From d57029a52ba6a815ac5c9cc6c5f4dc7205fcc8cd Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 05:16:15 +0100 Subject: fix bug where if $MXEDIR didn't already exist, build failed diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index 76bb7d4..ee51848 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -41,8 +41,9 @@ if [ ! -e $BASEDIR ]; then fi if [ ! -e $MXEDIR ]; then - echo "Downloading MXE into " $MXEDIR + mkdir -p $MXEDIR cd $MXEDIR/.. + echo "Downloading MXE into " $PWD git clone git://github.com/mxe/mxe.git fi -- cgit v0.10.1 From f07edc4f053b65e567230645ccbcb8aa335b9f18 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 08:47:54 +0100 Subject: allow 'mingw32' option. dont use OSTYPE. fix docs. allow NUMCPU multicore build diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 62f8ed8..6cb5b97 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -1,15 +1,16 @@ #!/bin/bash # -# This script creates a binary release of OpenSCAD. -# This should work under Mac OS X, Windows (msys), and Linux cross-compiling -# for windows using mingw-cross-env (use like: OSTYPE=mingw-cross-env release-common.sh). -# Linux support pending. -# The script will create a file called openscad-.zip -# in the current directory (or in the $DEPLOYDIR of a mingw cross build) +# This script creates a binary release of OpenSCAD. This should work +# under Mac OS X, Windows (msys), Linux 32, Linux 64, and Linux->Win32 MXE +# cross-build. # -# Usage: release-common.sh [-v ] [-c] -# -v Version string (e.g. -v 2010.01) -# -c Build with commit info +# The script will create a file called openscad-. in +# the current directory (or under ./mingw32) +# +# Usage: release-common.sh [-v ] [-c] [-x32] +# -v Version string (e.g. -v 2010.01) +# -c Build with commit info +# -mingw32 Cross-compile for win32 using MXE # # If no version string is given, todays date will be used (YYYY-MM-DD) # If no make target is given, release will be used on Windows, none one Mac OS X @@ -42,11 +43,18 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then ARCH=32 fi echo "Detected ARCH: $ARCH" -elif [[ $OSTYPE == "mingw-cross-env" ]]; then +fi + +if [ "`echo $* | grep mingw32`" ]; then OS=LINXWIN fi -echo "Detected OS: $OS" +if [ $OS ]; then + echo "Detected OS: $OS" +else + echo "Error: Couldn't detect OSTYPE" + exit +fi while getopts 'v:c' c do @@ -147,14 +155,19 @@ case $OS in ;; esac +if [ ! $NUMCPU ]; then + echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; + NUMCPU=2 +fi + case $OS in LINXWIN) - # make -jx sometimes has problems with parser_yacc + # dont use paralell builds, it can error-out on parser_yacc. cd $DEPLOYDIR && make $TARGET cd $OPENSCADDIR ;; *) - make -j2 $TARGET + make -j$NUMCPU $TARGET ;; esac -- cgit v0.10.1 From b64139788c0679b572c68045d28a4933dcc44d36 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 08:52:21 +0100 Subject: fix tabs in svg.cc diff --git a/src/svg.cc b/src/svg.cc index e5130b0..ff13332 100644 --- a/src/svg.cc +++ b/src/svg.cc @@ -96,7 +96,7 @@ std::string dump_cgal_nef_polyhedron2_face_svg( bool mark, CGAL_Iso_rectangle_2e bbox ) { - std::stringstream out; + std::stringstream out; CGAL_For_all(c1, c2) { if ( explorer.is_standard( explorer.target(c1) ) ) { CGAL_Point_2e source = explorer.point( explorer.source( c1 ) ); @@ -106,7 +106,7 @@ std::string dump_cgal_nef_polyhedron2_face_svg( double mod=0; if (color=="green") mod=10; out << " \n"; - out << " \n"; out << svg_border() << "\n" << svg_axes() << "\n"; svg_cursor_py += svg_px_height; for ( i = explorer.faces_begin(); i!= explorer.faces_end(); ++i ) { - out << " \n"; - CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c1 - = explorer.face_cycle( i ), c2 ( c1 ); - out << dump_cgal_nef_polyhedron2_face_svg( c1, c2, explorer, "red", i->mark(), bbox ); - - CGAL_Nef_polyhedron2::Explorer::Hole_const_iterator j; - for ( j = explorer.holes_begin( i ); j!= explorer.holes_end( i ); ++j ) { - out << " \n"; - CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c3( j ), c4 ( c3 ); - out << dump_cgal_nef_polyhedron2_face_svg( c3, c4, explorer, "green", j->mark(), bbox ); - out << " \n"; - } - out << " \n"; - } - out << ""; + out << " \n"; + CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c1 + = explorer.face_cycle( i ), c2 ( c1 ); + out << dump_cgal_nef_polyhedron2_face_svg( c1, c2, explorer, "red", i->mark(), bbox ); + + CGAL_Nef_polyhedron2::Explorer::Hole_const_iterator j; + for ( j = explorer.holes_begin( i ); j!= explorer.holes_end( i ); ++j ) { + out << " \n"; + CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c3( j ), c4 ( c3 ); + out << dump_cgal_nef_polyhedron2_face_svg( c3, c4, explorer, "green", j->mark(), bbox ); + out << " \n"; + } + out << " \n"; + } + out << ""; std::string tmp = out.str(); boost::replace_all( tmp, "'", "\"" ); return tmp; @@ -219,29 +219,29 @@ public: std::string dump_svg( const CGAL_Nef_polyhedron3 &N ) { - std::stringstream out; + std::stringstream out; out << svg_header() << "\n" << svg_border() << "\n" << svg_axes() << "\n"; out << "\n"; - CGAL_Nef_polyhedron3::Volume_const_iterator c; - CGAL_forall_volumes(c,N) { - out << " \n"; - out << " \n"; - CGAL_Nef_polyhedron3::Shell_entry_const_iterator it; - CGAL_forall_shells_of(it,c) { - out << " \n"; - NefPoly3_dumper_svg dumper_svg(N); - N.visit_shell_objects(CGAL_Nef_polyhedron3::SFace_const_handle(it), dumper_svg ); + CGAL_Nef_polyhedron3::Volume_const_iterator c; + CGAL_forall_volumes(c,N) { + out << " \n"; + out << " \n"; + CGAL_Nef_polyhedron3::Shell_entry_const_iterator it; + CGAL_forall_shells_of(it,c) { + out << " \n"; + NefPoly3_dumper_svg dumper_svg(N); + N.visit_shell_objects(CGAL_Nef_polyhedron3::SFace_const_handle(it), dumper_svg ); out << dumper_svg.out.str(); - out << " \n"; - } - out << " \n"; - } - out << "\n"; + out << " \n"; + } + out << " \n"; + } + out << "\n"; out << ""; std::string tmp = out.str(); boost::replace_all( tmp, "'", "\"" ); - return tmp; + return tmp; } } // namespace -- cgit v0.10.1 From 0778a55a40fb7afe0d90b9f01d32fee47426c9a3 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 08:59:57 +0100 Subject: actually assign copyright to Marius + Clifford, to eliminate any problems with Debian. diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh index be678d3..5e361df 100755 --- a/scripts/linux-build-dependencies.sh +++ b/scripts/linux-build-dependencies.sh @@ -1,8 +1,8 @@ #!/bin/sh -e -# test_pretty_print copyright 2012 don bright. released under the GPL 2, or +# linux-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. -# permission to change this license is given to Marius Kintel & Clifford Wolf # # This script builds all library dependencies of OpenSCAD for Linux diff --git a/src/boosty.h b/src/boosty.h index 87260ff..6ec417a 100644 --- a/src/boosty.h +++ b/src/boosty.h @@ -1,6 +1,6 @@ -// boosty.h copyright 2012 don bright. released under the GPL 2, or later, -// as described in the file named 'COPYING' in OpenSCAD's project root. -// permission is given to Marius Kintel & Clifford Wolf to change this license. +// boosty.h 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. #ifndef boosty_h_ #define boosty_h_ diff --git a/src/version_check.h b/src/version_check.h index a9556e9..92b00db 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -1,6 +1,6 @@ -// version_check.h copyright 2012 don bright. released under the GPL 2, or -// later, as described in the file named 'COPYING' in OpenSCAD's project root. -// permission to change this license is given to Marius Kintel & Clifford Wolf +// version_check.h 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 file will check versions of libraries at compile time. If they are too old, the user will be warned. If the user wishes to force diff --git a/tests/test_pretty_print.py b/tests/test_pretty_print.py index 8c57f1c..a2a04ed 100755 --- a/tests/test_pretty_print.py +++ b/tests/test_pretty_print.py @@ -1,8 +1,8 @@ #!/usr/bin/python -# test_pretty_print copyright 2012 don bright. released under the GPL 2, or -# later, as described in the file named 'COPYING' in OpenSCAD's project root. -# permission to change this license is given to Marius Kintel & Clifford Wolf +# test_pretty_print 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 program 'pretty prints' the ctest output, namely -- cgit v0.10.1 From 406bf8a3a6793d0687e84872cc9b0544a8f01f80 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 09:08:11 +0100 Subject: clarify mingw32 usage in docs & in 'print usage' diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 6cb5b97..4a26f09 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -17,10 +17,13 @@ # # The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT # to identify a build in the about box. +# +# The mingw32 cross compile depends on the mxe tools + dependencies. Please +# see scripts/*mingw-* & the OpenSCAD manual for more information. printUsage() { - echo "Usage: $0 -v -c + echo "Usage: $0 -v -c -mingw32 echo echo " Example: $0 -v 2010.01 } -- cgit v0.10.1 From 5624a0e426b4d31721da9c5a633f2ac40de261a6 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 20:04:20 -0600 Subject: hand code html to remove qt cruft. makes it easier to change, and easier to spit out to cmdline (eventually) diff --git a/src/AboutDialog.h b/src/AboutDialog.h index 1ae6533..2211e63 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -16,6 +16,9 @@ public: this->aboutText->setOpenExternalLinks(true); QUrl flattr_qurl(":icons/flattr.png" ); this->aboutText->loadResource( QTextDocument::ImageResource, flattr_qurl ); + QString tmp = this->aboutText->toHtml(); + tmp.replace("__VERSION__",QString(TOSTRING(OPENSCAD_VERSION))); + this->aboutText->setHtml(tmp); } }; diff --git a/src/AboutDialog.html b/src/AboutDialog.html index e2a6264..357a6df 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -1,77 +1,132 @@ - -

-


-

OpenSCAD is Copyright (C) 2009-2012 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>

-


-

License

-


-

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.

-


-

Please visit this link for a copy of the license: GPL 2.0

-


-

Tools & Libraries used

-


-

GNU GMP

-

GNU MPFR

-

CGAL

-

Eigen2

-

OpenCSG

-

OpenGL

-

GLEW

-

Qt Toolkit

-

Boost

-

Bison

-

Flex

-

CMake

-

LodePNG

-

MingW

-

MXE

-

Linux

-

Mac OSX

-

C++, GCC, clang

-

python

-

Nullsoft installer

-


-

Acknowledgements

-


-

OpenSCAD Github Project members (public):

-


-

Marius Kintel

-

Clifford Wolf

-

Giles Bathgate

-

Brad Pitcher

-


-

Debian maintainer:

-


-

Christian M. Amsüss

-


-

Patches:

-


-

meta23

-

jasonblewis

-

gregjurman

-

brianolson

-

tjhowse

-

logxen (Mark A Cooper)

-

iamwilhelm (Wil Chung)

-

clothbot (Andrew Plumb)

-

colah (Christopher Olah)

-

-

Bug reports:

-

-

nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes, Whosawhatsis, MichaelAtOz, mrhdias, ibyte8bits, Koen Kooi, Tomas Mudrunka, knuds, cadr, mshearn, Hans L, Brett Sutton, hmnapier, Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, myglc2, Alan Cox, Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, David Goodenough, William A Adams ... and many others

-


-

Hosting & resources

-


-

Github source repository

-


-

Rock Linux mailing list

-


-

Thingiverse

-

-

Laurent Guerby and the GCC Compile Farm, with OSUOSL, IBM, IRILL, Intel, FSF France, and AMD.

-


-

Apologies to anyone accidentally left out.

+ + + + + + + + +

+ +

+ +

+ OpenSCAD version __VERSION__ +

+ +

+ Copyright (C) 2009-2012 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at> +

+ +

+ License +

+ +

+ 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. +

+

+ Please visit this link for a copy of the license: GPL 2.0 +

+

+ Tools & Libraries used +

+ + +
  • GNU GMP +
  • GNU MPFR +
  • CGAL +
  • Eigen2 +
  • OpenCSG +
  • OpenGL +
  • GLEW +
  • Qt Toolkit +
  • Boost +
  • Bison +
  • Flex +
  • CMake +
  • MingW +
  • LodePNG +
  • MXE +
  • Linux +
  • Mac OSX +
  • C++, GCC, clang +
  • python +
  • Nullsoft installer + +

    + +

    + Acknowledgements +

    + +

    + OpenSCAD Github Project members (public) +
    + +

  • Marius Kintel +
  • Clifford Wolf +
  • Giles Bathgate +
  • Brad Pitcher +
  • Don Bright + +

    + +

    + Debian maintainer: + Christian M. Amsuess +

    + +

    + Patches +
    + +

  • meta23 +
  • jasonblewis +
  • gregjurman +
  • brianolson +
  • tjhowse +
  • logxen +
  • iamwilhelm +
  • clothbot +
  • colah + +

    + +

    + Mailing list, bug reports, testing, &c +

    + nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes, Whosawhatsis, MichaelAtOz, Tony Buser, + mrhdias, ibyte8bits, Koen Kooi, Tomas Mudrunka, knuds, cadr, mshearn, Hans L, Brett Sutton, hmnapier, + Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, + myglc2, Alan Cox, Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, + David Goodenough, William A Adams ... and many others +

    + +

    + Hosting & resources +
    + +

  • Github +
  • Rock Linux +
  • Thingiverse + +

    + Laurent Guerby and the + GCC Compile Farm, with + OSUOSL, IRILL, + FSF France, AMD, + Intel, IBM, &c. +

    +

    + +

    + Apologies to anyone left out. Please file an issue on OpenSCAD's github if you know of someone who belongs here. +

    + + + -- cgit v0.10.1 From 29c22aa55dff1a1b422bf92b2b6f7852e7be21c4 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 20:22:39 -0600 Subject: tidy up html for QTextBrowser. add shortcut for 'help' diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 357a6df..5976447 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -1,39 +1,45 @@ + + + - + +

    - +

    - OpenSCAD version __VERSION__ +OpenSCAD version __VERSION__

    - Copyright (C) 2009-2012 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at> +Copyright (C) 2009-2012 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>

    - License +License

    - 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 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.

    - Please visit this link for a copy of the license: GPL 2.0 +Please visit this link for a copy of the license: GPL 2.0

    - Tools & Libraries used +Tools & Libraries used

    @@ -61,71 +67,75 @@

    - Acknowledgements +Acknowledgements

    - OpenSCAD Github Project members (public) -
    - -

  • Marius Kintel -
  • Clifford Wolf -
  • Giles Bathgate -
  • Brad Pitcher -
  • Don Bright - +OpenSCAD Github Project members (public)

    + +
  • Marius Kintel +
  • Clifford Wolf +
  • Giles Bathgate +
  • Brad Pitcher +
  • Don Bright + +

    - Debian maintainer: +Debian maintainer: Christian M. Amsuess

    - Patches -
    - -

  • meta23 -
  • jasonblewis -
  • gregjurman -
  • brianolson -
  • tjhowse -
  • logxen -
  • iamwilhelm -
  • clothbot -
  • colah - +Patches

    + +
  • meta23 +
  • jasonblewis +
  • gregjurman +
  • brianolson +
  • tjhowse +
  • logxen +
  • iamwilhelm +
  • clothbot +
  • colah + + + +

    +Mailing list, bug reports, testing, &c +

    + +nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes, +Whosawhatsis, MichaelAtOz, Tony Buser, mrhdias, ibyte8bits, Koen Kooi, +Tomas Mudrunka, knuds, cadr, mshearn, Hans L, Brett Sutton, hmnapier, +Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, +Michael Ivko, Pierre Doucet, myglc2, Alan Cox, Peter Falke, Michael +Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, David +Goodenough, William A Adams ... and many others +

    - Mailing list, bug reports, testing, &c -

    - nop head, Triffid Hunter, Len Trigg, Kliment Yanev, Christian Siefkes, Whosawhatsis, MichaelAtOz, Tony Buser, - mrhdias, ibyte8bits, Koen Kooi, Tomas Mudrunka, knuds, cadr, mshearn, Hans L, Brett Sutton, hmnapier, - Eero af Heurlin, caliston, 5263, ghost, 42loop, uniqx, Michael Thomson, Michael Ivko, Pierre Doucet, - myglc2, Alan Cox, Peter Falke, Michael Ambrus, Gordon Wrigley, Ed Nisley, Stony Smith, Pasca Andrei, - David Goodenough, William A Adams ... and many others +Hosting & resources

    + +
  • Github +
  • Rock Linux +
  • Thingiverse + +

    - Hosting & resources -
    - -

  • Github -
  • Rock Linux -
  • Thingiverse - -

    - Laurent Guerby and the - GCC Compile Farm, with - OSUOSL, IRILL, - FSF France, AMD, - Intel, IBM, &c. -

    +Laurent Guerby and the +GCC Compile Farm, with +OSUOSL, IRILL, +FSF France, AMD, +Intel, IBM, &c.

    - Apologies to anyone left out. Please file an issue on OpenSCAD's github if you know of someone who belongs here. +Apologies to anyone left out. Please file an issue on OpenSCAD's github if you know of someone who belongs here.

    diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 13bb226..f71ac96 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -217,7 +217,7 @@ - Help + &Help -- cgit v0.10.1 From fcaa4811e20121c15d4d75ae1cc31ef93d44cf81 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 3 Dec 2012 20:38:46 -0600 Subject: move flattr image to right-hand side. diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 5976447..371ea46 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -3,8 +3,8 @@ + a normal browser alone is not a sufficient test. Just edit this file and rerun + make to do your testing. --> @@ -14,7 +14,7 @@

    - +

    -- cgit v0.10.1 From 03ef1a27eab727c122512b904cf93bb5fbd5f71d Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 4 Dec 2012 22:18:12 -0600 Subject: unify build scripts. introduce 'version checker' script. simplify instructions diff --git a/README.md b/README.md index 1f9fb53..d618f85 100644 --- a/README.md +++ b/README.md @@ -131,35 +131,29 @@ compilation process. After that, follow the Compilation instructions below. -### Building for newer Linux distributions +### Building for Linux/BSD -First, make sure that you have development tools installed to get GCC. -Then after you've cloned this git repository, use a package manager to -download packages for the dependency libraries listed above. Convenience -scripts are provided for some popular systems: +First, make sure that you have git installed. Then after you've cloned +this git repository, run the script that attempts to download the +dependency packages for your system: - Ubuntu, Debian: ./scripts/ubuntu-build-dependencies.sh - OpenSUSE: ./scripts/opensuse-build-dependencies.sh - Fedora: ./scripts/fedora-build-dependencies.sh + ./scripts/uni-get-dependencies.sh -Check your library versions to make sure they meet the minimum -requirements listed above. After that follow the Compilation -instructions below. +This will get the majority of necessary packages, although your +particular system may require you to manually install some. After installing +dependencies, check their versions. You can run this script to help you: -### Building for older Linux or building without root access + ./scripts/check-dependencies.sh -First, make sure that you have development tools installed to get GCC. -Then after you've cloned this git repository, run the script that sets -up the environment variables. +If some of yours are out of date, you can build newer versions automatically +into $HOME/openscad_deps with the following commands: source ./scripts/setenv-linbuild.sh - -Then run the script to download & compile all the prerequisite libraries above: - ./scripts/linux-build-dependencies.sh + ./scripts/check-dependencies.sh -Then add LD_LIBRARY_PATH=$HOME/openscad_deps to your ~/.bashrc -After that, follow the Compilation instructions below. +This may take several hours. If successfull, follow the Compilation +instructions below. If not, file an 'issue' on the OpenSCAD github. ### Building for Windows @@ -173,13 +167,13 @@ the script that sets up the environment variables. source ./scripts/setenv-mingw-xbuild.sh -Then run the script to download & compile all the prerequisite libraries above: +Then run the script to download & compile all the dependency libraries: ./scripts/mingw-x-build-dependencies.sh -Then skip the compilation instructions below. Instead, build an installer: +Then, build OpenSCAD and package it to an installer: - OSTYPE=mingw-cross-env ./scripts/release-common.sh + ./scripts/release-common.sh mingw32 ### Compilation diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh new file mode 100755 index 0000000..536c46f --- /dev/null +++ b/scripts/check-dependencies.sh @@ -0,0 +1,588 @@ +# Determine which versions of dependency libraries and tools are +# available on the system. Compare these versions with the minimum parsed +# from README.md and print results. +# +# usage +# check-dependencies.sh # check version of all dependencies +# check-dependencies.sh debug # debug this script +# +# design +# Detection is done through stages and fallbacks in case of failure. +# +# 1st stage, search by parsing header files and/or binary output +# 2nd stage, search with pkg-config +# 3rd stage, search by parsing output of package systems like dpkg or yum +# +# Goal is portability and lack of complicated regex. +# Code style is 'pretend its python'. functions return strings under +# the $function_name_result variable. tmp variables are +# funcname_abbreviated_tmp. Local vars are not used for portability. +# +# todo +# look in /usr/local/ on linux +# if /usr/ and /usr/local/ on linux both hit, throw an error +# fallback- pkgconfig --exists, then --modversion +# fallback2 - pkg manager +# todo - use OPENSCAD_LIBRARIES ??? +# - print location found, how found??? +# +DEBUG= + +debug() +{ + if [ $DEBUG ]; then echo check-dependencies.sh: $* ; fi +} + + +eigen_sysver() +{ + debug eigen + eigpath= + eig3path=$1/include/eigen3/Eigen/src/Core/util/Macros.h + eig2path=$1/include/eigen2/Eigen/src/Core/util/Macros.h + if [ -e $eig3path ]; then eigpath=$eig3path; fi + if [ -e $eig2path ]; then eigpath=$eig2path; fi + debug $eig2path + if [ ! $eigpath ]; then return; fi + eswrld=`grep "define *EIGEN_WORLD_VERSION *[0-9]*" $eigpath | awk '{print $3}'` + esmaj=`grep "define *EIGEN_MAJOR_VERSION *[0-9]*" $eigpath | awk '{print $3}'` + esmin=`grep "define *EIGEN_MINOR_VERSION *[0-9]*" $eigpath | awk '{print $3}'` + eigen_sysver_result="$eswrld.$esmaj.$esmin" +} + +opencsg_sysver() +{ + debug opencsg_sysver + if [ ! -e $1/include/opencsg.h ]; then return; fi + ocsgver=`grep "define *OPENCSG_VERSION_STRING *[0-9x]*" $1/include/opencsg.h` + ocsgver=`echo $ocsgver | awk '{print $4}' | sed s/'"'//g | sed s/[^1-9.]//g` + opencsg_sysver_result=$ocsgver +} + +cgal_sysver() +{ + cgalpath=$1/include/CGAL/version.h + if [ ! -e $cgalpath ]; then return; fi + cgal_sysver_result=`grep "define *CGAL_VERSION *[0-9.]*" $cgalpath | awk '{print $3}'` +} + +boost_sysver() +{ + boostpath=$1/include/boost/version.hpp + if [ ! -e $boostpath ]; then return; fi + bsver=`grep 'define *BOOST_LIB_VERSION *[0-9_"]*' $boostpath | awk '{print $3}'` + bsver=`echo $bsver | sed s/'"'//g | sed s/'_'/'.'/g` + boost_sysver_result=$bsver +} + +mpfr_sysver() +{ + mpfrpath=$1/include/mpfr.h + if [ ! -e $mpfrpath ]; then return; fi + mpfrsver=`grep 'define *MPFR_VERSION_STRING *' $mpfrpath | awk '{print $3}'` + mpfrsver=`echo $mpfrsver | sed s/"-.*"// | sed s/'"'//g` + mpfr_sysver_result=$mpfrsver +} + +gmp_sysver() +{ + # on some systems you have VERSION in gmp-$arch.h not gmp.h. use gmp*.h + if [ ! -e $1/include ]; then return; fi + gmppaths=`ls $1/include | grep ^gmp` + if [ ! "$gmppaths" ]; then return; fi + for gmpfile in $gmppaths; do + gmppath=$1/include/$gmpfile + if [ "`grep __GNU_MP_VERSION $gmppath`" ]; then + gmpmaj=`grep "define *__GNU_MP_VERSION *[0-9]*" $gmppath | awk '{print $3}'` + gmpmin=`grep "define *__GNU_MP_VERSION_MINOR *[0-9]*" $gmppath | awk '{print $3}'` + gmppat=`grep "define *__GNU_MP_VERSION_PATCHLEVEL *[0-9]*" $gmppath | awk '{print $3}'` + fi + done + gmp_sysver_result="$gmpmaj.$gmpmin.$gmppat" +} + +qt4_sysver() +{ + qt4path=$1/include/qt4/QtCore/qglobal.h + if [ ! -e $qt4path ]; then return; fi + qt4ver=`grep 'define *QT_VERSION_STR *' $qt4path | awk '{print $3}'` + qt4ver=`echo $qt4ver | sed s/'"'//g` + qt4_sysver_result=$qt4ver +} + +glew_sysver() +{ + glew_sysver_result= # glew has no traditional version numbers +} + +imagemagick_sysver() +{ + if [ ! -x $1/bin/convert ]; then return; fi + imver=`$1/bin/convert --version | grep -i version` + imagemagick_sysver_result=`echo $imver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` +} + +flex_sysver() +{ + flexbin=$1/bin/flex + if [ -x $1/bin/gflex ]; then flexbin=$1/bin/gflex; fi # openbsd + if [ ! -x $flexbin ]; then return ; fi + flex_sysver_result=`$flexbin --version | sed s/"[^0-9.]"/" "/g` +} + +bison_sysver() +{ + if [ ! -x $1/bin/bison ]; then return ; fi + bison_sysver_result=`$1/bin/bison --version | grep bison | sed s/"[^0-9.]"/" "/g` +} + +gcc_sysver() +{ + bingcc=$1/bin/gcc + if [ ! -x $1/bin/gcc ]; then bingcc=gcc; fi + if [ ! "`$bingcc --version`" ]; then return; fi + gccver=`$bingcc --version| grep -i gcc` + gccver=`echo $gccver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` + gcc_sysver_result=$gccver +} + +git_sysver() +{ + if [ ! -x $1/bin/git ]; then return ; fi + git_sysver_result=`$1/bin/git --version | grep git | sed s/"[^0-9.]"/" "/g` +} + +curl_sysver() +{ + if [ ! -x $1/bin/curl ]; then return; fi + curl_sysver_result=`$1/bin/curl --version | grep curl | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` +} + +cmake_sysver() +{ + if [ ! -x $1/bin/cmake ]; then return ; fi + cmake_sysver_result=`$1/bin/cmake --version | grep cmake | sed s/"[^0-9.]"/" "/g` +} + +make_sysver() +{ + binmake=$1/bin/make + if [ -x $1/bin/gmake ]; then binmake=$1/bin/gmake ;fi + if [ ! -x $binmake ]; then return ;fi + make_sysver_result=`$binmake --version 2>&1 | grep -i 'gnu make' | sed s/"[^0-9.]"/" "/g` + if [ ! "`echo $make_sysver_result | grep [0-9]`" ]; then return; fi +} + +bash_sysver() +{ + if [ -x /bin/bash ]; then binbash=/bin/bash ;fi + if [ -x /usr/bin/bash ]; then binbash=/usr/bin/bash ;fi + if [ -x $1/bin/bash ]; then binbash=$1/bin/bash ;fi + if [ ! -x $binbash ]; then return; fi + bash_sysver_result=`$binbash --version | grep bash | sed s/"[^0-9. ]"/" "/g|awk '{print $1}'` +} + +python_sysver() +{ + if [ ! -x $1/bin/python ]; then return; fi + python_sysver_result=`$1/bin/python --version 2>&1 | awk '{print $2}'` +} + +set_default_package_map() +{ + glew=glew + boost=boost + eigen=eigen3 + imagemagick=imagemagick + make=make + python=python + opencsg=opencsg + cgal=cgal + bison=bison + gmp=gmp + mpfr=mpfr + bash=bash + flex=flex + gcc=gcc + cmake=cmake + curl=curl + git=git + qt4=qt4 +} + + +apt_pkg_search() +{ + debug apt_pkg_search $* + apt_pkg_search_result= + pkgname=$1 + dps_ver= + + # translate pkgname to apt packagename + set_default_package_map + for pn in cgal boost mpfr opencsg qt4; do eval $pn="lib"$pn"-dev" ; done + + # handle multiple version names of same package (ubuntu, debian, etc) + if [ $pkgname = glew ]; then + glewtest=`apt-cache search libglew-dev` + if [ "`echo $glewtest | grep glew1.6-dev`" ]; then glew=libglew1.6-dev; + elif [ "`echo $glewtest | grep glew1.5-dev`" ]; then glew=libglew1.5-dev; + elif [ "`echo $glewtest | grep glew-dev`" ]; then glew=libglew-dev; fi + elif [ $pkgname = gmp ]; then + if [ "`apt-cache search libgmp3-dev`" ]; then gmp=libgmp3-dev ;fi + if [ "`apt-cache search libgmp-dev`" ]; then gmp=libgmp-dev ;fi + fi + + debpkgname=`eval echo "$"$pkgname` + + if [ ! $debpkgname ]; then + debug "unknown package" $pkgname; return; + fi + + debug $pkgname ".deb name:" $debpkgname + if [ ! "`command -v dpkg`" ]; then + debug command dpkg not found. cannot search packages. + return + fi + + # examples of apt version strings + # cgal 4.0-4 gmp 2:5.0.5+dfsg bison 1:2.5.dfsg-2.1 cmake 2.8.9~rc1 + + if [ $pkgname = eigen ]; then + aps_null=`dpkg --status libeigen3-dev 2>&1` + if [ $? = 0 ]; then + debpkgname=libeigen3-dev + else + debpkgname=libeigen2-dev + fi + fi + + debug "test dpkg on $debpkgname" + testdpkg=`dpkg --status $debpkgname 2>&1` + if [ "$testdpkg" ]; then + #debug test dpkg: $testdpkg + if [ "`echo $testdpkg | grep -i version`" ]; then + dps_ver=`dpkg --status $debpkgname | grep -i ^version: | awk ' { print $2 }'` + debug version line from dpkg: $dps_ver + dps_ver=`echo $dps_ver | tail -1 | sed s/"[-~].*"// | sed s/".*:"// | sed s/".dfsg*"//` + debug version: $dps_ver + else + debug couldnt find version string after dpkg --status $debpkgname + fi + else + debug testdpkg failed on $debpkgname + fi + + # Available to be system + #dps_ver= + #debug "test apt-cache on $debpkgname" + # apt-cache show is flaky on older apt. dont run unless search is OK + #test_aptcache=`apt-cache search $debpkgname` + #if [ "$test_aptcache" ]; then + # test_aptcache=`apt-cache show $debpkgname` + # if [ ! "`echo $test_aptcache | grep -i no.packages`" ]; then + # ver=`apt-cache show $debpkgname | grep ^Version: | awk ' { print $2 }'` + # ver=`echo $ver | tail -1 | sed s/"[-~].*"// | sed s/".*:"// | sed s/".dfsg*"//` + # if [ $ver ] ; then vera=$ver ; fi + # fi + #fi + + apt_pkg_search_result="$dps_ver" +} + +set_fedora_package_map() +{ + cgal=CGAL-devel + eigen=eigen2-devel + qt4=qt-devel + imagemagick=ImageMagick + for pn in boost gmp mpfr glew; do eval $pn=$pn"-devel" ; done +} + +yum_pkg_search() +{ + yum_pkg_search_result= + pkgname=$1 + + set_default_package_map + set_fedora_package_map + fedora_pkgname=`eval echo "$"$pkgname` + + debug $pkgname". fedora name:" $fedora_pkgname + if [ ! $fedora_pkgname ]; then + debug "unknown package" $pkgname; return; + fi + + test_yum=`yum info $fedora_pkgname 2>&1` + if [ "$test_yum" ]; then + debug test_yum: $test_yum + ydvver=`yum info $fedora_pkgname 2>&1 | grep ^Version | awk '{print $3}' ` + if [ $ydvver ]; then ydvver=$ydvver ; fi + else + debug test_yum failed on $pkgname + fi + yum_pkg_search_result="$ydvver" +} + + +pkg_search() +{ + debug pkg_search $* + pkg_search_result= + + if [ "`command -v apt-get`" ]; then + apt_pkg_search $* + pkg_search_result=$apt_pkg_search_result + elif [ "`command -v yum`" ]; then + yum_pkg_search $* + pkg_search_result=$yum_pkg_search_result + else + echo unknown system type. cannot search packages. + fi +} + +pkg_config_search() +{ + debug pkg_config_search $* + pkg_config_search_result= + pcstmp= + if [ ! $1 ]; then return; fi + pkgname=$1 + + pkg-config --exists $pkgname 2>&1 + if [ $? = 0 ]; then + pkg_config_search_result=`pkg-config --modversion $pkgname` + else + debug pkg_config_search failed on $*, result of run was: $pcstmp + fi +} + + + + +get_minversion_from_readme() +{ + if [ -e README.md ]; then READFILE=README.md; fi + if [ -e ../README.md ]; then READFILE=../README.md; fi + if [ ! $READFILE ]; then echo "cannot find README.md"; exit; fi + debug get_minversion_from_readme $* + if [ ! $1 ]; then return; fi + depname=$1 + local grv_tmp= + debug $depname + # example--> * [CGAL (3.6 - 3.9)] (www.cgal.org) becomes 3.6 + # steps: eliminate *, find left (, find -, make 'x' into 0, delete junk + grv_tmp=`grep -i ".$depname.*([0-9]" $READFILE | sed s/"*"//` + debug $grv_tmp + grv_tmp=`echo $grv_tmp | awk -F"(" '{print $2}'` + debug $grv_tmp + grv_tmp=`echo $grv_tmp | awk -F"-" '{print $1}'` + debug $grv_tmp + grv_tmp=`echo $grv_tmp | sed s/"x"/"0"/g` + debug $grv_tmp + grv_tmp=`echo $grv_tmp | sed s/"[^0-9.]"//g` + debug $grv_tmp + get_minversion_from_readme_result=$grv_tmp +} + + +find_min_version() +{ + find_min_version_result= + fmvtmp= + if [ ! $1 ] ; then return; fi + fmvdep=$1 + get_minversion_from_readme $fmvdep + fmvtmp=$get_minversion_from_readme_result + if [ $fmvdep = "git" ]; then fmvtmp=1.5 ; fi + if [ $fmvdep = "curl" ]; then fmvtmp=6 ; fi + if [ $fmvdep = "make" ]; then fmvtmp=3 ; fi + if [ $fmvdep = "python" ]; then fmvtmp=2 ; fi + find_min_version_result=$fmvtmp +} + +vers_to_int() +{ + # change x.y.z.p into x0y0z0p for purposes of comparison with -lt or -gt + # it will work as long as the resulting int is less than 2.147 billion + # and y z and p are less than 99 + # 1.2.3.4 into 1020304 + # 1.11.0.12 into 1110012 + # 2011.2.3 into 20110020300 + # the resulting integer can be simply compared using -lt or -gt + vers_to_int_result= + if [ ! $1 ] ; then return ; fi + vtoi_ver=$1 + vtoi_test=`echo $vtoi_ver | sed s/"[^0-9.]"//g` + debug vers_to_int $* :: vtoi_ver: $vtoi_ver vtoi_test: $vtoi_test + if [ ! "$vtoi_test" = "$vtoi_ver" ]; then + debug failure in version-to-integer conversion. + debug '"'$vtoi_ver'"' has letters, etc in it. setting to 0 + vtoi_ver="0" + fi + vers_to_int_result=`echo $vtoi_ver | awk -F. '{print $1*1000000+$2*10000+$3*100+$4}'` + vtoi_ver= + vtoi_test= +} + + +version_less_than_or_equal() +{ + if [ ! $1 ]; then return; fi + if [ ! $2 ]; then return; fi + v1=$1 + v2=$2 + vers_to_int $v1 + v1int=$vers_to_int_result + vers_to_int $v2 + v2int=$vers_to_int_result + debug "v1, v2, v1int, v2int" , $v1, $v2, $v1int, $v2int + if [ $v1int -le $v2int ]; then + debug "v1 <= v2" + return 0 + else + debug "v1 > v2" + return 1 + fi + v1= + v2= + v1int= + v2int= +} + +compare_version() +{ + debug compare_version $* + compare_version_result="NotOK" + if [ ! $1 ] ; then return; fi + if [ ! $2 ] ; then return; fi + cvminver=$1 + cvinstver=$2 + cvtmp= + version_less_than_or_equal $cvminver $cvinstver + if [ $? = 0 ]; then + cvtmp="OK" + else + cvtmp="NotOK" + fi + compare_version_result=$cvtmp + cvtmp= +} + +pretty_print() +{ + debug pretty_print $* + + brightred="\033[1;31m" + red="\033[0;31m" + brown="\033[0;33m" + yellow="\033[1;33m" + white="\033[1;37m" + purple="\033[1;35m" + green="\033[0;32m" + cyan="\033[0;36m" + gray="\033[0;37m" + nocolor="\033[0m" + + ppstr="%s%-12s" + pp_format='{printf("'$ppstr$ppstr$ppstr$ppstr$nocolor'\n",$1,$2,$3,$4,$5,$6,$7,$8)}' + pp_title="$gray depname $gray minimum $gray system $gray OKness" + if [ $1 ]; then pp_dep=$1; fi + if [ $pp_dep = "title" ]; then + echo -e $pp_title | awk $pp_format + return ; + fi + + if [ $2 ]; then pp_minver=$2; else pp_minver="unknown"; fi + if [ $3 ]; then pp_sysver=$3; else pp_sysver="unknown"; fi + if [ $4 ]; then pp_compared=$4; else pp_compared="NotOK"; fi + + if [ $pp_compared = "NotOK" ]; then + pp_cmpcolor=$purple; + pp_ivcolor=$purple; + else + pp_cmpcolor=$green; + pp_ivcolor=$gray; + fi + echo -e $cyan $pp_dep $gray $pp_minver $pp_ivcolor $pp_sysver $pp_cmpcolor $pp_compared | awk $pp_format + pp_dep= + pp_minver= + pp_sysver= + pp_compared= +} + + + + +find_installed_version() +{ + debug find_installed_version $* + find_installed_version_result=unknown + fsv_tmp= + dep=$1 + + # try to find/parse headers and/or binary output + if [ ! $fsv_tmp ]; then + for syspath in "/opt" "/usr/pkg" "/usr" "/usr/local" $OPENSCAD_LIBRARIES; do + if [ -e $syspath ]; then + debug $dep"_sysver" $syspath + eval $dep"_sysver" $syspath + fsv_tmp=`eval echo "$"$dep"_sysver_result"` + fi + done + fi + + # use pkg-config to search + if [ ! $fsv_tmp ]; then + if [ "`command -v pkg-config`" ]; then + pkg_config_search $dep + fsv_tmp=$pkg_config_search_result + fi + fi + + # use the package system to search + if [ ! $fsv_tmp ]; then + pkg_search $dep + fsv_tmp=$pkg_search_result + fi + + if [ $fsv_tmp ]; then + find_installed_version_result=$fsv_tmp + fi +} + + + + + + +checkargs() +{ + for i in $*; do + if [ $i = "debug" ]; then DEBUG=1 ; fi + done +} + +main() +{ + deps="qt4 cgal gmp cmake mpfr boost opencsg glew eigen gcc" + deps="$deps python bison flex git curl make" + #deps="$deps imagemagick" # needs work, only needed for tests + #deps="eigen glew opencsg" # debug + pretty_print title + for dep in $deps; do + debug "processing $dep" + find_installed_version $dep + dep_sysver=$find_installed_version_result + find_min_version $dep + dep_minver=$find_min_version_result + compare_version $dep_minver $dep_sysver + dep_compare=$compare_version_result + pretty_print $dep $dep_minver $dep_sysver $dep_compare + done +} + +checkargs $* +main +exit 0 + diff --git a/scripts/fedora-build-dependencies.sh b/scripts/fedora-build-dependencies.sh deleted file mode 100755 index 7481a63..0000000 --- a/scripts/fedora-build-dependencies.sh +++ /dev/null @@ -1,29 +0,0 @@ -echo "Tested on Fedora 17. If this fails try 'old linux' build (see README.md)" -sleep 2 - -# Fedora 17 has CGAL 4 -#if [ "`yum list installed | grep -i cgal`" ]; then -# echo "Please make sure you have removed all cgal packages and retry" -# exit -#fi - -if [ "`yum list installed | grep -i opencsg`" ]; then - echo "Please make sure you have removed all opencsg packages and retry" - exit -fi - -sudo yum install qt-devel bison flex eigen2-devel \ - boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git - -#echo "now copy/paste the following to install CGAL and OpenCSG from source:" -#echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" - -echo -echo "Now copy/paste the following to install OpenCSG from source:" -echo -# https://bugzilla.redhat.com/show_bug.cgi?id=144967 -echo "sudo echo /usr/local/lib | sudo tee -a /etc/ld.so.conf.d/local.conf" -echo "sudo ldconfig" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" -echo - diff --git a/scripts/freebsd-build-dependencies.sh b/scripts/freebsd-build-dependencies.sh deleted file mode 100755 index 4ea61de..0000000 --- a/scripts/freebsd-build-dependencies.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/local/bin/bash -e - -echo "Tested on FreeBSD 9. Please see README.md for info on older systems." - -if [ "`pkg_info | grep -i cgal `" ]; then - echo Stopping. Please remove any CGAL packages you have installed and restart - exit -fi - -if [ "`pkg_info | grep -i opencsg`" ]; then - echo Stopping. Please remove any OpenCSG packages you have installed and restart - exit -fi - -OPENSCADDIR=$PWD -if [ ! -f $OPENSCADDIR/openscad.pro ]; then - echo "Must be run from the OpenSCAD source root directory" - exit 0 -fi - -. ./scripts/setenv-freebsdbuild.sh - -pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr -pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew -pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic - -BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs -BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh deleted file mode 100755 index 5e361df..0000000 --- a/scripts/linux-build-dependencies.sh +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/sh -e - -# linux-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 all library dependencies of OpenSCAD for Linux -# -# This script must be run from the OpenSCAD source root directory -# -# Usage: linux-build-dependencies.sh -# -# Prerequisites: -# - wget or curl -# - Qt4 -# - -printUsage() -{ - echo "Usage: $0" - echo -} - -build_git() -{ - version=$1 - echo "Building git" $version "..." - cd $BASEDIR/src - rm -rf git-$version - if [ ! -f git-$version.tar.gz ]; then - curl -O http://git-core.googlecode.com/files/git-$version.tar.gz - fi - tar zxf git-$version.tar.gz - cd git-$version - ./configure --prefix=$DEPLOYDIR - make -j$NUMCPU - make install -} - -build_cmake() -{ - version=$1 - echo "Building cmake" $version "..." - cd $BASEDIR/src - rm -rf cmake-$version - if [ ! -f cmake-$version.tar.gz ]; then - curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz - fi - tar zxf cmake-$version.tar.gz - cd cmake-$version - mkdir build - cd build - ../configure --prefix=$DEPLOYDIR - make -j$NUMCPU - make install -} - -build_curl() -{ - version=$1 - echo "Building curl" $version "..." - cd $BASEDIR/src - rm -rf curl-$version - if [ ! -f curl-$version.tar.bz2 ]; then - wget http://curl.haxx.se/download/curl-$version.tar.bz2 - fi - tar xjf curl-$version.tar.bz2 - cd curl-$version - mkdir build - cd build - ../configure --prefix=$DEPLOYDIR - make -j$NUMCPU - make install -} - -build_gmp() -{ - version=$1 - echo "Building gmp" $version "..." - cd $BASEDIR/src - rm -rf gmp-$version - if [ ! -f gmp-$version.tar.bz2 ]; then - curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 - fi - tar xjf gmp-$version.tar.bz2 - cd gmp-$version - mkdir build - cd build - ../configure --prefix=$DEPLOYDIR --enable-cxx - make install -} - -build_mpfr() -{ - version=$1 - echo "Building mpfr" $version "..." - cd $BASEDIR/src - rm -rf mpfr-$version - if [ ! -f mpfr-$version.tar.bz2 ]; then - curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 - fi - tar xjf mpfr-$version.tar.bz2 - cd mpfr-$version - mkdir build - cd build - ../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR - make install - cd .. -} - -build_boost() -{ - version=$1 - bversion=`echo $version | tr "." "_"` - echo "Building boost" $version "..." - cd $BASEDIR/src - rm -rf boost_$bversion - if [ ! -f boost_$bversion.tar.bz2 ]; then - curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 - fi - tar xjf boost_$bversion.tar.bz2 - cd boost_$bversion - # We only need certain portions of boost - ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex - if [ $CXX ]; then - if [ $CXX = "clang++" ]; then - ./b2 -j$NUMCPU toolset=clang install - # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install - fi - else - ./b2 -j$NUMCPU - ./b2 install - fi -} - -build_cgal() -{ - version=$1 - echo "Building CGAL" $version "..." - cd $BASEDIR/src - rm -rf CGAL-$version - if [ ! -f CGAL-$version.tar.gz ]; then - #4.0.2 - curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 - # 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz - # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz - # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz - # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz - fi - tar jxf CGAL-$version.tar.bz2 - cd CGAL-$version - if [ $2 = use-sys-libs ]; then - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug - else - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug - fi - make -j$NUMCPU - make install -} - -build_glew() -{ - version=$1 - echo "Building GLEW" $version "..." - cd $BASEDIR/src - rm -rf glew-$version - if [ ! -f glew-$version.tgz ]; then - curl -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 - - # Fedora 64-bit - if [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying glew makefile for 64 bit machine" - sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux - fi - fi - - if [ $CC ]; then - if [ $CC = "clang" ]; then - echo "modifying glew makefile for clang" - sed -i s/\$\(CC\)/clang/ Makefile - fi - fi - - GLEW_DEST=$DEPLOYDIR make -j$NUMCPU - GLEW_DEST=$DEPLOYDIR make install -} - -build_opencsg() -{ - version=$1 - echo "Building OpenCSG" $version "..." - cd $BASEDIR/src - rm -rf OpenCSG-$version - if [ ! -f OpenCSG-$version.tar.gz ]; then - curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz - fi - tar xzf OpenCSG-$version.tar.gz - cd OpenCSG-$version - sed -ibak s/example// opencsg.pro # examples might be broken without GLUT - - # Fedora 64-bit - if [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying opencsg makefile for 64 bit machine" - sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile - fi - fi - - if [ `uname | grep FreeBSD` ]; then - sed -ibak s/X11R6/local/g src/Makefile - fi - - if [ "`command -v qmake-qt4`" ]; then - OPENCSG_QMAKE=qmake-qt4 - else - OPENCSG_QMAKE=qmake - fi - - if [ $CXX ]; then - if [ $CXX = "clang++" ]; then - cd $BASEDIR/src/OpenCSG-$version/src - $OPENCSG_QMAKE - cd $BASEDIR/src/OpenCSG-$version - $OPENCSG_QMAKE - fi - else - $OPENCSG_QMAKE - fi - - make - - cp -av lib/* $DEPLOYDIR/lib - cp -av include/* $DEPLOYDIR/include - cd $OPENSCADDIR -} - -build_eigen() -{ - version=$1 - echo "Building eigen" $version "..." - cd $BASEDIR/src - rm -rf eigen-$version - EIGENDIR="none" - if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; 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 -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 .. - make -j$NUMCPU - make install -} - - -OPENSCADDIR=$PWD -if [ ! -f $OPENSCADDIR/openscad.pro ]; then - echo "Must be run from the OpenSCAD source root directory" - exit 0 -fi - -. ./scripts/setenv-linbuild.sh # '.' is equivalent to 'source' -SRCDIR=$BASEDIR/src - -if [ ! $NUMCPU ]; then - echo "Note: The NUMCPU environment variable can be set for paralell builds" - NUMCPU=1 -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 - -if [ ! "`command -v curl`" ]; then - build_curl 7.26.0 -fi - -# NB! For cmake, also update the actual download URL in the function -if [ ! "`command -v cmake`" ]; then - build_cmake 2.8.8 -fi -if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then - build_cmake 2.8.8 -fi - -# build_git 1.7.10.3 - -# Singly build CGAL or OpenCSG -# (Most systems have all libraries available as packages except CGAL/OpenCSG) -# (They can be built singly here by passing a command line arg to the script) -if [ $1 ]; then - if [ $1 = "cgal-use-sys-libs" ]; then - build_cgal 4.0.2 use-sys-libs - exit - fi - if [ $1 = "opencsg" ]; then - build_opencsg 1.3.2 - exit - fi -fi - - -# -# Main build of libraries -# edit version numbers here as needed. -# - -build_eigen 3.1.1 -build_gmp 5.0.5 -build_mpfr 3.1.1 -build_boost 1.47.0 -# NB! For CGAL, also update the actual download URL in the function -build_cgal 4.0.2 -build_glew 1.7.0 -build_opencsg 1.3.2 - -echo "OpenSCAD dependencies built and installed to " $BASEDIR diff --git a/scripts/opensuse-build-dependencies.sh b/scripts/opensuse-build-dependencies.sh deleted file mode 100755 index 623d7d0..0000000 --- a/scripts/opensuse-build-dependencies.sh +++ /dev/null @@ -1,8 +0,0 @@ -echo "tested on OpenSUSE 12. If this fails try 'old linux' build (see README.md)" - -sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ - libqt4-devel glew-devel cmake git - -echo "now copy/paste the following to install CGAL and OpenCSG from source:" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" diff --git a/scripts/setenv-freebsdbuild.sh b/scripts/setenv-freebsdbuild.sh deleted file mode 100644 index 49f1783..0000000 --- a/scripts/setenv-freebsdbuild.sh +++ /dev/null @@ -1,6 +0,0 @@ -# run with '. ./scripts/setenv-freebsdbuild.sh' - -# use in conjuction with freebsd-build-dependencies.sh - -QMAKESPEC=freebsd-g++ -QTDIR=/usr/local/share/qt4 diff --git a/scripts/setenv-linbuild-clang.sh b/scripts/setenv-linbuild-clang.sh deleted file mode 100644 index 9551235..0000000 --- a/scripts/setenv-linbuild-clang.sh +++ /dev/null @@ -1,12 +0,0 @@ -# build dependencies and/or openscad on linux with the clang compiler - -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 - -. ./scripts/setenv-linbuild.sh - diff --git a/scripts/setenv-linbuild.sh b/scripts/setenv-linbuild.sh deleted file mode 100644 index 338cac9..0000000 --- a/scripts/setenv-linbuild.sh +++ /dev/null @@ -1,34 +0,0 @@ -# setup environment variables for building OpenSCAD against custom built -# dependency libraries. called by linux-build-dependencies.sh - -# run this file with 'source setenv-linbuild.sh' every time you re-login -# and want to build or run openscad against custom libraries installed -# into BASEDIR. - -# copy this file to your .bashrc if desired. - -if [ ! $BASEDIR ]; then - BASEDIR=$HOME/openscad_deps -fi -DEPLOYDIR=$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 [ "`command -v qmake-qt4`" ]; then - echo "Please re-run qmake-qt4 and run 'make clean' if necessary" -else - echo "Please re-run qmake and run 'make clean' if necessary" -fi - diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh new file mode 100644 index 0000000..ba99235 --- /dev/null +++ b/scripts/setenv-unibuild.sh @@ -0,0 +1,64 @@ +# setup environment variables for building OpenSCAD against custom built +# dependency libraries. +# +# run with 'source ./scripts/setenv-unibuild.sh' +# +# run it every time you re-login and want to build or run openscad +# against custom libraries installed into BASEDIR. +# +# used in conjuction with uni-build-dependencies.sh + +setenv_common() +{ + if [ ! $BASEDIR ]; then + BASEDIR=$HOME/openscad_deps + fi + DEPLOYDIR=$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 [ "`command -v qmake-qt4`" ]; then + echo "Please re-run qmake-qt4 and run 'make clean' if necessary" + else + echo "Please re-run qmake and run 'make clean' if necessary" + fi +} + +setenv_freebsd() +{ + setenv_common + QMAKESPEC=freebsd-g++ + QTDIR=/usr/local/share/qt4 +} + +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 +} + +if [ "`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 +fi diff --git a/scripts/ubuntu-build-dependencies.sh b/scripts/ubuntu-build-dependencies.sh deleted file mode 100755 index 1754e32..0000000 --- a/scripts/ubuntu-build-dependencies.sh +++ /dev/null @@ -1,33 +0,0 @@ - -too_old() -{ - echo "System version too low. Please try 'old linux' build (see README.md)" - exit -} - -if [ "`cat /etc/issue | grep 'Debian GNU/Linux 6.0'`" ]; then - too_old -fi -if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then - too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 10'`" ]; then - too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 9'`" ]; then - too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 8'`" ]; then - too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 7'`" ]; then - too_old -fi - -echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)" - -sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ - libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ - libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \ - libcgal-dev libopencsg-dev - diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh new file mode 100755 index 0000000..009d41e --- /dev/null +++ b/scripts/uni-build-dependencies.sh @@ -0,0 +1,340 @@ +#!/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 all library dependencies of OpenSCAD for Linux/BSD +# +# This script must be run from the OpenSCAD source root directory +# +# Usage: uni-build-dependencies.sh +# +# Prerequisites: +# - wget or curl +# - Qt4 +# - other +# + +printUsage() +{ + echo "Usage: $0" + echo +} + +build_git() +{ + version=$1 + echo "Building git" $version "..." + cd $BASEDIR/src + rm -rf git-$version + if [ ! -f git-$version.tar.gz ]; then + curl -O http://git-core.googlecode.com/files/git-$version.tar.gz + fi + tar zxf git-$version.tar.gz + cd git-$version + ./configure --prefix=$DEPLOYDIR + make -j$NUMCPU + make install +} + +build_cmake() +{ + version=$1 + echo "Building cmake" $version "..." + cd $BASEDIR/src + rm -rf cmake-$version + if [ ! -f cmake-$version.tar.gz ]; then + curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz + fi + tar zxf cmake-$version.tar.gz + cd cmake-$version + mkdir build + cd build + ../configure --prefix=$DEPLOYDIR + make -j$NUMCPU + make install +} + +build_curl() +{ + version=$1 + echo "Building curl" $version "..." + cd $BASEDIR/src + rm -rf curl-$version + if [ ! -f curl-$version.tar.bz2 ]; then + wget http://curl.haxx.se/download/curl-$version.tar.bz2 + fi + tar xjf curl-$version.tar.bz2 + cd curl-$version + mkdir build + cd build + ../configure --prefix=$DEPLOYDIR + make -j$NUMCPU + make install +} + +build_gmp() +{ + version=$1 + echo "Building gmp" $version "..." + cd $BASEDIR/src + rm -rf gmp-$version + if [ ! -f gmp-$version.tar.bz2 ]; then + curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 + fi + tar xjf gmp-$version.tar.bz2 + cd gmp-$version + mkdir build + cd build + ../configure --prefix=$DEPLOYDIR --enable-cxx + make install +} + +build_mpfr() +{ + version=$1 + echo "Building mpfr" $version "..." + cd $BASEDIR/src + rm -rf mpfr-$version + if [ ! -f mpfr-$version.tar.bz2 ]; then + curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 + fi + tar xjf mpfr-$version.tar.bz2 + cd mpfr-$version + mkdir build + cd build + ../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR + make install + cd .. +} + +build_boost() +{ + version=$1 + bversion=`echo $version | tr "." "_"` + echo "Building boost" $version "..." + cd $BASEDIR/src + rm -rf boost_$bversion + if [ ! -f boost_$bversion.tar.bz2 ]; then + curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 + fi + tar xjf boost_$bversion.tar.bz2 + cd boost_$bversion + # We only need certain portions of boost + ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex + if [ $CXX ]; then + if [ $CXX = "clang++" ]; then + ./b2 -j$NUMCPU toolset=clang install + # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install + fi + else + ./b2 -j$NUMCPU + ./b2 install + fi +} + +build_cgal() +{ + version=$1 + echo "Building CGAL" $version "..." + cd $BASEDIR/src + rm -rf CGAL-$version + if [ ! -f CGAL-$version.tar.gz ]; then + #4.0.2 + curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 + # 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz + # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz + # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz + # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz + fi + tar jxf CGAL-$version.tar.bz2 + cd CGAL-$version + if [ $2 = use-sys-libs ]; then + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug + else + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug + fi + make -j$NUMCPU + make install +} + +build_glew() +{ + version=$1 + echo "Building GLEW" $version "..." + cd $BASEDIR/src + rm -rf glew-$version + if [ ! -f glew-$version.tgz ]; then + curl -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 + + # Fedora 64-bit + if [ -e /usr/lib64 ]; then + if [ "`ls /usr/lib64 | grep Xmu`" ]; then + echo "modifying glew makefile for 64 bit machine" + sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux + fi + fi + + if [ $CC ]; then + if [ $CC = "clang" ]; then + echo "modifying glew makefile for clang" + sed -i s/\$\(CC\)/clang/ Makefile + fi + fi + + GLEW_DEST=$DEPLOYDIR make -j$NUMCPU + GLEW_DEST=$DEPLOYDIR make install +} + +build_opencsg() +{ + version=$1 + echo "Building OpenCSG" $version "..." + cd $BASEDIR/src + rm -rf OpenCSG-$version + if [ ! -f OpenCSG-$version.tar.gz ]; then + curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz + fi + tar xzf OpenCSG-$version.tar.gz + cd OpenCSG-$version + sed -ibak s/example// opencsg.pro # examples might be broken without GLUT + + # Fedora 64-bit + if [ -e /usr/lib64 ]; then + if [ "`ls /usr/lib64 | grep Xmu`" ]; then + echo "modifying opencsg makefile for 64 bit machine" + sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile + fi + fi + + if [ `uname | grep FreeBSD` ]; then + sed -ibak s/X11R6/local/g src/Makefile + fi + + if [ "`command -v qmake-qt4`" ]; then + OPENCSG_QMAKE=qmake-qt4 + else + OPENCSG_QMAKE=qmake + fi + + if [ $CXX ]; then + if [ $CXX = "clang++" ]; then + cd $BASEDIR/src/OpenCSG-$version/src + $OPENCSG_QMAKE + cd $BASEDIR/src/OpenCSG-$version + $OPENCSG_QMAKE + fi + else + $OPENCSG_QMAKE + fi + + make + + cp -av lib/* $DEPLOYDIR/lib + cp -av include/* $DEPLOYDIR/include + cd $OPENSCADDIR +} + +build_eigen() +{ + version=$1 + echo "Building eigen" $version "..." + cd $BASEDIR/src + rm -rf eigen-$version + EIGENDIR="none" + if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; 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 -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 .. + make -j$NUMCPU + make install +} + + +OPENSCADDIR=$PWD +if [ ! -f $OPENSCADDIR/openscad.pro ]; then + echo "Must be run from the OpenSCAD source root directory" + exit 0 +fi + +. ./scripts/setenv-unibuild.sh # '.' is equivalent to 'source' +SRCDIR=$BASEDIR/src + +if [ ! $NUMCPU ]; then + echo "Note: The NUMCPU environment variable can be set for paralell builds" + NUMCPU=1 +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 + +if [ ! "`command -v curl`" ]; then + build_curl 7.26.0 +fi + +# NB! For cmake, also update the actual download URL in the function +if [ ! "`command -v cmake`" ]; then + build_cmake 2.8.8 +fi +if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then + build_cmake 2.8.8 +fi + +# build_git 1.7.10.3 + +# Singly build CGAL or OpenCSG +# (Most systems have all libraries available as packages except CGAL/OpenCSG) +# (They can be built singly here by passing a command line arg to the script) +if [ $1 ]; then + if [ $1 = "cgal-use-sys-libs" ]; then + build_cgal 4.0.2 use-sys-libs + exit + fi + if [ $1 = "opencsg" ]; then + build_opencsg 1.3.2 + exit + fi +fi + + +# +# Main build of libraries +# edit version numbers here as needed. +# + +build_eigen 3.1.1 +build_gmp 5.0.5 +build_mpfr 3.1.1 +build_boost 1.47.0 +# NB! For CGAL, also update the actual download URL in the function +build_cgal 4.0.2 +build_glew 1.7.0 +build_opencsg 1.3.2 + +echo "OpenSCAD dependencies built and installed to " $BASEDIR diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh new file mode 100755 index 0000000..91a87a4 --- /dev/null +++ b/scripts/uni-get-dependencies.sh @@ -0,0 +1,94 @@ + +get_fedora_deps() +{ + echo "Tested on Fedora 17. Please see README.md for info on older systems." + sudo yum install qt-devel bison flex eigen2-devel \ + boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git +} + +get_freebsd_deps() +{ + echo "Tested on FreeBSD 9. Please see README.md for info on older systems." + + if [ "`pkg_info | grep -i cgal `" ]; then + echo Stopping. Please remove any CGAL packages you have installed and restart + exit + fi + + if [ "`pkg_info | grep -i opencsg`" ]; then + echo Stopping. Please remove any OpenCSG packages you have installed and restart + exit + fi + + pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr + pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew + pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic + + #echo "BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" + #echo "BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" +} + + +debian_too_old() +{ + echo "System version too low. Please try 'old linux' build (see README.md)" + exit +} + +get_debian_deps() +{ + if [ "`cat /etc/issue | grep 'Debian GNU/Linux 6.0'`" ]; then + debian_too_old + fi + if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then + debian_too_old + fi + if [ "`cat /etc/issue | grep 'Ubunutu 10'`" ]; then + debian_too_old + fi + if [ "`cat /etc/issue | grep 'Ubunutu 9'`" ]; then + debian_too_old + fi + if [ "`cat /etc/issue | grep 'Ubunutu 8'`" ]; then + debian_too_old + fi + if [ "`cat /etc/issue | grep 'Ubunutu 7'`" ]; then + debian_too_old + fi + echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)" + + sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ + libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ + libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \ + libcgal-dev libopencsg-dev +} + + +get_opensuse_deps() +{ + echo "tested on OpenSUSE 12. If this fails try 'old linux' build (see README.md)" + + sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ + libqt4-devel glew-devel cmake git + + # sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg +} + + + + +if [ "`cat /etc/issue | grep -i ubuntu`" ]; then + get_debian_deps +elif [ "`cat /etc/issue | grep -i debian`" ]; then + get_ubuntu_deps +elif [ "`cat /etc/issue | grep -i opensuse`" ]; then + get_opensuse_deps +elif [ "`cat /etc/issue | grep -i freebsd`" ]; then + get_freebsd_deps +elif [ "`cat /etc/issue | grep -i fedora`" ]; then + get_fedora_deps +else + echo "Unknown system type. Please install the dependency packages listed" + echo "in README.md using your system's package manager." +fi + -- cgit v0.10.1 From a64f93269303b89cd0fdabd5791d04e5e60d2b0a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 8 Dec 2012 09:47:31 +0100 Subject: Render all 2D objects 1mm high in OpenCSG/Throwntogether mode diff --git a/src/polyset.cc b/src/polyset.cc index b412f5f..3b3be34 100644 --- a/src/polyset.cc +++ b/src/polyset.cc @@ -157,7 +157,7 @@ void PolySet::render_surface(csgmode_e csgmode, const Transform3d &m, GLint *sha } #endif /* ENABLE_OPENCSG */ if (this->is2d) { - double zbase = csgmode; + double zbase = 1; // Render 2D objects 1mm thick glBegin(GL_TRIANGLES); for (double z = -zbase/2; z < zbase; z += zbase) { @@ -248,7 +248,7 @@ void PolySet::render_edges(csgmode_e csgmode) const { glDisable(GL_LIGHTING); if (this->is2d) { - double zbase = csgmode; + double zbase = 1; // Render 2D objects 1mm thick for (double z = -zbase/2; z < zbase; z += zbase) { for (size_t i = 0; i < borders.size(); i++) { -- cgit v0.10.1 From c0612a9ed0899c96963e04c848a59b0164a689a2 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 8 Dec 2012 09:53:53 +0100 Subject: Explicitly use UTF-8 as file encoding to avoid Windows automatically falling back to cp1252. Fixes #223 diff --git a/src/mainwin.cc b/src/mainwin.cc index 4b0df70..dc5b79b 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -588,7 +588,9 @@ void MainWindow::refreshDocument() this->fileName.toStdString() % file.errorString().toStdString()); } else { - QString text = QTextStream(&file).readAll(); + QTextStream reader(&file); + reader.setCodec("UTF-8"); + QString text = reader.readAll(); PRINTB("Loaded design '%s'.", this->fileName.toStdString()); editor->setPlainText(text); } @@ -900,7 +902,9 @@ void MainWindow::actionSave() PRINTB("Failed to open file for writing: %s (%s)", this->fileName.toStdString() % file.errorString().toStdString()); } else { - QTextStream(&file) << this->editor->toPlainText(); + QTextStream writer(&file); + writer.setCodec("UTF-8"); + writer << this->editor->toPlainText(); PRINTB("Saved design '%s'.", this->fileName.toStdString()); this->editor->setContentModified(false); } -- cgit v0.10.1 From 4bd97b936e2af49248e8d15f5485e09dd52fa8d5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 11 Dec 2012 21:22:28 +0100 Subject: Bumped eigen to 3.1.2 diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index 1036320..6313b2b 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -284,7 +284,7 @@ build_eigen() EIGENDIR="none" if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi - if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi + if [ $version = "3.1.2" ]; then EIGENDIR=eigen-eigen-5097c01bcdc4; fi if [ $EIGENDIR = "none" ]; then echo Unknown eigen version. Please edit script. exit 1 @@ -365,7 +365,7 @@ fi echo "Using basedir:" $BASEDIR mkdir -p $SRCDIR $DEPLOYDIR -build_eigen 3.1.1 +build_eigen 3.1.2 build_gmp 5.0.5 build_mpfr 3.1.1 build_boost 1.51.0 -- cgit v0.10.1 From 2eb1842d9f3877efd0ab91a1b3eb81de03a94c46 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 19 Dec 2012 18:34:37 -0600 Subject: do not use OSTYPE, its a read-only operating system variable diff --git a/scripts/publish-mingw-x.sh b/scripts/publish-mingw-x.sh index d6cebcd..5622e9f 100755 --- a/scripts/publish-mingw-x.sh +++ b/scripts/publish-mingw-x.sh @@ -31,7 +31,7 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then exit 1 fi -OSTYPE=mingw-cross-env ./scripts/release-common.sh -v $VERSION $COMMIT +./scripts/release-common.sh -v $VERSION $COMMIT mingw32 if [ $? != 0 ]; then echo "release-common.sh returned error code: $?. build stopped." -- cgit v0.10.1 From 29c3699e0a0660a315be6b0e312075cbdf3c2fc0 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 18:03:04 +0100 Subject: clarify README linux compilation diff --git a/README.md b/README.md index d618f85..da0ea1c 100644 --- a/README.md +++ b/README.md @@ -133,27 +133,31 @@ After that, follow the Compilation instructions below. ### Building for Linux/BSD -First, make sure that you have git installed. Then after you've cloned -this git repository, run the script that attempts to download the +First, make sure that you have git installed (git-core in debian). Once you've +cloned this git repository, run the script that attempts to download the dependency packages for your system: ./scripts/uni-get-dependencies.sh -This will get the majority of necessary packages, although your -particular system may require you to manually install some. After installing +If this fails then you have to download and install the dependency packages +on your own using your system's package manager. After installing dependencies, check their versions. You can run this script to help you: ./scripts/check-dependencies.sh -If some of yours are out of date, you can build newer versions automatically -into $HOME/openscad_deps with the following commands: +If all dependencies are present and of a high enough version, skip ahead +to the Compilation instructions. If some are missing or old, then you +can download and build them into $HOME/openscad_deps as follows - source ./scripts/setenv-linbuild.sh - ./scripts/linux-build-dependencies.sh + source ./scripts/setenv-unibuild.sh + ./scripts/uni-build-dependencies.sh + +This may take several hours. After completion, again check dependencies + + source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh -This may take several hours. If successfull, follow the Compilation -instructions below. If not, file an 'issue' on the OpenSCAD github. +Then follow the Compilation instructions below. ### Building for Windows -- cgit v0.10.1 From f5cb2ecb3053180d3096e729cc8b0f774d79b1f3 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 18:55:13 +0100 Subject: enable 'out of tree' call of dependency scripts. fix old ubuntu detection. diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index ba99235..19d37f9 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -11,7 +11,15 @@ setenv_common() { if [ ! $BASEDIR ]; then - BASEDIR=$HOME/openscad_deps + 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 "Not in OpenSCAD dir... using current directory as base of build" + BASEDIR=$PWD + fi fi DEPLOYDIR=$BASEDIR diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 009d41e..e091444 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -7,8 +7,6 @@ # # This script builds all library dependencies of OpenSCAD for Linux/BSD # -# This script must be run from the OpenSCAD source root directory -# # Usage: uni-build-dependencies.sh # # Prerequisites: @@ -238,7 +236,7 @@ build_opencsg() cp -av lib/* $DEPLOYDIR/lib cp -av include/* $DEPLOYDIR/include - cd $OPENSCADDIR + cd $BASEDIR } build_eigen() @@ -270,13 +268,18 @@ build_eigen() } -OPENSCADDIR=$PWD -if [ ! -f $OPENSCADDIR/openscad.pro ]; then - echo "Must be run from the OpenSCAD source root directory" - exit 0 +if [ "`command -v dirname`" ]; then + OPENSCAD_SCRIPTDIR=`dirname $0` +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 fi -. ./scripts/setenv-unibuild.sh # '.' is equivalent to 'source' +. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source' SRCDIR=$BASEDIR/src if [ ! $NUMCPU ]; then @@ -312,7 +315,7 @@ fi # (Most systems have all libraries available as packages except CGAL/OpenCSG) # (They can be built singly here by passing a command line arg to the script) if [ $1 ]; then - if [ $1 = "cgal-use-sys-libs" ]; then + if [ $1 = "cgal" ]; then build_cgal 4.0.2 use-sys-libs exit fi diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 91a87a4..3ed12e6 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -43,16 +43,16 @@ get_debian_deps() if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then debian_too_old fi - if [ "`cat /etc/issue | grep 'Ubunutu 10'`" ]; then + if [ "`cat /etc/issue | grep 'Ubuntu 10'`" ]; then debian_too_old fi - if [ "`cat /etc/issue | grep 'Ubunutu 9'`" ]; then + if [ "`cat /etc/issue | grep 'Ubuntu 9'`" ]; then debian_too_old fi - if [ "`cat /etc/issue | grep 'Ubunutu 8'`" ]; then + if [ "`cat /etc/issue | grep 'Ubuntu 8'`" ]; then debian_too_old fi - if [ "`cat /etc/issue | grep 'Ubunutu 7'`" ]; then + if [ "`cat /etc/issue | grep 'Ubuntu 7'`" ]; then debian_too_old fi echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)" -- cgit v0.10.1 From 67ba3cb3d2f6ef1d9857fc40f8d764e9c0602932 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 18:59:50 +0100 Subject: for out of tree, build under $PWD/openscad_deps not $PWD diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index 19d37f9..5462983 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -18,7 +18,7 @@ setenv_common() # otherwise, assume its being run 'out of tree'. treat it somewhat like # "configure" or "cmake", so you can build dependencies where u wish. echo "Not in OpenSCAD dir... using current directory as base of build" - BASEDIR=$PWD + BASEDIR=$PWD/openscad_deps fi fi DEPLOYDIR=$BASEDIR -- cgit v0.10.1 From bbcc2a070855c0481e6cab74178c5684960bdcd8 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 19:35:44 +0100 Subject: update boost version. allow 'out of tree' dependency check. fix cmake detection diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 536c46f..0401fbb 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -161,7 +161,7 @@ curl_sysver() cmake_sysver() { if [ ! -x $1/bin/cmake ]; then return ; fi - cmake_sysver_result=`$1/bin/cmake --version | grep cmake | sed s/"[^0-9.]"/" "/g` + cmake_sysver_result=`$1/bin/cmake --version | grep cmake | sed s/"[^0-9.]"/" "/g | awk '{ print $1 }'` } make_sysver() @@ -364,6 +364,11 @@ get_minversion_from_readme() { if [ -e README.md ]; then READFILE=README.md; fi if [ -e ../README.md ]; then READFILE=../README.md; fi + if [ ! $READFILE ]; then + if [ "`command -v dirname`" ]; then + READFILE=`dirname $0`/../README.md + fi + fi if [ ! $READFILE ]; then echo "cannot find README.md"; exit; fi debug get_minversion_from_readme $* if [ ! $1 ]; then return; fi diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index e091444..a57d1ba 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -120,6 +120,12 @@ build_boost() fi tar xjf boost_$bversion.tar.bz2 cd boost_$bversion + if [ "`gcc --version|grep 4.7`" ]; then + if [ "`echo $version | grep 1.47`" ]; then + echo gcc 4.7 incompatible with boost 1.47. edit boost version in $0 + exit + fi + fi # We only need certain portions of boost ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex if [ $CXX ]; then @@ -334,7 +340,7 @@ fi build_eigen 3.1.1 build_gmp 5.0.5 build_mpfr 3.1.1 -build_boost 1.47.0 +build_boost 1.49.0 # NB! For CGAL, also update the actual download URL in the function build_cgal 4.0.2 build_glew 1.7.0 -- cgit v0.10.1 From d80b067d53218ecd914a6d19d1d11ac44a9bc300 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 20:52:14 +0100 Subject: convert tabs to spaces. fix some BSD problems diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 0401fbb..feb209e 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -337,7 +337,7 @@ pkg_search() yum_pkg_search $* pkg_search_result=$yum_pkg_search_result else - echo unknown system type. cannot search packages. + debug unknown system type. cannot search packages. fi } diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index a57d1ba..c08b414 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -128,15 +128,15 @@ build_boost() fi # We only need certain portions of boost ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex - if [ $CXX ]; then - if [ $CXX = "clang++" ]; then - ./b2 -j$NUMCPU toolset=clang install - # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install - fi - else - ./b2 -j$NUMCPU - ./b2 install - fi + if [ $CXX ]; then + if [ $CXX = "clang++" ]; then + ./b2 -j$NUMCPU toolset=clang install + # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install + fi + else + ./b2 -j$NUMCPU + ./b2 install + fi } build_cgal() @@ -178,22 +178,32 @@ build_glew() mkdir -p $DEPLOYDIR/lib/pkgconfig # Fedora 64-bit - if [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying glew makefile for 64 bit machine" - sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux - fi - fi - - if [ $CC ]; then - if [ $CC = "clang" ]; then - echo "modifying glew makefile for clang" - sed -i s/\$\(CC\)/clang/ Makefile - fi - fi - - GLEW_DEST=$DEPLOYDIR make -j$NUMCPU - GLEW_DEST=$DEPLOYDIR make install + if [ -e /usr/lib64 ]; then + if [ "`ls /usr/lib64 | grep Xmu`" ]; then + echo "modifying glew makefile for 64 bit machine" + sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux + fi + fi + + if [ $CC ]; then + if [ $CC = "clang" ]; then + echo "modifying glew makefile for clang" + sed -i s/\$\(CC\)/clang/ Makefile + fi + 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() @@ -210,12 +220,12 @@ build_opencsg() sed -ibak s/example// opencsg.pro # examples might be broken without GLUT # Fedora 64-bit - if [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying opencsg makefile for 64 bit machine" - sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile - fi - fi + if [ -e /usr/lib64 ]; then + if [ "`ls /usr/lib64 | grep Xmu`" ]; then + echo "modifying opencsg makefile for 64 bit machine" + sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile + fi + fi if [ `uname | grep FreeBSD` ]; then sed -ibak s/X11R6/local/g src/Makefile @@ -227,16 +237,16 @@ build_opencsg() OPENCSG_QMAKE=qmake fi - if [ $CXX ]; then - if [ $CXX = "clang++" ]; then - cd $BASEDIR/src/OpenCSG-$version/src - $OPENCSG_QMAKE - cd $BASEDIR/src/OpenCSG-$version - $OPENCSG_QMAKE - fi - else - $OPENCSG_QMAKE - fi + if [ $CXX ]; then + if [ $CXX = "clang++" ]; then + cd $BASEDIR/src/OpenCSG-$version/src + $OPENCSG_QMAKE + cd $BASEDIR/src/OpenCSG-$version + $OPENCSG_QMAKE + fi + else + $OPENCSG_QMAKE + fi make @@ -289,8 +299,8 @@ fi SRCDIR=$BASEDIR/src if [ ! $NUMCPU ]; then - echo "Note: The NUMCPU environment variable can be set for paralell builds" - NUMCPU=1 + echo "Note: The NUMCPU environment variable can be set for paralell builds" + NUMCPU=1 fi if [ ! -d $BASEDIR/bin ]; then @@ -304,15 +314,15 @@ echo "Number of CPUs for parallel builds:" $NUMCPU mkdir -p $SRCDIR $DEPLOYDIR if [ ! "`command -v curl`" ]; then - build_curl 7.26.0 + build_curl 7.26.0 fi # NB! For cmake, also update the actual download URL in the function if [ ! "`command -v cmake`" ]; then - build_cmake 2.8.8 + build_cmake 2.8.8 fi if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then - build_cmake 2.8.8 + build_cmake 2.8.8 fi # build_git 1.7.10.3 -- cgit v0.10.1 From 10f16dfe84a429c012650987d81c5ce385fd55be Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 12:46:25 -0800 Subject: skip broken opengl testing under eigen3 diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index c08b414..e71bd57 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -278,7 +278,7 @@ build_eigen() cd eigen-$version mkdir build cd build - cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR .. + cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NO_OPENGL=1 .. make -j$NUMCPU make install } -- cgit v0.10.1 From f95fa0d607e9cac8344fc8e9a9daf60ca7f78b07 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 12:52:05 -0800 Subject: change 'system' to 'found' in header of printed table diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index feb209e..2032412 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -491,7 +491,7 @@ pretty_print() ppstr="%s%-12s" pp_format='{printf("'$ppstr$ppstr$ppstr$ppstr$nocolor'\n",$1,$2,$3,$4,$5,$6,$7,$8)}' - pp_title="$gray depname $gray minimum $gray system $gray OKness" + pp_title="$gray depname $gray minimum $gray found $gray OKness" if [ $1 ]; then pp_dep=$1; fi if [ $pp_dep = "title" ]; then echo -e $pp_title | awk $pp_format -- cgit v0.10.1 From 2a612b549b90ecdedcb7763fa13404b3c76e4114 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 13:01:30 -0800 Subject: improve qt version detection diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 2032412..0c69124 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -104,6 +104,9 @@ gmp_sysver() qt4_sysver() { qt4path=$1/include/qt4/QtCore/qglobal.h + if [ ! -e $qt4path ]; then + qt4path=$1/include/QtCore/qglobal.h + fi if [ ! -e $qt4path ]; then return; fi qt4ver=`grep 'define *QT_VERSION_STR *' $qt4path | awk '{print $3}'` qt4ver=`echo $qt4ver | sed s/'"'//g` -- cgit v0.10.1 From 208be52473f739816e0f53070085af0f69fd3bc4 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 15:14:54 -0600 Subject: improve OpenCSG build to use qmake + work better standalone diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index e71bd57..17f1be2 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -217,41 +217,36 @@ build_opencsg() fi tar xzf OpenCSG-$version.tar.gz cd OpenCSG-$version - sed -ibak s/example// opencsg.pro # examples might be broken without GLUT - # Fedora 64-bit - if [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying opencsg makefile for 64 bit machine" - sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile - fi - fi + # modify the .pro file for qmake, then use qmake to + # manually rebuild the src/Makefile (some systems don't auto-rebuild it) - if [ `uname | grep FreeBSD` ]; then - sed -ibak s/X11R6/local/g src/Makefile - fi + cp opencsg.pro opencsg.pro.bak + cat opencsg.pro.bak | sed s/example// > opencsg.pro if [ "`command -v qmake-qt4`" ]; then OPENCSG_QMAKE=qmake-qt4 + elif [ "`command -v qmake4`" ]; then + OPENCSG_QMAKE=qmake4 else OPENCSG_QMAKE=qmake fi - if [ $CXX ]; then - if [ $CXX = "clang++" ]; then - cd $BASEDIR/src/OpenCSG-$version/src - $OPENCSG_QMAKE - cd $BASEDIR/src/OpenCSG-$version - $OPENCSG_QMAKE - fi - else - $OPENCSG_QMAKE - fi + cd $BASEDIR/src/OpenCSG-$version/src + $OPENCSG_QMAKE + + cd $BASEDIR/src/OpenCSG-$version + $OPENCSG_QMAKE make - cp -av lib/* $DEPLOYDIR/lib - cp -av include/* $DEPLOYDIR/include + ls lib/* include/* + echo "installing to -->" $DEPLOYDIR + mkdir -p $DEPLOYDIR/lib + mkdir -p $DEPLOYDIR/include + install lib/* $DEPLOYDIR/lib + install include/* $DEPLOYDIR/include + cd $BASEDIR } -- cgit v0.10.1 From 76923ebd9afff61d8e5e4889ac23ebf5c430227c Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 15:28:13 -0600 Subject: CGAL<4.0.2 has strange errors with clang. notify user explicitly to upgrade. diff --git a/src/version_check.h b/src/version_check.h index 92b00db..a940f6b 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -66,6 +66,9 @@ a time, to avoid confusion. #warning "." #warning "." #warning "=======================" +#ifdef __clang__ +#error For Clang to work, CGAL must be >= 4.0.2 +#endif #endif // CGAL_VERSION_NR < 10400010000 #endif //ENABLE_CGAL -- cgit v0.10.1 From 799bb20d38f12f964f7ff3eba6575719a4530097 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 16:12:49 -0600 Subject: mention BSD. clarify language slightly diff --git a/README.md b/README.md index da0ea1c..6d2a631 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ 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, there +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. @@ -147,7 +147,7 @@ dependencies, check their versions. You can run this script to help you: If all dependencies are present and of a high enough version, skip ahead to the Compilation instructions. If some are missing or old, then you -can download and build them into $HOME/openscad_deps as follows +can download and build dependencies into $HOME/openscad_deps as follows: source ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh -- cgit v0.10.1 From 238cf8570dc9916f2fe18f73c7e0b1ca48653469 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 00:35:16 +0100 Subject: fixes for netbsd. clarify readme. diff --git a/README.md b/README.md index 6d2a631..c9a7779 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,9 @@ can download and build dependencies into $HOME/openscad_deps as follows: source ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh -This may take several hours. After completion, again check dependencies +This may take an hour or two. Note it will not build huge deps like gcc +or qt, only the main ones (boost, CGAL, opencsg, etc). After completion, +again check dependencies source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 0c69124..b60fae6 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -107,6 +107,10 @@ qt4_sysver() if [ ! -e $qt4path ]; then qt4path=$1/include/QtCore/qglobal.h fi + if [ ! -e $qt4path ]; then + # netbsd + qt4path=$1/qt4/include/QtCore/qglobal.h + fi if [ ! -e $qt4path ]; then return; fi qt4ver=`grep 'define *QT_VERSION_STR *' $qt4path | awk '{print $3}'` qt4ver=`echo $qt4ver | sed s/'"'//g` @@ -169,11 +173,21 @@ cmake_sysver() make_sysver() { + make_sysver_tmp= binmake=$1/bin/make if [ -x $1/bin/gmake ]; then binmake=$1/bin/gmake ;fi if [ ! -x $binmake ]; then return ;fi - make_sysver_result=`$binmake --version 2>&1 | grep -i 'gnu make' | sed s/"[^0-9.]"/" "/g` - if [ ! "`echo $make_sysver_result | grep [0-9]`" ]; then return; fi + make_sysver_tmp=`$binmake --version 2>&1` + + debug finding gnu make: raw make response: $make_sysver_tmp + if [ ! "`echo $make_sysver_tmp | grep -i gnu`" ]; then + return; + fi + + make_sysver_tmp=`$binmake --version 2>&1 | grep -i 'gnu make' | sed s/"[^0-9.]"/" "/g` + if [ "`echo $make_sysver_tmp | grep [0-9]`" ]; then + make_sysver_result=$make_sysver_tmp + fi } bash_sysver() @@ -402,10 +416,13 @@ find_min_version() fmvdep=$1 get_minversion_from_readme $fmvdep fmvtmp=$get_minversion_from_readme_result + + # items not included in README.md if [ $fmvdep = "git" ]; then fmvtmp=1.5 ; fi if [ $fmvdep = "curl" ]; then fmvtmp=6 ; fi if [ $fmvdep = "make" ]; then fmvtmp=3 ; fi if [ $fmvdep = "python" ]; then fmvtmp=2 ; fi + find_min_version_result=$fmvtmp } @@ -574,7 +591,8 @@ checkargs() main() { deps="qt4 cgal gmp cmake mpfr boost opencsg glew eigen gcc" - deps="$deps python bison flex git curl make" + deps="$deps bison flex git curl make" + #deps="$deps python" # needs work, only needed for tests #deps="$deps imagemagick" # needs work, only needed for tests #deps="eigen glew opencsg" # debug pretty_print title diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index 5462983..e7fe614 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -23,6 +23,7 @@ setenv_common() 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 @@ -51,6 +52,20 @@ setenv_freebsd() QTDIR=/usr/local/share/qt4 } +setenv_netbsd() +{ + setenv_common + QMAKESPEC=netbsd-g++ + QTDIR=/usr/pkg/qt4 + PATH=/usr/pkg/qt4/bin:$PATH + LD_LIBRARY_PATH=/usr/pkg/qt4/lib:$LD_LIBRARY_PATH + + export QMAKESPEC + export QTDIR + export PATH + export LD_LIBRARY_PATH +} + setenv_linux_clang() { export CC=clang @@ -69,4 +84,8 @@ if [ "`uname | grep -i 'linux\|debian'`" ]; then fi elif [ "`uname | grep -i freebsd`" ]; then setenv_freebsd +elif [ "`uname | grep -i netbsd`" ]; then + setenv_netbsd +else + echo unknown system. edit $0 fi diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 17f1be2..804eaa5 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -28,7 +28,7 @@ build_git() cd $BASEDIR/src rm -rf git-$version if [ ! -f git-$version.tar.gz ]; then - curl -O http://git-core.googlecode.com/files/git-$version.tar.gz + curl --insecure -O http://git-core.googlecode.com/files/git-$version.tar.gz fi tar zxf git-$version.tar.gz cd git-$version @@ -44,7 +44,7 @@ build_cmake() cd $BASEDIR/src rm -rf cmake-$version if [ ! -f cmake-$version.tar.gz ]; then - curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz + curl --insecure -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz fi tar zxf cmake-$version.tar.gz cd cmake-$version @@ -80,7 +80,7 @@ build_gmp() cd $BASEDIR/src rm -rf gmp-$version if [ ! -f gmp-$version.tar.bz2 ]; then - curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 + curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 fi tar xjf gmp-$version.tar.bz2 cd gmp-$version @@ -97,7 +97,7 @@ build_mpfr() cd $BASEDIR/src rm -rf mpfr-$version if [ ! -f mpfr-$version.tar.bz2 ]; then - curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 + curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 fi tar xjf mpfr-$version.tar.bz2 cd mpfr-$version @@ -116,7 +116,7 @@ build_boost() cd $BASEDIR/src rm -rf boost_$bversion if [ ! -f boost_$bversion.tar.bz2 ]; then - curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 + curl --insecure -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 fi tar xjf boost_$bversion.tar.bz2 cd boost_$bversion @@ -147,11 +147,11 @@ build_cgal() rm -rf CGAL-$version if [ ! -f CGAL-$version.tar.gz ]; then #4.0.2 - curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 - # 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz - # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz - # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz - # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz + curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 + # 4.0 curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz + # 3.9 curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz + # 3.8 curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz + # 3.7 curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz fi tar jxf CGAL-$version.tar.bz2 cd CGAL-$version @@ -171,7 +171,7 @@ build_glew() cd $BASEDIR/src rm -rf glew-$version if [ ! -f glew-$version.tgz ]; then - curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz + curl --insecure -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz fi tar xzf glew-$version.tgz cd glew-$version @@ -213,7 +213,7 @@ build_opencsg() cd $BASEDIR/src rm -rf OpenCSG-$version if [ ! -f OpenCSG-$version.tar.gz ]; then - curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz + curl --insecure -O http://www.opencsg.org/OpenCSG-$version.tar.gz fi tar xzf OpenCSG-$version.tar.gz cd OpenCSG-$version @@ -265,7 +265,7 @@ build_eigen() fi rm -rf ./$EIGENDIR if [ ! -f eigen-$version.tar.bz2 ]; then - curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 + 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 -- cgit v0.10.1 From 89f3b31b6b3d933bf6f53d536837c04c76b74758 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 00:37:59 +0100 Subject: warn user about old local copies of libraries diff --git a/README.md b/README.md index c9a7779..32f151f 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ 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. If some are missing or old, then you can download and build dependencies into $HOME/openscad_deps as follows: -- cgit v0.10.1 From 596fe6271f316f83239d4466eca66182da2948f2 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 00:06:28 +0000 Subject: deal with hurd diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index e7fe614..e734df7 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -87,5 +87,7 @@ elif [ "`uname | grep -i freebsd`" ]; then elif [ "`uname | grep -i netbsd`" ]; then setenv_netbsd else - echo unknown system. edit $0 + # guess + setenv_common + echo unknown system. guessed env variables. see 'setenv-unibuild.sh' fi -- cgit v0.10.1 From ced98a72c061a9b095f72ece253fcc78ebabee08 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 20 Dec 2012 18:24:06 -0600 Subject: fix bug detecting if CGAL was already downloaded. simplify some wording diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index b60fae6..1ac864c 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -1,6 +1,5 @@ -# Determine which versions of dependency libraries and tools are -# available on the system. Compare these versions with the minimum parsed -# from README.md and print results. +# Parse the minimum versions of dependencies from README.md, and compare +# with what is found on the system. Print results. # # usage # check-dependencies.sh # check version of all dependencies @@ -23,7 +22,6 @@ # if /usr/ and /usr/local/ on linux both hit, throw an error # fallback- pkgconfig --exists, then --modversion # fallback2 - pkg manager -# todo - use OPENSCAD_LIBRARIES ??? # - print location found, how found??? # DEBUG= @@ -386,7 +384,7 @@ get_minversion_from_readme() READFILE=`dirname $0`/../README.md fi fi - if [ ! $READFILE ]; then echo "cannot find README.md"; exit; fi + if [ ! $READFILE ]; then echo "cannot find README.md"; exit 1; fi debug get_minversion_from_readme $* if [ ! $1 ]; then return; fi depname=$1 diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 804eaa5..0a16886 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -145,7 +145,7 @@ build_cgal() echo "Building CGAL" $version "..." cd $BASEDIR/src rm -rf CGAL-$version - if [ ! -f CGAL-$version.tar.gz ]; then + if [ ! -f CGAL-$version.tar.* ]; then #4.0.2 curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 # 4.0 curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz -- cgit v0.10.1 From 0de73575287d16be8e5004d19dbdc942cb917537 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 01:54:35 +0100 Subject: clarify README for linux/bsd build, streamline 'get-depdendencies' script diff --git a/README.md b/README.md index 32f151f..1889acd 100644 --- a/README.md +++ b/README.md @@ -133,29 +133,34 @@ After that, follow the Compilation instructions below. ### Building for Linux/BSD -First, make sure that you have git installed (git-core in debian). Once you've -cloned this git repository, run the script that attempts to download the -dependency packages for your system: +First, make sure that you have git installed (git-core in debian). 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: ./scripts/uni-get-dependencies.sh -If this fails then you have to download and install the dependency packages -on your own using your system's package manager. After installing -dependencies, check their versions. You can run this script to help you: +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. If some are missing or old, then you -can download and build dependencies into $HOME/openscad_deps as follows: +to the Compilation instructions. + +### Building for Linux/BSD on systems with older or missing dependencies + +If some of your system dependency libraries are missing or old, then you +can download and build newer versions into $HOME/openscad_deps by +running these commands: source ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh -This may take an hour or two. Note it will not build huge deps like gcc -or qt, only the main ones (boost, CGAL, opencsg, etc). After completion, -again check dependencies +This may take several hours. Note it will not build huge deps like gcc +or qt, only the smaller ones (boost, CGAL, opencsg, etc). After +completion, again check dependencies source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 3ed12e6..8c6fd06 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -1,38 +1,25 @@ get_fedora_deps() { - echo "Tested on Fedora 17. Please see README.md for info on older systems." + echo "Tested on Fedora 17" sudo yum install qt-devel bison flex eigen2-devel \ boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git } get_freebsd_deps() { - echo "Tested on FreeBSD 9. Please see README.md for info on older systems." - - if [ "`pkg_info | grep -i cgal `" ]; then - echo Stopping. Please remove any CGAL packages you have installed and restart - exit - fi - - if [ "`pkg_info | grep -i opencsg`" ]; then - echo Stopping. Please remove any OpenCSG packages you have installed and restart - exit - fi - + echo "Tested on FreeBSD 9" pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic - - #echo "BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" - #echo "BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" + pkg_add -r opencsg cgal } debian_too_old() { - echo "System version too low. Please try 'old linux' build (see README.md)" - exit + echo "System version too low. Please try 'old linux' build (see README.md)" + exit 1 } get_debian_deps() @@ -55,7 +42,8 @@ get_debian_deps() if [ "`cat /etc/issue | grep 'Ubuntu 7'`" ]; then debian_too_old fi - echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)" + + echo "Tested on Ubuntu 12.04" sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ @@ -66,27 +54,23 @@ get_debian_deps() get_opensuse_deps() { - echo "tested on OpenSUSE 12. If this fails try 'old linux' build (see README.md)" - sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ - libqt4-devel glew-devel cmake git - - # sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg + libqt4-devel glew-devel cmake git cgal-devel } - - if [ "`cat /etc/issue | grep -i ubuntu`" ]; then get_debian_deps elif [ "`cat /etc/issue | grep -i debian`" ]; then - get_ubuntu_deps + get_debian_deps elif [ "`cat /etc/issue | grep -i opensuse`" ]; then get_opensuse_deps elif [ "`cat /etc/issue | grep -i freebsd`" ]; then get_freebsd_deps elif [ "`cat /etc/issue | grep -i fedora`" ]; then get_fedora_deps +elif [ "`cat /etc/issue | grep -i redhat`" ]; then + get_fedora_deps else echo "Unknown system type. Please install the dependency packages listed" echo "in README.md using your system's package manager." -- cgit v0.10.1 From 43e1d6150db62e35fd28aacbd805beaa6a903c70 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 02:18:21 +0100 Subject: download and build bison if needed. detect better on BSD diff --git a/bison.pri b/bison.pri index 9840c5a..fcfad6f 100644 --- a/bison.pri +++ b/bison.pri @@ -19,11 +19,19 @@ win32 { unix:freebsd-g++ { # on bsd /usr/bin/bison is outdated, dont use it - QMAKE_YACC = /usr/local/bin/bison + exists(/usr/local/bin/bison) { + QMAKE_YACC = /usr/local/bin/bison + } else { # look in $PATH + QMAKE_YACC = bison + } } unix:netbsd* { - QMAKE_YACC = /usr/pkg/bin/bison + exists(/usr/pkg/bin/bison) { + QMAKE_YACC = /usr/pkg/bin/bison + } else { # look in $PATH + QMAKE_YACC = bison + } } unix:linux* { diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 0a16886..1b15e53 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -21,6 +21,22 @@ printUsage() echo } +build_bison() +{ + version=$1 + echo "Building bison" $version + cd $BASEDIR/src + rm -rf bison-$version + if [ ! -f bison-$version.tar.gz ]; then + curl --insecure -O http://ftp.gnu.org/gnu/bison/bison-$version.tar.gz + fi + tar zxf bison-$version.tar.gz + cd bison-$version + ./configure --prefix=$DEPLOYDIR + make -j$NUMCPU + make install +} + build_git() { version=$1 @@ -312,6 +328,10 @@ if [ ! "`command -v curl`" ]; then build_curl 7.26.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 -- cgit v0.10.1 From aeefc1f6bc3613069cd6b69d6942e7b600596ff5 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 01:30:05 +0000 Subject: dont rebuild dependencies that are already built/installed diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 1b15e53..1e1abe9 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -92,6 +92,10 @@ build_curl() build_gmp() { version=$1 + if [ -e $DEPLOYDIR/include/gmp.h ]; then + echo "gmp already installed. not building" + return + fi echo "Building gmp" $version "..." cd $BASEDIR/src rm -rf gmp-$version @@ -109,6 +113,10 @@ build_gmp() build_mpfr() { version=$1 + if [ -e $DEPLOYDIR/include/mpfr.h ]; then + echo "mpfr already installed. not building" + return + fi echo "Building mpfr" $version "..." cd $BASEDIR/src rm -rf mpfr-$version @@ -126,6 +134,10 @@ build_mpfr() build_boost() { + if [ -e $DEPLOYDIR/include/boost ]; then + echo "boost already installed. not building" + return + fi version=$1 bversion=`echo $version | tr "." "_"` echo "Building boost" $version "..." @@ -157,6 +169,10 @@ build_boost() build_cgal() { + if [ -e $DEPLOYDIR/include/CGAL/version.h ]; then + echo "CGAL already installed. not building" + return + fi version=$1 echo "Building CGAL" $version "..." cd $BASEDIR/src @@ -182,6 +198,10 @@ build_cgal() build_glew() { + if [ -e $DEPLOYDIR/include/GL/glew.h ]; then + echo "glew already installed. not building" + return + fi version=$1 echo "Building GLEW" $version "..." cd $BASEDIR/src @@ -224,6 +244,10 @@ build_glew() build_opencsg() { + if [ -e $DEPLOYDIR/include/opencsg.h ]; then + echo "OpenCSG already installed. not building" + return + fi version=$1 echo "Building OpenCSG" $version "..." cd $BASEDIR/src @@ -269,6 +293,18 @@ build_opencsg() build_eigen() { version=$1 + if [ -e $DEPLOYDIR/include/eigen2 ]; then + if [ `echo $version | grep 2....` ]; then + echo "Eigen2 already installed. not building" + return + fi + fi + 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 @@ -368,7 +404,7 @@ build_mpfr 3.1.1 build_boost 1.49.0 # NB! For CGAL, also update the actual download URL in the function build_cgal 4.0.2 -build_glew 1.7.0 +build_glew 1.9.0 build_opencsg 1.3.2 echo "OpenSCAD dependencies built and installed to " $BASEDIR -- cgit v0.10.1 From b925540b3923089fe02e39573e1bae3ca0057daa Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 01:41:20 +0000 Subject: improve handling of clang for glew build diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 1e1abe9..ce633cf 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -221,13 +221,6 @@ build_glew() fi fi - if [ $CC ]; then - if [ $CC = "clang" ]; then - echo "modifying glew makefile for clang" - sed -i s/\$\(CC\)/clang/ Makefile - fi - fi - MAKER=make if [ "`uname | grep BSD`" ]; then if [ "`command -v gmake`" ]; then @@ -238,8 +231,8 @@ build_glew() fi fi - GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU - GLEW_DEST=$DEPLOYDIR $MAKER install + GLEW_DEST=$DEPLOYDIR CC=$CC $MAKER -j$NUMCPU + GLEW_DEST=$DEPLOYDIR CC=$CC $MAKER install } build_opencsg() -- cgit v0.10.1 From 8b0ced0f936f7f19732c187f37f6050d8c08c7e8 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 02:16:22 +0000 Subject: glew fixes for clang and for hurd diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index ce633cf..6b7d0d1 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -213,14 +213,28 @@ build_glew() cd glew-$version mkdir -p $DEPLOYDIR/lib/pkgconfig + # Glew makefiles are 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 [ -e /usr/lib64 ]; then - if [ "`ls /usr/lib64 | grep Xmu`" ]; then - echo "modifying glew makefile for 64 bit machine" + 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 @@ -231,8 +245,8 @@ build_glew() fi fi - GLEW_DEST=$DEPLOYDIR CC=$CC $MAKER -j$NUMCPU - GLEW_DEST=$DEPLOYDIR CC=$CC $MAKER install + GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU + GLEW_DEST=$DEPLOYDIR $MAKER install } build_opencsg() -- cgit v0.10.1 From 1a399e7a3001ce3ae6b4e14d6fe3faad48ddfeee Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 03:24:43 +0100 Subject: document 'out of tree' dependency build. fix opencsg on netbsd diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 6b7d0d1..c39d383 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -6,13 +6,23 @@ # # This script builds all library dependencies of OpenSCAD for Linux/BSD +# (Except large ones like qt and gcc) # -# Usage: uni-build-dependencies.sh +# Standard 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 # - Qt4 -# - other +# - gcc (clang=experimental) # printUsage() @@ -287,11 +297,12 @@ build_opencsg() make - ls lib/* include/* + ls lib/* lib/.libs/* include/* echo "installing to -->" $DEPLOYDIR mkdir -p $DEPLOYDIR/lib mkdir -p $DEPLOYDIR/include install lib/* $DEPLOYDIR/lib + install lib/.libs/* $DEPLOYDIR/lib # netbsd install include/* $DEPLOYDIR/include cd $BASEDIR -- cgit v0.10.1 From b43cee7f418c4cc202346843a3bd94d8f56bcffd Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 07:36:36 -0600 Subject: opensuse - get bison/flex diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 8c6fd06..d170ed5 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -15,6 +15,11 @@ get_freebsd_deps() pkg_add -r opencsg cgal } +get_opensuse_deps() +{ + sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ + libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel +} debian_too_old() { @@ -52,13 +57,6 @@ get_debian_deps() } -get_opensuse_deps() -{ - sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ - libqt4-devel glew-devel cmake git cgal-devel -} - - if [ "`cat /etc/issue | grep -i ubuntu`" ]; then get_debian_deps elif [ "`cat /etc/issue | grep -i debian`" ]; then -- cgit v0.10.1 From d8ecb145ac85fea67f55732ffc3018247bc33aae Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 08:30:27 -0600 Subject: deal with black-on-white terminals. opencsg:dont copy lib/.libs if not there. diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 1ac864c..f1a16b8 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -496,15 +496,15 @@ pretty_print() { debug pretty_print $* - brightred="\033[1;31m" - red="\033[0;31m" - brown="\033[0;33m" - yellow="\033[1;33m" - white="\033[1;37m" - purple="\033[1;35m" - green="\033[0;32m" - cyan="\033[0;36m" - gray="\033[0;37m" + brightred="\033[40;31m" + red="\033[40;31m" + brown="\033[40;33m" + yellow="\033[40;33m" + white="\033[40;37m" + purple="\033[40;35m" + green="\033[40;32m" + cyan="\033[40;36m" + gray="\033[40;37m" nocolor="\033[0m" ppstr="%s%-12s" @@ -517,20 +517,20 @@ pretty_print() fi if [ $2 ]; then pp_minver=$2; else pp_minver="unknown"; fi - if [ $3 ]; then pp_sysver=$3; else pp_sysver="unknown"; fi + if [ $3 ]; then pp_foundver=$3; else pp_foundver="unknown"; fi if [ $4 ]; then pp_compared=$4; else pp_compared="NotOK"; fi if [ $pp_compared = "NotOK" ]; then + pp_foundcolor=$purple; pp_cmpcolor=$purple; - pp_ivcolor=$purple; else + pp_foundcolor=$gray; pp_cmpcolor=$green; - pp_ivcolor=$gray; fi - echo -e $cyan $pp_dep $gray $pp_minver $pp_ivcolor $pp_sysver $pp_cmpcolor $pp_compared | awk $pp_format + echo -e $cyan $pp_dep $gray $pp_minver $pp_foundcolor $pp_foundver $pp_cmpcolor $pp_compared | awk $pp_format pp_dep= pp_minver= - pp_sysver= + pp_foundver= pp_compared= } diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index c39d383..f7bedb6 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -297,13 +297,14 @@ build_opencsg() make - ls lib/* lib/.libs/* include/* + 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 lib/.libs/* $DEPLOYDIR/lib # netbsd install include/* $DEPLOYDIR/include + if [ -e lib/.libs ]; then install lib/.libs/* $DEPLOYDIR/lib; fi #netbsd cd $BASEDIR } -- cgit v0.10.1 From a75743f2a3e5636f1a08f47de7e106c344776cb9 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 08:40:57 -0600 Subject: update README to show how to build only opencsg/cgal dependencies diff --git a/README.md b/README.md index 1889acd..91717b6 100644 --- a/README.md +++ b/README.md @@ -158,9 +158,17 @@ running these commands: source ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh -This may take several hours. Note it will not build huge deps like gcc -or qt, only the smaller ones (boost, CGAL, opencsg, etc). After -completion, again check dependencies +This may take an hour or more, depending on your network and system. As +a special timesaver if you are only missing CGAL and OpenCSG, you can do +this instead: + + source ./scripts/setenv-unibuild.sh + ./scripts/uni-build-dependencies.sh opencsg + ./scripts/uni-build-dependencies.sh cgal + +Note that huge dependencies like gcc or qt are not included here, only +the smaller ones (boost, CGAL, opencsg, etc). After the build, again +check dependencies source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh -- cgit v0.10.1 From ef72f6fa7d3e55e11d6b7efdcee339a9cb12d5a8 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 09:31:01 -0600 Subject: fix slight bug in cgal build diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index f7bedb6..a7c62d2 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e + #!/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 @@ -197,7 +197,7 @@ build_cgal() fi tar jxf CGAL-$version.tar.bz2 cd CGAL-$version - if [ $2 = use-sys-libs ]; then + if [ "`echo $2 | grep use-sys-libs`" ]; then cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug else cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug -- cgit v0.10.1 From bb317292c005679415f735e571fed17546bbf2d0 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 10:21:24 -0600 Subject: revise ubuntu / debian detection, dont try to detect version. check libgmp3-dev diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index f1a16b8..5e337c1 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -593,6 +593,7 @@ main() #deps="$deps python" # needs work, only needed for tests #deps="$deps imagemagick" # needs work, only needed for tests #deps="eigen glew opencsg" # debug + deps=glew pretty_print title for dep in $deps; do debug "processing $dep" diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index d170ed5..09c8181 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -21,39 +21,20 @@ get_opensuse_deps() libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel } -debian_too_old() -{ - echo "System version too low. Please try 'old linux' build (see README.md)" - exit 1 -} - get_debian_deps() { - if [ "`cat /etc/issue | grep 'Debian GNU/Linux 6.0'`" ]; then - debian_too_old - fi - if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then - debian_too_old - fi - if [ "`cat /etc/issue | grep 'Ubuntu 10'`" ]; then - debian_too_old - fi - if [ "`cat /etc/issue | grep 'Ubuntu 9'`" ]; then - debian_too_old - fi - if [ "`cat /etc/issue | grep 'Ubuntu 8'`" ]; then - debian_too_old - fi - if [ "`cat /etc/issue | grep 'Ubuntu 7'`" ]; then - debian_too_old - fi - echo "Tested on Ubuntu 12.04" sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ - libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \ + libXi-dev libmpfr-dev libboost-dev libglew1.6-dev \ libcgal-dev libopencsg-dev + + if [ "`apt-cache search libgmp | grep libgmp3-dev`" ]; then + sudo apt-get install libgmp3-dev + else + sudo apt-get install libgmp-dev + fi } -- cgit v0.10.1 From b1ecf351347d83830a546d3d6c49eafc6781634b Mon Sep 17 00:00:00 2001 From: Don Bright Date: Fri, 21 Dec 2012 10:41:06 -0600 Subject: remove debug line diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 5e337c1..f1a16b8 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -593,7 +593,6 @@ main() #deps="$deps python" # needs work, only needed for tests #deps="$deps imagemagick" # needs work, only needed for tests #deps="eigen glew opencsg" # debug - deps=glew pretty_print title for dep in $deps; do debug "processing $dep" -- cgit v0.10.1 From 870f3dcd2d20362995308cd2829c8d7ba61cf623 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 14:59:35 -0500 Subject: deal with situation where gcc doesnt exist. add mageia urpmi commands. shorten os detect code diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index f1a16b8..4254ee9 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -144,7 +144,12 @@ bison_sysver() gcc_sysver() { bingcc=$1/bin/gcc - if [ ! -x $1/bin/gcc ]; then bingcc=gcc; fi + if [ ! -x $1/bin/gcc ]; then + if [ "`command -v gcc`" ]; then # fallback to $PATH + bingcc=gcc; + fi + fi + if [ ! -x $bingcc ]; then return; fi if [ ! "`$bingcc --version`" ]; then return; fi gccver=`$bingcc --version| grep -i gcc` gccver=`echo $gccver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 09c8181..03aecfb 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -1,3 +1,5 @@ +# auto-install dependency packages using the systems package manager. +# after running this, run ./script/check-dependencies.sh. see README.md get_fedora_deps() { @@ -21,6 +23,18 @@ get_opensuse_deps() libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel } +get_mageia_deps() +{ + pklist="task-c-devel task-c++-devel" + pklist="$pklist libqt4-devel libgmp-devel libmpfr-devel" + pklist="$pklist libboost-devel eigen3-devel" + pklist="$pklist bison flex" + pklist="$pklist cmake imagemagick python curl git" + # cgal + opencsg don't exist + sudo urpmi ctags + sudo urpmi $pklist +} + get_debian_deps() { echo "Tested on Ubuntu 12.04" @@ -38,18 +52,20 @@ get_debian_deps() } -if [ "`cat /etc/issue | grep -i ubuntu`" ]; then +if [ "`grep -i ubuntu /etc/issue`" ]; then get_debian_deps -elif [ "`cat /etc/issue | grep -i debian`" ]; then +elif [ "`grep -i debian /etc/issue`" ]; then get_debian_deps -elif [ "`cat /etc/issue | grep -i opensuse`" ]; then +elif [ "`grep -i suse /etc/issue`" ]; then get_opensuse_deps -elif [ "`cat /etc/issue | grep -i freebsd`" ]; then +elif [ "`grep -i freebsd /etc/issue`" ]; then get_freebsd_deps -elif [ "`cat /etc/issue | grep -i fedora`" ]; then +elif [ "`grep -i fedora /etc/issue`" ]; then get_fedora_deps -elif [ "`cat /etc/issue | grep -i redhat`" ]; then +elif [ "`grep -i redhat /etc/issue`" ]; then get_fedora_deps +elif [ "`grep -i mageia /etc/issue`" ]; then + get_mageia_deps else echo "Unknown system type. Please install the dependency packages listed" echo "in README.md using your system's package manager." -- cgit v0.10.1 From e3ea506d06ae012cac3a724bcc97b3f1ba8187b8 Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 16:54:43 -0500 Subject: add libglew-dev to mageia diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 03aecfb..d2e9a51 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -27,7 +27,7 @@ get_mageia_deps() { pklist="task-c-devel task-c++-devel" pklist="$pklist libqt4-devel libgmp-devel libmpfr-devel" - pklist="$pklist libboost-devel eigen3-devel" + pklist="$pklist libboost-devel eigen3-devel libglew-devel" pklist="$pklist bison flex" pklist="$pklist cmake imagemagick python curl git" # cgal + opencsg don't exist -- cgit v0.10.1 From cdc408319e9474e9a4ffbfc080ced23c5ad4f23e Mon Sep 17 00:00:00 2001 From: don bright Date: Fri, 21 Dec 2012 23:44:45 +0100 Subject: NetBSD deps. also detect stray copies of libraries under /usr/local on linux diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 4254ee9..29ed100 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -580,7 +580,27 @@ find_installed_version() } - +check_old_local() +{ + warnon= + if [ "`uname | grep -i linux`" ]; then + header_list="opencsg.h CGAL boost GL/glew.h" + liblist="libboost libopencsg libCGAL libglew" + for i in $header_list $liblist; do + if [ -e /usr/local/include/$i ]; then + echo "Warning: you have a copy of " $i " under /usr/local/include" + warnon=1 + fi + if [ -e /usr/local/lib/$i ]; then + echo "Warning: you have a copy of " $i " under /usr/local/lib" + warnon=1 + fi + done + fi + if [ $warnon ]; then + echo "Please verify your local copies don't conflict with the system" + fi +} @@ -609,6 +629,7 @@ main() dep_compare=$compare_version_result pretty_print $dep $dep_minver $dep_sysver $dep_compare done + check_old_local } checkargs $* diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index d2e9a51..19320c3 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -11,14 +11,22 @@ get_fedora_deps() get_freebsd_deps() { echo "Tested on FreeBSD 9" - pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr - pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew - pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic - pkg_add -r opencsg cgal + pkg_add -r bison boost-libs cmake git bash eigen2 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 +} + +get_netbsd_deps() +{ + echo tested on netbsd 6 + sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ + qt4 glew cgal opencsg modular-xorg } get_opensuse_deps() { + echo tested on opensuse 12 sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel } @@ -52,22 +60,27 @@ get_debian_deps() } -if [ "`grep -i ubuntu /etc/issue`" ]; then - get_debian_deps -elif [ "`grep -i debian /etc/issue`" ]; then - get_debian_deps -elif [ "`grep -i suse /etc/issue`" ]; then - get_opensuse_deps -elif [ "`grep -i freebsd /etc/issue`" ]; then + +if [ -e /etc/issue ]; then + if [ "`grep -i ubuntu /etc/issue`" ]; then + get_debian_deps + elif [ "`grep -i debian /etc/issue`" ]; then + get_debian_deps + elif [ "`grep -i suse /etc/issue`" ]; then + get_opensuse_deps + elif [ "`grep -i fedora /etc/issue`" ]; then + get_fedora_deps + elif [ "`grep -i redhat /etc/issue`" ]; then + get_fedora_deps + elif [ "`grep -i mageia /etc/issue`" ]; then + get_mageia_deps + fi +elif [ "`uname | grep -i freebsd `" ]; then get_freebsd_deps -elif [ "`grep -i fedora /etc/issue`" ]; then - get_fedora_deps -elif [ "`grep -i redhat /etc/issue`" ]; then - get_fedora_deps -elif [ "`grep -i mageia /etc/issue`" ]; then - get_mageia_deps +elif [ "`uname | grep -i netbsd`" ]; then + get_netbsd_deps else - echo "Unknown system type. Please install the dependency packages listed" - echo "in README.md using your system's package manager." + echo "Unknown system type. Please install the dependency packages listed" + echo "in README.md using your system's package manager." fi -- cgit v0.10.1 From fac239c0a2de02414d4fe7a96305d0ae47557c67 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 22 Dec 2012 00:01:19 +0100 Subject: stop apt-get from failing on unfound package names diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 19320c3..1832881 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -45,18 +45,12 @@ get_mageia_deps() get_debian_deps() { - echo "Tested on Ubuntu 12.04" - - sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ - libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ - libXi-dev libmpfr-dev libboost-dev libglew1.6-dev \ - libcgal-dev libopencsg-dev - - if [ "`apt-cache search libgmp | grep libgmp3-dev`" ]; then - sudo apt-get install libgmp3-dev - else - sudo apt-get install libgmp-dev - fi + for pkg in build-essential libqt4-dev libqt4-opengl-dev \ + libxmu-dev cmake bison flex git-core libboost-all-dev \ + libXi-dev libmpfr-dev libboost-dev libglew-dev libeigen2-dev \ + libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev; do + sudo apt-get -y install $pkg; + done } -- cgit v0.10.1 From 0f72b116c5ae5602f708fbd16a815bde995dd9d5 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 22 Dec 2012 00:23:33 +0100 Subject: deal with unknown system type better. remove 'tested on' messages diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 29ed100..e1afba5 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -18,7 +18,6 @@ # funcname_abbreviated_tmp. Local vars are not used for portability. # # todo -# look in /usr/local/ on linux # if /usr/ and /usr/local/ on linux both hit, throw an error # fallback- pkgconfig --exists, then --modversion # fallback2 - pkg manager @@ -588,17 +587,17 @@ check_old_local() liblist="libboost libopencsg libCGAL libglew" for i in $header_list $liblist; do if [ -e /usr/local/include/$i ]; then - echo "Warning: you have a copy of " $i " under /usr/local/include" + echo "Warning: you have a copy of "$i" under /usr/local/include" warnon=1 fi if [ -e /usr/local/lib/$i ]; then - echo "Warning: you have a copy of " $i " under /usr/local/lib" + echo "Warning: you have a copy of "$i" under /usr/local/lib" warnon=1 fi done fi if [ $warnon ]; then - echo "Please verify your local copies don't conflict with the system" + echo "Please verify these local copies don't conflict with the system" fi } diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 1832881..cb03563 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -1,16 +1,17 @@ # auto-install dependency packages using the systems package manager. # after running this, run ./script/check-dependencies.sh. see README.md +# +# this assumes you have sudo installed or are running as root. +# get_fedora_deps() { - echo "Tested on Fedora 17" sudo yum install qt-devel bison flex eigen2-devel \ boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git } get_freebsd_deps() { - echo "Tested on FreeBSD 9" pkg_add -r bison boost-libs cmake git bash eigen2 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 \ @@ -19,14 +20,12 @@ get_freebsd_deps() get_netbsd_deps() { - echo tested on netbsd 6 sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ qt4 glew cgal opencsg modular-xorg } get_opensuse_deps() { - echo tested on opensuse 12 sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel } @@ -54,6 +53,11 @@ get_debian_deps() } +unknown() +{ + echo "Unknown system type. Please install the dependency packages listed" + echo "in README.md using your system's package manager." +} if [ -e /etc/issue ]; then if [ "`grep -i ubuntu /etc/issue`" ]; then @@ -64,17 +68,18 @@ if [ -e /etc/issue ]; then get_opensuse_deps elif [ "`grep -i fedora /etc/issue`" ]; then get_fedora_deps - elif [ "`grep -i redhat /etc/issue`" ]; then + elif [ "`grep -i red.hat /etc/issue`" ]; then get_fedora_deps elif [ "`grep -i mageia /etc/issue`" ]; then get_mageia_deps + else + unknown fi elif [ "`uname | grep -i freebsd `" ]; then get_freebsd_deps elif [ "`uname | grep -i netbsd`" ]; then get_netbsd_deps else - echo "Unknown system type. Please install the dependency packages listed" - echo "in README.md using your system's package manager." + unknown fi -- cgit v0.10.1 From f3cd856282e45eeb3facfa4c52c99be13b5477ad Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 01:00:48 +0100 Subject: netbsd fixes diff --git a/README.md b/README.md index 91717b6..a40f63b 100644 --- a/README.md +++ b/README.md @@ -133,10 +133,11 @@ After that, follow the Compilation instructions below. ### Building for Linux/BSD -First, make sure that you have git installed (git-core in debian). 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: +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: ./scripts/uni-get-dependencies.sh diff --git a/eigen.pri b/eigen.pri index b7fe366..5dd3279 100644 --- a/eigen.pri +++ b/eigen.pri @@ -69,4 +69,8 @@ isEmpty(EIGEN_INCLUDEPATH) { # EIGEN being under 'include/eigen[2-3]' needs special prepending QMAKE_INCDIR_QT = $$EIGEN_INCLUDEPATH $$QMAKE_INCDIR_QT +netbsd* { + QMAKE_CXXFLAGS = -I$$EIGEN_INCLUDEPATH $$QMAKE_CXXFLAGS +} + } # eigen diff --git a/openscad.pro b/openscad.pro index 91bd735..49b764f 100644 --- a/openscad.pro +++ b/openscad.pro @@ -90,11 +90,14 @@ unix:!macx { } netbsd* { - LIBS += -L/usr/X11R7/lib + QMAKE_LFLAGS += -L/usr/X11R7/lib QMAKE_LFLAGS += -Wl,-R/usr/X11R7/lib QMAKE_LFLAGS += -Wl,-R/usr/pkg/lib !isEmpty(OPENSCAD_LIBDIR) { - QMAKE_LFLAGS += -Wl,-R$$OPENSCAD_LIBDIR/lib + QMAKE_CFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CFLAGS + QMAKE_CXXFLAGS = -I$$OPENSCAD_LIBDIR/include $$QMAKE_CXXFLAGS + QMAKE_LFLAGS = -L$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS + QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS } } diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index e734df7..456c7cd 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -58,7 +58,7 @@ setenv_netbsd() 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/pkg/qt4/lib:/usr/X11R7/lib:$LD_LIBRARY_PATH export QMAKESPEC export QTDIR diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index cb03563..c530be9 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -20,6 +20,8 @@ get_freebsd_deps() get_netbsd_deps() { + echo Netbsd: You must install the X sets before running.. + sleep 2 sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ qt4 glew cgal opencsg modular-xorg } -- cgit v0.10.1 From e52787b07d6da878791e828f396c9857ffbbce77 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 16:52:16 +0100 Subject: make glew min 1.5.4 (its OK). fix glew + gcc detection. more debugging info. diff --git a/README.md b/README.md index a40f63b..dd7c4f8 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Follow the instructions for the platform you're compiling on below. * [MPFR (3.x)](http://www.mpfr.org/) * [boost (1.35 - 1.47)](http://www.boost.org/) * [OpenCSG (1.3.2)](http://www.opencsg.org/) -* [GLEW (1.6 ->)](http://glew.sourceforge.net/) +* [GLEW (1.5.4 ->)](http://glew.sourceforge.net/) * [Eigen (2.0.13->3.1.1)](http://eigen.tuxfamily.org/) * [GCC C++ Compiler (4.2 ->)](http://gcc.gnu.org/) * [Bison (2.4)](http://www.gnu.org/software/bison/) diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index e1afba5..bbf1baf 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -116,7 +116,23 @@ qt4_sysver() glew_sysver() { - glew_sysver_result= # glew has no traditional version numbers + glewh=$1/include/GL/glew.h + if [ -e $glewh ]; then + # glew has no traditional version number in it's headers + # so we either test for what we need and 'guess', or assign it to 0.0 + # the resulting number is a 'lower bound', not exactly what is installed + if [ "`grep __GLEW_VERSION_4_2 $glewh`" ]; then + glew_sysver_result=1.7.0 + fi + if [ ! $glew_sysver_result ]; then + if [ "`grep __GLEW_ARB_occlusion_query2 $glewh`" ]; then + glew_sysver_result=1.5.4 + fi + fi + if [ ! $glew_sysver_result ]; then + glew_sysver_result=0.0 + fi + fi } imagemagick_sysver() @@ -148,9 +164,13 @@ gcc_sysver() bingcc=gcc; fi fi + debug using bingcc: $bingcc if [ ! -x $bingcc ]; then return; fi if [ ! "`$bingcc --version`" ]; then return; fi gccver=`$bingcc --version| grep -i gcc` + debug gcc output1: $gccver + gccver=`echo $gccver | sed s/"(.*)"//g ` + debug gcc output2: $gccver gccver=`echo $gccver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` gcc_sysver_result=$gccver } @@ -562,6 +582,7 @@ find_installed_version() # use pkg-config to search if [ ! $fsv_tmp ]; then if [ "`command -v pkg-config`" ]; then + debug plain search failed. trying pkg_config... pkg_config_search $dep fsv_tmp=$pkg_config_search_result fi @@ -569,12 +590,15 @@ find_installed_version() # use the package system to search if [ ! $fsv_tmp ]; then + debug plain + pkg_config search both failed... trying package search pkg_search $dep fsv_tmp=$pkg_search_result fi if [ $fsv_tmp ]; then find_installed_version_result=$fsv_tmp + else + debug all searches failed. unknown version. fi } -- cgit v0.10.1 From f1e22352800a199e9353e4a79baf660c02854f51 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 16:54:57 +0100 Subject: dont test for git, curl. they arent strictly needed for build diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index bbf1baf..8b2f550 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -637,10 +637,11 @@ checkargs() main() { deps="qt4 cgal gmp cmake mpfr boost opencsg glew eigen gcc" - deps="$deps bison flex git curl make" - #deps="$deps python" # needs work, only needed for tests + deps="$deps bison flex make" + #deps=$deps curl git # not technically necessary for build + #deps="$deps python" # only needed for tests #deps="$deps imagemagick" # needs work, only needed for tests - #deps="eigen glew opencsg" # debug + #deps="eigen glew opencsg" # debugging pretty_print title for dep in $deps; do debug "processing $dep" -- cgit v0.10.1 From 91cec829ee781e079feec5aee456b618f9667100 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 15:12:27 -0600 Subject: fixes for Alt Linux diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 8b2f550..dea2e27 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -158,20 +158,17 @@ bison_sysver() gcc_sysver() { - bingcc=$1/bin/gcc - if [ ! -x $1/bin/gcc ]; then - if [ "`command -v gcc`" ]; then # fallback to $PATH - bingcc=gcc; + bingcc=$1/bin/g++ + if [ ! -x $1/bin/g++ ]; then + if [ "`command -v g++`" ]; then # fallback to $PATH + bingcc=g++; fi fi debug using bingcc: $bingcc if [ ! -x $bingcc ]; then return; fi if [ ! "`$bingcc --version`" ]; then return; fi - gccver=`$bingcc --version| grep -i gcc` - debug gcc output1: $gccver - gccver=`echo $gccver | sed s/"(.*)"//g ` - debug gcc output2: $gccver - gccver=`echo $gccver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` + gccver=`$bingcc --version| grep -i g++ | awk ' { print $3 } '` + debug g++ output1: $gccver gcc_sysver_result=$gccver } @@ -252,6 +249,13 @@ set_default_package_map() apt_pkg_search() { + + if [ ! "`command -v dpkg`" ]; then + # can't handle systems that use apt-get for RPMs (alt linux) + debug command dpkg not found. cannot search packages. + return + fi + debug apt_pkg_search $* apt_pkg_search_result= pkgname=$1 @@ -279,10 +283,6 @@ apt_pkg_search() fi debug $pkgname ".deb name:" $debpkgname - if [ ! "`command -v dpkg`" ]; then - debug command dpkg not found. cannot search packages. - return - fi # examples of apt version strings # cgal 4.0-4 gmp 2:5.0.5+dfsg bison 1:2.5.dfsg-2.1 cmake 2.8.9~rc1 @@ -636,10 +636,10 @@ checkargs() main() { - deps="qt4 cgal gmp cmake mpfr boost opencsg glew eigen gcc" + deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc" deps="$deps bison flex make" - #deps=$deps curl git # not technically necessary for build - #deps="$deps python" # only needed for tests + #deps="$deps curl git" # not technically necessary for build + #deps="$deps python cmake" # only needed for tests #deps="$deps imagemagick" # needs work, only needed for tests #deps="eigen glew opencsg" # debugging pretty_print title diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index c530be9..58bebe6 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -10,6 +10,13 @@ get_fedora_deps() boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git } +get_altlinux_deps() +{ + for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ \ + eigen2 libmpfr libgmp libgmp_cxx qt4-devel libcgal-devel git-core \ + libglew-devel flex bison; do sudo apt-get install $i; done +} + get_freebsd_deps() { pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr \ @@ -20,8 +27,6 @@ get_freebsd_deps() get_netbsd_deps() { - echo Netbsd: You must install the X sets before running.. - sleep 2 sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ qt4 glew cgal opencsg modular-xorg } @@ -34,14 +39,10 @@ get_opensuse_deps() get_mageia_deps() { - pklist="task-c-devel task-c++-devel" - pklist="$pklist libqt4-devel libgmp-devel libmpfr-devel" - pklist="$pklist libboost-devel eigen3-devel libglew-devel" - pklist="$pklist bison flex" - pklist="$pklist cmake imagemagick python curl git" - # cgal + opencsg don't exist sudo urpmi ctags - sudo urpmi $pklist + sudo urpmi task-c-devel task-c++-devel libqt4-devel libgmp-devel \ + libmpfr-devel libboost-devel eigen3-devel libglew-devel bison flex \ + cmake imagemagick python curl git } get_debian_deps() @@ -74,8 +75,10 @@ if [ -e /etc/issue ]; then get_fedora_deps elif [ "`grep -i mageia /etc/issue`" ]; then get_mageia_deps - else - unknown + elif [ "`command -v rpm`" ]; then + if [ "`rpm -qa | grep altlinux`" ]; then + get_altlinux_deps + fi fi elif [ "`uname | grep -i freebsd `" ]; then get_freebsd_deps -- cgit v0.10.1 From 2367db32533c6bb81268e580e155d8ffd37f7ec1 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 15:14:46 -0600 Subject: netbsd - ask user to verify X Sets are installed diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index dea2e27..f3ef545 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -614,7 +614,7 @@ check_old_local() echo "Warning: you have a copy of "$i" under /usr/local/include" warnon=1 fi - if [ -e /usr/local/lib/$i ]; then + if [ -e /usr/local/lib/$i.so ]; then echo "Warning: you have a copy of "$i" under /usr/local/lib" warnon=1 fi @@ -626,6 +626,13 @@ check_old_local() } +check_misc() +{ + if [ "`uname -a|grep -i netbsd`" ]; then + echo "NetBSD: Please manually verify the X Sets have been installed" + fi +} + checkargs() { @@ -654,6 +661,7 @@ main() pretty_print $dep $dep_minver $dep_sysver $dep_compare done check_old_local + check_misc } checkargs $* -- cgit v0.10.1 From 7be00e4bc5d0e1c97cf7f69388394376ad238675 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 16:01:40 -0600 Subject: more alt linux fixes diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh index 58bebe6..cf9f136 100755 --- a/scripts/uni-get-dependencies.sh +++ b/scripts/uni-get-dependencies.sh @@ -12,8 +12,8 @@ get_fedora_deps() get_altlinux_deps() { - for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ \ - eigen2 libmpfr libgmp libgmp_cxx qt4-devel libcgal-devel git-core \ + for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ boost-program_options-devel \ + boost-thread-devel boost-system-devel boost-regex-devel eigen2 libmpfr libgmp libgmp_cxx-devel qt4-devel libcgal-devel git-core \ libglew-devel flex bison; do sudo apt-get install $i; done } -- cgit v0.10.1 From 9deb7de38e99130ba2fd34eff188e671b424e590 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 16:58:22 -0600 Subject: CONFIG=skip_version_check should be += otherwise qmake has bizarre problems (bison doesnt get called??) diff --git a/src/version_check.h b/src/version_check.h index a940f6b..b6a63ab 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -6,7 +6,7 @@ are too old, the user will be warned. If the user wishes to force compilation, they can run - qmake CONFIG=skip-version-check + qmake CONFIG+=skip-version-check Otherwise they will be guided to README.md and an -build-dependencies script. -- cgit v0.10.1 From ad45e8a8c52878ed6f3c7fdfb3198f18b0f8875e Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 23 Dec 2012 17:14:58 -0600 Subject: detect netbsd / freebsd after linux not before, for bison/flex. diff --git a/bison.pri b/bison.pri index fcfad6f..14e2e01 100644 --- a/bison.pri +++ b/bison.pri @@ -17,7 +17,13 @@ win32 { QMAKE_EXTRA_COMPILERS += bison_header } -unix:freebsd-g++ { +unix:linux* { + exists(/usr/bin/bison) { + QMAKE_YACC = /usr/bin/bison + } +} + +freebsd* { # on bsd /usr/bin/bison is outdated, dont use it exists(/usr/local/bin/bison) { QMAKE_YACC = /usr/local/bin/bison @@ -26,16 +32,10 @@ unix:freebsd-g++ { } } -unix:netbsd* { +netbsd* { exists(/usr/pkg/bin/bison) { QMAKE_YACC = /usr/pkg/bin/bison } else { # look in $PATH QMAKE_YACC = bison } } - -unix:linux* { - exists(/usr/bin/bison) { - QMAKE_YACC = /usr/bin/bison - } -} diff --git a/eigen.pri b/eigen.pri index 5dd3279..fd7ac74 100644 --- a/eigen.pri +++ b/eigen.pri @@ -49,13 +49,13 @@ CONFIG(mingw-cross-env) { isEmpty(EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen3 macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 - linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen3 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3 - !exists($$EIGEN_INCLUDEPATH) { + linux*|hurd*|unix: EIGEN_INCLUDEPATH = /usr/include/eigen3 + isEmpty(EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2 macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2 - linux*|hurd*: EIGEN_INCLUDEPATH = /usr/include/eigen2 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2 + linux*|hurd*|unix*: EIGEN_INCLUDEPATH = /usr/include/eigen2 } } diff --git a/flex.pri b/flex.pri index 57f854e..203d90d 100644 --- a/flex.pri +++ b/flex.pri @@ -9,16 +9,17 @@ win32 { QMAKE_EXTRA_COMPILERS += flex } -unix:freebsd-g++ { +unix:linux* { + exists(/usr/bin/flex) { + QMAKE_LEX = /usr/bin/flex + } +} + +freebsd* { QMAKE_LEX = /usr/local/bin/flex } -unix:netbsd* { +netbsd* { QMAKE_LEX = /usr/pkg/bin/flex } -unix:linux* { - exists(/usr/bin/flex) { - QMAKE_LEX = /usr/bin/flex - } -} diff --git a/glew.pri b/glew.pri index f4a6ccd..9898af5 100644 --- a/glew.pri +++ b/glew.pri @@ -6,7 +6,6 @@ glew { QMAKE_INCDIR += $$GLEW_DIR/include QMAKE_LIBDIR += $$GLEW_DIR/lib QMAKE_LIBDIR += $$GLEW_DIR/lib64 - message("GLEW location: $$GLEW_DIR") } unix:LIBS += -lGLEW diff --git a/openscad.pro b/openscad.pro index 49b764f..6d9556b 100644 --- a/openscad.pro +++ b/openscad.pro @@ -116,11 +116,6 @@ netbsd* { QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare } -CONFIG(skip-version-check) { - # force the use of outdated libraries - DEFINES += OPENSCAD_SKIP_VERSION_CHECK -} - # Application configuration macx:CONFIG += mdi CONFIG += cgal @@ -144,6 +139,12 @@ CONFIG(mingw-cross-env) { include(mingw-cross-env.pri) } +# force the use of outdated libraries +CONFIG(skip-version-check) { + DEFINES += OPENSCAD_SKIP_VERSION_CHECK +} + + win32 { FLEXSOURCES = src/lexer.l BISONSOURCES = src/parser.y -- cgit v0.10.1 From bdfbcdf339d7912e52d8400359dd192d4c20169e Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 25 Dec 2012 01:28:23 +0100 Subject: improve Gcc version detection diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index f3ef545..386e0c1 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -167,8 +167,10 @@ gcc_sysver() debug using bingcc: $bingcc if [ ! -x $bingcc ]; then return; fi if [ ! "`$bingcc --version`" ]; then return; fi - gccver=`$bingcc --version| grep -i g++ | awk ' { print $3 } '` + gccver=`$bingcc --version| grep -i g++ | awk -F "(" ' { print $2 } '` debug g++ output1: $gccver + gccver=`echo $gccver | awk -F ")" ' { print $2 } '` + debug g++ output2: $gccver gcc_sysver_result=$gccver } -- cgit v0.10.1 From b39b2ba9d066afd73958eeea3c50fa7c43326bab Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 24 Dec 2012 16:34:43 -0800 Subject: fixing g++ version detection diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index 386e0c1..c85ba09 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -171,6 +171,8 @@ gcc_sysver() debug g++ output1: $gccver gccver=`echo $gccver | awk -F ")" ' { print $2 } '` debug g++ output2: $gccver + gccver=`echo $gccver | awk ' { print $1 } '` + debug g++ output3: $gccver gcc_sysver_result=$gccver } -- cgit v0.10.1 From 6693c3b3648e63dfcacd65c3eff9b02e7ea6da32 Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 24 Dec 2012 18:41:30 -0600 Subject: fix eigen detection bug i introduced yesterday diff --git a/eigen.pri b/eigen.pri index fd7ac74..435355c 100644 --- a/eigen.pri +++ b/eigen.pri @@ -51,7 +51,7 @@ isEmpty(EIGEN_INCLUDEPATH) { macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3 linux*|hurd*|unix: EIGEN_INCLUDEPATH = /usr/include/eigen3 - isEmpty(EIGEN_INCLUDEPATH) { + !exists(EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2 macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2 diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index 456c7cd..f83a2cf 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -17,7 +17,7 @@ setenv_common() 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 "Not in OpenSCAD dir... using current directory as base of build" + echo "Warning: Not in OpenSCAD src dir... using current directory as base of build" BASEDIR=$PWD/openscad_deps fi fi -- cgit v0.10.1 From 3c9f36e7443d496b9929ac6f7f65fd6dcc1db98c Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 25 Dec 2012 02:21:22 +0100 Subject: path instructions should be / not ./ diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index a7c62d2..42452b8 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -6,18 +6,18 @@ # # This script builds all library dependencies of OpenSCAD for Linux/BSD -# (Except large ones like qt and gcc) +# (Except large ones like qt or gcc). It is based on macosx-build-dependencies.sh # # Standard 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 +# /path/to/openscad/scripts/uni-build-dependencies.sh # # Prerequisites: # - wget or curl -- cgit v0.10.1 From fb6d7f987507874469de6d72ababecbeccab7d2a Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 24 Dec 2012 19:44:43 -0600 Subject: fix clang build on glew. add some documentation. diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index a7c62d2..6384148 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -242,7 +242,7 @@ build_glew() # clang linux if [ $CC ]; then - sed -ibak s/"CC = cc"/"CC = $(CC)"/ config/Makefile.linux + sed -ibak s/"CC = cc"/"# CC = cc"/ config/Makefile.linux fi MAKER=make @@ -350,6 +350,9 @@ build_eigen() } +# this section allows 'out of tree' builds, as long as the system has +# the 'dirname' command installed + if [ "`command -v dirname`" ]; then OPENSCAD_SCRIPTDIR=`dirname $0` else @@ -379,6 +382,9 @@ 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 build_curl 7.26.0 fi -- cgit v0.10.1 From 4cc6e2a1b1b5dacb75abaa6f35d81abb7dc8c8ed Mon Sep 17 00:00:00 2001 From: don bright Date: Mon, 24 Dec 2012 20:15:40 -0600 Subject: a workaround for LD_LIBRARY_PATH having to be set every time you want to run openscad if you build your own dependencies. diff --git a/README.md b/README.md index dd7c4f8..ebe69c0 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,14 @@ check dependencies source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh -Then follow the Compilation instructions below. +Then follow the Compilation instructions below. + +Note that if you build dependencies with this method, you may have to +modify your LD_LIBRARY_PATH environment variable every time you run the +openscad binary to avoid library problems. A workaround script called +"openscad-unirun.sh" has been included to solve this: copy it somewhere +in your PATH (/usr/local/bin) and run 'openscad-unirun.sh' instead of +the openscad binary. ### Building for Windows diff --git a/scripts/openscad-unirun.sh b/scripts/openscad-unirun.sh new file mode 100755 index 0000000..b0836eb --- /dev/null +++ b/scripts/openscad-unirun.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +LD_LIBRARY_PATH=$HOME/openscad_deps/lib:$HOME/openscad_deps/lib64:$LD_LIBRARY_PATH openscad + -- cgit v0.10.1 From bc7ff5aa8d73ff08bd847bc8d0f41dc26deee54e Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Thu, 27 Dec 2012 17:30:13 +0100 Subject: Ignore dimension when evaluating control modules mixed with geometry children. Fixes #229 diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 5e16892..a4744c2 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -130,6 +130,7 @@ CGAL_Nef_polyhedron CGALEvaluator::applyHull(const CgaladvNode &node) const CGAL_Nef_polyhedron &chN = item.second; // FIXME: Don't use deep access to modinst members if (chnode->modinst->isBackground()) continue; + if (chN.dim == 0) continue; // Ignore object with dimension 0 (e.g. echo) if (dim == 0) { dim = chN.dim; } diff --git a/testdata/scad/features/control-hull-dimension.scad b/testdata/scad/features/control-hull-dimension.scad new file mode 100644 index 0000000..c8736db --- /dev/null +++ b/testdata/scad/features/control-hull-dimension.scad @@ -0,0 +1,4 @@ +hull() { + circle(1); + echo(1); +} diff --git a/tests/regression/cgalpngtest/control-hull-dimension-expected.png b/tests/regression/cgalpngtest/control-hull-dimension-expected.png new file mode 100644 index 0000000..ceeaf54 Binary files /dev/null and b/tests/regression/cgalpngtest/control-hull-dimension-expected.png differ diff --git a/tests/regression/dumptest/control-hull-dimension-expected.txt b/tests/regression/dumptest/control-hull-dimension-expected.txt new file mode 100644 index 0000000..be2e4ee --- /dev/null +++ b/tests/regression/dumptest/control-hull-dimension-expected.txt @@ -0,0 +1,5 @@ + hull() { + circle($fn = 0, $fa = 12, $fs = 2, r = 1); + group(); + } + diff --git a/tests/regression/opencsgtest/control-hull-dimension-expected.png b/tests/regression/opencsgtest/control-hull-dimension-expected.png new file mode 100644 index 0000000..52d11c1 Binary files /dev/null and b/tests/regression/opencsgtest/control-hull-dimension-expected.png differ diff --git a/tests/regression/throwntogethertest/control-hull-dimension-expected.png b/tests/regression/throwntogethertest/control-hull-dimension-expected.png new file mode 100644 index 0000000..52d11c1 Binary files /dev/null and b/tests/regression/throwntogethertest/control-hull-dimension-expected.png differ -- cgit v0.10.1 From 7afcc417b3d26274342ad5293eaad76d7719ae32 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 14:26:59 -0600 Subject: prevent LD_LIBRARY_PATH problems on unix (not OSX) systems with dependency builds, by using RPATH during build. remove the shell script workaround that was added during the previous commit, as it is 'less clean' a solution. diff --git a/README.md b/README.md index ebe69c0..678b213 100644 --- a/README.md +++ b/README.md @@ -176,13 +176,6 @@ check dependencies Then follow the Compilation instructions below. -Note that if you build dependencies with this method, you may have to -modify your LD_LIBRARY_PATH environment variable every time you run the -openscad binary to avoid library problems. A workaround script called -"openscad-unirun.sh" has been included to solve this: copy it somewhere -in your PATH (/usr/local/bin) and run 'openscad-unirun.sh' instead of -the openscad binary. - ### Building for Windows OpenSCAD for Windows is usually cross-compiled from Linux. If you wish to diff --git a/openscad.pro b/openscad.pro index 6d9556b..0048963 100644 --- a/openscad.pro +++ b/openscad.pro @@ -101,6 +101,15 @@ netbsd* { } } +# Prevent LD_LIBRARY_PATH problems when running the openscad binary +# on systems where uni-build-dependencies.sh was used. +# Will not affect 'normal' builds. Also this is not tested on Mac +!isEmpty(OPENSCAD_LIBDIR) { + unix:!macx { + QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS + } +} + # See Dec 2011 OpenSCAD mailing list, re: CGAL/GCC bugs. *g++* { QMAKE_CXXFLAGS *= -fno-strict-aliasing diff --git a/scripts/openscad-unirun.sh b/scripts/openscad-unirun.sh deleted file mode 100755 index b0836eb..0000000 --- a/scripts/openscad-unirun.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -LD_LIBRARY_PATH=$HOME/openscad_deps/lib:$HOME/openscad_deps/lib64:$LD_LIBRARY_PATH openscad - -- cgit v0.10.1 From ed97940f56d0d9ff99ec28750986fb6ff513a39b Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 22:27:44 +0100 Subject: make RPATH work on uni-build-dependencies with GLEW on 64 bit machines diff --git a/openscad.pro b/openscad.pro index 0048963..747a823 100644 --- a/openscad.pro +++ b/openscad.pro @@ -103,10 +103,12 @@ netbsd* { # Prevent LD_LIBRARY_PATH problems when running the openscad binary # on systems where uni-build-dependencies.sh was used. -# Will not affect 'normal' builds. Also this is not tested on Mac +# Will not affect 'normal' builds. !isEmpty(OPENSCAD_LIBDIR) { unix:!macx { QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib $$QMAKE_LFLAGS + # need /lib64 beause GLEW installs itself there on 64 bit machines + QMAKE_LFLAGS = -Wl,-R$$OPENSCAD_LIBDIR/lib64 $$QMAKE_LFLAGS } } -- cgit v0.10.1 From 41269ec0ff9406d707cde7fd584331f1cc44943a Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:05:28 -0600 Subject: simplify README a little bit on build process diff --git a/README.md b/README.md index 678b213..f1d9925 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ 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: +process on some systems: ./scripts/uni-get-dependencies.sh @@ -154,27 +154,30 @@ to the Compilation instructions. If some of your system dependency libraries are missing or old, then you can download and build newer versions into $HOME/openscad_deps by -running these commands: +following this process. First, run the script that sets up the +environment variables. source ./scripts/setenv-unibuild.sh + +Then run the script to compile all the prerequisite libraries above: + ./scripts/uni-build-dependencies.sh -This may take an hour or more, depending on your network and system. As -a special timesaver if you are only missing CGAL and OpenCSG, you can do +This may take an hour or more, depending on your network and system. It +is recommended to have at least 1 gigabyte of free disk space. As a +special timesaver if you are only missing CGAL and OpenCSG, you can do this instead: - source ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh opencsg ./scripts/uni-build-dependencies.sh cgal Note that huge dependencies like gcc or qt are not included here, only the smaller ones (boost, CGAL, opencsg, etc). After the build, again -check dependencies +check dependencies. - source ./scripts/setenv-unibuild.sh ./scripts/check-dependencies.sh -Then follow the Compilation instructions below. +After that, follow the Compilation instructions below. ### Building for Windows @@ -188,7 +191,7 @@ the script that sets up the environment variables. source ./scripts/setenv-mingw-xbuild.sh -Then run the script to download & compile all the dependency libraries: +Then run the script to download & compile all the prerequisite libraries above: ./scripts/mingw-x-build-dependencies.sh -- cgit v0.10.1 From 2230b3c4481c302f8a4baaf06b93cf9d4810dad0 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:10:52 -0600 Subject: qmake-macx last detected on eigen. (unix=1 on osx). clarify comments. diff --git a/bison.pri b/bison.pri index 14e2e01..7a63f0e 100644 --- a/bison.pri +++ b/bison.pri @@ -24,7 +24,8 @@ unix:linux* { } freebsd* { - # on bsd /usr/bin/bison is outdated, dont use it + # on some BSD, /usr/local/bin/bison is newer than + # /usr/bin/bison, so try to prefer it. exists(/usr/local/bin/bison) { QMAKE_YACC = /usr/local/bin/bison } else { # look in $PATH diff --git a/eigen.pri b/eigen.pri index 435355c..efb2d3c 100644 --- a/eigen.pri +++ b/eigen.pri @@ -48,14 +48,14 @@ CONFIG(mingw-cross-env) { isEmpty(EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen3 - macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3 linux*|hurd*|unix: EIGEN_INCLUDEPATH = /usr/include/eigen3 + macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 !exists(EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2 - macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2 linux*|hurd*|unix*: EIGEN_INCLUDEPATH = /usr/include/eigen2 + macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen2 } } @@ -69,6 +69,7 @@ isEmpty(EIGEN_INCLUDEPATH) { # EIGEN being under 'include/eigen[2-3]' needs special prepending QMAKE_INCDIR_QT = $$EIGEN_INCLUDEPATH $$QMAKE_INCDIR_QT +# qmakespecs on netbsd prepend system includes, we need eigen first. netbsd* { QMAKE_CXXFLAGS = -I$$EIGEN_INCLUDEPATH $$QMAKE_CXXFLAGS } -- cgit v0.10.1 From b753e41dea877a1296c77a1bdc122f295f15a3bb Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:13:16 -0600 Subject: cleaning up diff --git a/openscad.pro b/openscad.pro index 747a823..96250fd 100644 --- a/openscad.pro +++ b/openscad.pro @@ -127,6 +127,11 @@ netbsd* { QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare } +# force the use of outdated libraries +CONFIG(skip-version-check) { + DEFINES += OPENSCAD_SKIP_VERSION_CHECK +} + # Application configuration macx:CONFIG += mdi CONFIG += cgal @@ -150,12 +155,6 @@ CONFIG(mingw-cross-env) { include(mingw-cross-env.pri) } -# force the use of outdated libraries -CONFIG(skip-version-check) { - DEFINES += OPENSCAD_SKIP_VERSION_CHECK -} - - win32 { FLEXSOURCES = src/lexer.l BISONSOURCES = src/parser.y -- cgit v0.10.1 From 70d810b666028d97f4587ec15619412181df0a7e Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:14:13 -0600 Subject: cleanup diff --git a/openscad.pro b/openscad.pro index 96250fd..b11f45b 100644 --- a/openscad.pro +++ b/openscad.pro @@ -127,8 +127,8 @@ netbsd* { QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare } -# force the use of outdated libraries CONFIG(skip-version-check) { + # force the use of outdated libraries DEFINES += OPENSCAD_SKIP_VERSION_CHECK } -- cgit v0.10.1 From da9c94308d16e0b978302e60c28cb962a91e2749 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:25:58 -0600 Subject: remove detection via package system, complicated + doesnt work well diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index c85ba09..e9721fd 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -5,24 +5,27 @@ # check-dependencies.sh # check version of all dependencies # check-dependencies.sh debug # debug this script # -# design -# Detection is done through stages and fallbacks in case of failure. +# output +# a table displaying the minimum version from README, the found version, +# and whether it is OK or not. # -# 1st stage, search by parsing header files and/or binary output -# 2nd stage, search with pkg-config -# 3rd stage, search by parsing output of package systems like dpkg or yum +# design +# stage 1. search by parsing header files and/or binary output (_sysver) +# stage 2. search with pkg-config # -# Goal is portability and lack of complicated regex. -# Code style is 'pretend its python'. functions return strings under -# the $function_name_result variable. tmp variables are -# funcname_abbreviated_tmp. Local vars are not used for portability. +# Code style is portability and simplicity. Plain sed, awk, grep, sh. +# Functions return strings under $function_name_result variable. +# tmp variables are named funcname_abbreviated_tmp. +# Local vars are not used. # # todo -# if /usr/ and /usr/local/ on linux both hit, throw an error -# fallback- pkgconfig --exists, then --modversion -# fallback2 - pkg manager -# - print location found, how found??? +# testing of non-bash shells +# if /usr/ and /usr/local/ on linux both hit, throw a warning +# print location found, how found??? +# look at pkgconfig --exists & --modversion +# deal with deps like GLEW that don't have proper version strings? # + DEBUG= debug() @@ -228,162 +231,6 @@ python_sysver() python_sysver_result=`$1/bin/python --version 2>&1 | awk '{print $2}'` } -set_default_package_map() -{ - glew=glew - boost=boost - eigen=eigen3 - imagemagick=imagemagick - make=make - python=python - opencsg=opencsg - cgal=cgal - bison=bison - gmp=gmp - mpfr=mpfr - bash=bash - flex=flex - gcc=gcc - cmake=cmake - curl=curl - git=git - qt4=qt4 -} - - -apt_pkg_search() -{ - - if [ ! "`command -v dpkg`" ]; then - # can't handle systems that use apt-get for RPMs (alt linux) - debug command dpkg not found. cannot search packages. - return - fi - - debug apt_pkg_search $* - apt_pkg_search_result= - pkgname=$1 - dps_ver= - - # translate pkgname to apt packagename - set_default_package_map - for pn in cgal boost mpfr opencsg qt4; do eval $pn="lib"$pn"-dev" ; done - - # handle multiple version names of same package (ubuntu, debian, etc) - if [ $pkgname = glew ]; then - glewtest=`apt-cache search libglew-dev` - if [ "`echo $glewtest | grep glew1.6-dev`" ]; then glew=libglew1.6-dev; - elif [ "`echo $glewtest | grep glew1.5-dev`" ]; then glew=libglew1.5-dev; - elif [ "`echo $glewtest | grep glew-dev`" ]; then glew=libglew-dev; fi - elif [ $pkgname = gmp ]; then - if [ "`apt-cache search libgmp3-dev`" ]; then gmp=libgmp3-dev ;fi - if [ "`apt-cache search libgmp-dev`" ]; then gmp=libgmp-dev ;fi - fi - - debpkgname=`eval echo "$"$pkgname` - - if [ ! $debpkgname ]; then - debug "unknown package" $pkgname; return; - fi - - debug $pkgname ".deb name:" $debpkgname - - # examples of apt version strings - # cgal 4.0-4 gmp 2:5.0.5+dfsg bison 1:2.5.dfsg-2.1 cmake 2.8.9~rc1 - - if [ $pkgname = eigen ]; then - aps_null=`dpkg --status libeigen3-dev 2>&1` - if [ $? = 0 ]; then - debpkgname=libeigen3-dev - else - debpkgname=libeigen2-dev - fi - fi - - debug "test dpkg on $debpkgname" - testdpkg=`dpkg --status $debpkgname 2>&1` - if [ "$testdpkg" ]; then - #debug test dpkg: $testdpkg - if [ "`echo $testdpkg | grep -i version`" ]; then - dps_ver=`dpkg --status $debpkgname | grep -i ^version: | awk ' { print $2 }'` - debug version line from dpkg: $dps_ver - dps_ver=`echo $dps_ver | tail -1 | sed s/"[-~].*"// | sed s/".*:"// | sed s/".dfsg*"//` - debug version: $dps_ver - else - debug couldnt find version string after dpkg --status $debpkgname - fi - else - debug testdpkg failed on $debpkgname - fi - - # Available to be system - #dps_ver= - #debug "test apt-cache on $debpkgname" - # apt-cache show is flaky on older apt. dont run unless search is OK - #test_aptcache=`apt-cache search $debpkgname` - #if [ "$test_aptcache" ]; then - # test_aptcache=`apt-cache show $debpkgname` - # if [ ! "`echo $test_aptcache | grep -i no.packages`" ]; then - # ver=`apt-cache show $debpkgname | grep ^Version: | awk ' { print $2 }'` - # ver=`echo $ver | tail -1 | sed s/"[-~].*"// | sed s/".*:"// | sed s/".dfsg*"//` - # if [ $ver ] ; then vera=$ver ; fi - # fi - #fi - - apt_pkg_search_result="$dps_ver" -} - -set_fedora_package_map() -{ - cgal=CGAL-devel - eigen=eigen2-devel - qt4=qt-devel - imagemagick=ImageMagick - for pn in boost gmp mpfr glew; do eval $pn=$pn"-devel" ; done -} - -yum_pkg_search() -{ - yum_pkg_search_result= - pkgname=$1 - - set_default_package_map - set_fedora_package_map - fedora_pkgname=`eval echo "$"$pkgname` - - debug $pkgname". fedora name:" $fedora_pkgname - if [ ! $fedora_pkgname ]; then - debug "unknown package" $pkgname; return; - fi - - test_yum=`yum info $fedora_pkgname 2>&1` - if [ "$test_yum" ]; then - debug test_yum: $test_yum - ydvver=`yum info $fedora_pkgname 2>&1 | grep ^Version | awk '{print $3}' ` - if [ $ydvver ]; then ydvver=$ydvver ; fi - else - debug test_yum failed on $pkgname - fi - yum_pkg_search_result="$ydvver" -} - - -pkg_search() -{ - debug pkg_search $* - pkg_search_result= - - if [ "`command -v apt-get`" ]; then - apt_pkg_search $* - pkg_search_result=$apt_pkg_search_result - elif [ "`command -v yum`" ]; then - yum_pkg_search $* - pkg_search_result=$yum_pkg_search_result - else - debug unknown system type. cannot search packages. - fi -} - pkg_config_search() { debug pkg_config_search $* @@ -400,9 +247,6 @@ pkg_config_search() fi } - - - get_minversion_from_readme() { if [ -e README.md ]; then READFILE=README.md; fi @@ -433,7 +277,6 @@ get_minversion_from_readme() get_minversion_from_readme_result=$grv_tmp } - find_min_version() { find_min_version_result= @@ -454,13 +297,12 @@ find_min_version() vers_to_int() { - # change x.y.z.p into x0y0z0p for purposes of comparison with -lt or -gt - # it will work as long as the resulting int is less than 2.147 billion - # and y z and p are less than 99 + # change x.y.z.p into an integer that can be compared using -lt or -gt # 1.2.3.4 into 1020304 # 1.11.0.12 into 1110012 # 2011.2.3 into 20110020300 - # the resulting integer can be simply compared using -lt or -gt + # it will work as long as the resulting int is less than 2.147 billion + # and y z and p are less than 99 vers_to_int_result= if [ ! $1 ] ; then return ; fi vtoi_ver=$1 @@ -562,9 +404,6 @@ pretty_print() pp_compared= } - - - find_installed_version() { debug find_installed_version $* @@ -592,13 +431,6 @@ find_installed_version() fi fi - # use the package system to search - if [ ! $fsv_tmp ]; then - debug plain + pkg_config search both failed... trying package search - pkg_search $dep - fsv_tmp=$pkg_search_result - fi - if [ $fsv_tmp ]; then find_installed_version_result=$fsv_tmp else @@ -606,12 +438,11 @@ find_installed_version() fi } - check_old_local() { warnon= if [ "`uname | grep -i linux`" ]; then - header_list="opencsg.h CGAL boost GL/glew.h" + header_list="opencsg.h CGAL boost GL/glew.h gmp.h mpfr.h eigen2 eigen3" liblist="libboost libopencsg libCGAL libglew" for i in $header_list $liblist; do if [ -e /usr/local/include/$i ]; then @@ -629,7 +460,6 @@ check_old_local() fi } - check_misc() { if [ "`uname -a|grep -i netbsd`" ]; then @@ -637,7 +467,6 @@ check_misc() fi } - checkargs() { for i in $*; do @@ -650,9 +479,7 @@ main() deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc" deps="$deps bison flex make" #deps="$deps curl git" # not technically necessary for build - #deps="$deps python cmake" # only needed for tests - #deps="$deps imagemagick" # needs work, only needed for tests - #deps="eigen glew opencsg" # debugging + #deps="$deps python cmake imagemagick" # only needed for tests pretty_print title for dep in $deps; do debug "processing $dep" -- cgit v0.10.1 From 728f00d8f7f1f94f9b29e5bfec6e6b20f99b8029 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 17:41:13 -0600 Subject: clarify comments diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 4a26f09..ae856df 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -1,8 +1,8 @@ #!/bin/bash # # This script creates a binary release of OpenSCAD. This should work -# under Mac OS X, Windows (msys), Linux 32, Linux 64, and Linux->Win32 MXE -# cross-build. +# under Mac OS X, Linux 32, Linux 64, and Linux->Win32 MXE cross-build. +# Windows under msys has not been tested recently. # # The script will create a file called openscad-. in # the current directory (or under ./mingw32) @@ -18,8 +18,8 @@ # The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT # to identify a build in the about box. # -# The mingw32 cross compile depends on the mxe tools + dependencies. Please -# see scripts/*mingw-* & the OpenSCAD manual for more information. +# The mingw32 cross compile depends on the MXE cross-build tools. Please +# see the README.md file on how to install these dependencies. printUsage() { diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 8a2c7c3..9da08aa 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -4,16 +4,20 @@ # 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 won't build QT or gcc. It is based on +# macosx-build-dependencies.sh # -# This script builds all library dependencies of OpenSCAD for Linux/BSD -# (Except large ones like qt or gcc). 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 # -# Standard usage: +# Usage: # cd openscad # . ./scripts/setenv-unibuild.sh # ./scripts/uni-build-dependencies.sh # -# Out-of-tree usage +# Out-of-tree usage: # # cd somepath # . /path/to/openscad/scripts/setenv-unibuild.sh @@ -22,7 +26,11 @@ # Prerequisites: # - wget or curl # - Qt4 -# - gcc (clang=experimental) +# - gcc +# +# Enable Clang (experimental, only works on linux): +# +# . ./scripts/setenv-unibuild.sh clang # printUsage() @@ -223,7 +231,7 @@ build_glew() cd glew-$version mkdir -p $DEPLOYDIR/lib/pkgconfig - # Glew makefiles are not built for Linux Multiarch. We aren't trying + # 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 @@ -369,7 +377,7 @@ SRCDIR=$BASEDIR/src if [ ! $NUMCPU ]; then echo "Note: The NUMCPU environment variable can be set for paralell builds" - NUMCPU=1 + NUMCPU=1 fi if [ ! -d $BASEDIR/bin ]; then -- cgit v0.10.1 From 413f22c610f06e5c4cfd0f40cb28167593fd857a Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 18:00:23 -0600 Subject: clarify comments and variable names in pretty print diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index e9721fd..d2bc9ab 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -364,6 +364,12 @@ compare_version() pretty_print() { + # there are four columns, passed as $1 $2 $3 and $4 + # 1 = name of dependency + # 2 = version found in README + # 3 = version found on system + # 4 = whether it is OK or not + debug pretty_print $* brightred="\033[40;31m" @@ -380,28 +386,28 @@ pretty_print() ppstr="%s%-12s" pp_format='{printf("'$ppstr$ppstr$ppstr$ppstr$nocolor'\n",$1,$2,$3,$4,$5,$6,$7,$8)}' pp_title="$gray depname $gray minimum $gray found $gray OKness" - if [ $1 ]; then pp_dep=$1; fi - if [ $pp_dep = "title" ]; then + if [ $1 ]; then pp_depname=$1; fi + if [ $pp_depname = "title" ]; then echo -e $pp_title | awk $pp_format return ; fi if [ $2 ]; then pp_minver=$2; else pp_minver="unknown"; fi if [ $3 ]; then pp_foundver=$3; else pp_foundver="unknown"; fi - if [ $4 ]; then pp_compared=$4; else pp_compared="NotOK"; fi + if [ $4 ]; then pp_okness=$4; else pp_okness="NotOK"; fi - if [ $pp_compared = "NotOK" ]; then + if [ $pp_okness = "NotOK" ]; then pp_foundcolor=$purple; pp_cmpcolor=$purple; else pp_foundcolor=$gray; pp_cmpcolor=$green; fi - echo -e $cyan $pp_dep $gray $pp_minver $pp_foundcolor $pp_foundver $pp_cmpcolor $pp_compared | awk $pp_format - pp_dep= + echo -e $cyan $pp_depname $gray $pp_minver $pp_foundcolor $pp_foundver $pp_cmpcolor $pp_okness | awk $pp_format + pp_depname= pp_minver= pp_foundver= - pp_compared= + pp_okness= } find_installed_version() -- cgit v0.10.1 From eeadeb2552ae72004075bb4a43db33ba9af76ec0 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 18:02:29 -0600 Subject: clarify variable names. simplify. diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh index d2bc9ab..eaed556 100755 --- a/scripts/check-dependencies.sh +++ b/scripts/check-dependencies.sh @@ -415,15 +415,15 @@ find_installed_version() debug find_installed_version $* find_installed_version_result=unknown fsv_tmp= - dep=$1 + depname=$1 # try to find/parse headers and/or binary output if [ ! $fsv_tmp ]; then for syspath in "/opt" "/usr/pkg" "/usr" "/usr/local" $OPENSCAD_LIBRARIES; do if [ -e $syspath ]; then - debug $dep"_sysver" $syspath - eval $dep"_sysver" $syspath - fsv_tmp=`eval echo "$"$dep"_sysver_result"` + debug $depname"_sysver" $syspath + eval $depname"_sysver" $syspath + fsv_tmp=`eval echo "$"$depname"_sysver_result"` fi done fi @@ -432,7 +432,7 @@ find_installed_version() if [ ! $fsv_tmp ]; then if [ "`command -v pkg-config`" ]; then debug plain search failed. trying pkg_config... - pkg_config_search $dep + pkg_config_search $depname fsv_tmp=$pkg_config_search_result fi fi @@ -482,20 +482,19 @@ checkargs() main() { - deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc" - deps="$deps bison flex make" + deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc bison flex make" #deps="$deps curl git" # not technically necessary for build #deps="$deps python cmake imagemagick" # only needed for tests pretty_print title - for dep in $deps; do + for depname in $deps; do debug "processing $dep" - find_installed_version $dep + find_installed_version $depname dep_sysver=$find_installed_version_result - find_min_version $dep + find_min_version $depname dep_minver=$find_min_version_result compare_version $dep_minver $dep_sysver dep_compare=$compare_version_result - pretty_print $dep $dep_minver $dep_sysver $dep_compare + pretty_print $depname $dep_minver $dep_sysver $dep_compare done check_old_local check_misc -- cgit v0.10.1 From 87f2d39901560526745e337f27bd2dc017f5ddd1 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 18:06:14 -0600 Subject: clarify comments diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh index f83a2cf..d13782c 100644 --- a/scripts/setenv-unibuild.sh +++ b/scripts/setenv-unibuild.sh @@ -1,12 +1,8 @@ # setup environment variables for building OpenSCAD against custom built -# dependency libraries. +# dependency libraries. works on Linux/BSD. # -# run with 'source ./scripts/setenv-unibuild.sh' +# Please see the 'uni-build-dependencies.sh' file for usage information # -# run it every time you re-login and want to build or run openscad -# against custom libraries installed into BASEDIR. -# -# used in conjuction with uni-build-dependencies.sh setenv_common() { -- cgit v0.10.1 From 158e760b4dbda42079db41e580ee191be5c4c65f Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 29 Dec 2012 18:07:57 -0600 Subject: clarify comments diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh index 9da08aa..88f2cf8 100755 --- a/scripts/uni-build-dependencies.sh +++ b/scripts/uni-build-dependencies.sh @@ -5,8 +5,7 @@ # 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 won't build QT or gcc. It is based on -# macosx-build-dependencies.sh +# 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' -- cgit v0.10.1 From db9a78f028803619cb68e17c7478e3de956e61d8 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 30 Dec 2012 01:18:08 +0100 Subject: cleanup diff --git a/src/svg.cc b/src/svg.cc index ff13332..e5130b0 100644 --- a/src/svg.cc +++ b/src/svg.cc @@ -96,7 +96,7 @@ std::string dump_cgal_nef_polyhedron2_face_svg( bool mark, CGAL_Iso_rectangle_2e bbox ) { - std::stringstream out; + std::stringstream out; CGAL_For_all(c1, c2) { if ( explorer.is_standard( explorer.target(c1) ) ) { CGAL_Point_2e source = explorer.point( explorer.source( c1 ) ); @@ -106,7 +106,7 @@ std::string dump_cgal_nef_polyhedron2_face_svg( double mod=0; if (color=="green") mod=10; out << " \n"; - out << " \n"; out << svg_border() << "\n" << svg_axes() << "\n"; svg_cursor_py += svg_px_height; for ( i = explorer.faces_begin(); i!= explorer.faces_end(); ++i ) { - out << " \n"; - CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c1 - = explorer.face_cycle( i ), c2 ( c1 ); - out << dump_cgal_nef_polyhedron2_face_svg( c1, c2, explorer, "red", i->mark(), bbox ); - - CGAL_Nef_polyhedron2::Explorer::Hole_const_iterator j; - for ( j = explorer.holes_begin( i ); j!= explorer.holes_end( i ); ++j ) { - out << " \n"; - CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c3( j ), c4 ( c3 ); - out << dump_cgal_nef_polyhedron2_face_svg( c3, c4, explorer, "green", j->mark(), bbox ); - out << " \n"; - } - out << " \n"; - } - out << ""; + out << " \n"; + CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c1 + = explorer.face_cycle( i ), c2 ( c1 ); + out << dump_cgal_nef_polyhedron2_face_svg( c1, c2, explorer, "red", i->mark(), bbox ); + + CGAL_Nef_polyhedron2::Explorer::Hole_const_iterator j; + for ( j = explorer.holes_begin( i ); j!= explorer.holes_end( i ); ++j ) { + out << " \n"; + CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c3( j ), c4 ( c3 ); + out << dump_cgal_nef_polyhedron2_face_svg( c3, c4, explorer, "green", j->mark(), bbox ); + out << " \n"; + } + out << " \n"; + } + out << ""; std::string tmp = out.str(); boost::replace_all( tmp, "'", "\"" ); return tmp; @@ -219,29 +219,29 @@ public: std::string dump_svg( const CGAL_Nef_polyhedron3 &N ) { - std::stringstream out; + std::stringstream out; out << svg_header() << "\n" << svg_border() << "\n" << svg_axes() << "\n"; out << "\n"; - CGAL_Nef_polyhedron3::Volume_const_iterator c; - CGAL_forall_volumes(c,N) { - out << " \n"; - out << " \n"; - CGAL_Nef_polyhedron3::Shell_entry_const_iterator it; - CGAL_forall_shells_of(it,c) { - out << " \n"; - NefPoly3_dumper_svg dumper_svg(N); - N.visit_shell_objects(CGAL_Nef_polyhedron3::SFace_const_handle(it), dumper_svg ); + CGAL_Nef_polyhedron3::Volume_const_iterator c; + CGAL_forall_volumes(c,N) { + out << " \n"; + out << " \n"; + CGAL_Nef_polyhedron3::Shell_entry_const_iterator it; + CGAL_forall_shells_of(it,c) { + out << " \n"; + NefPoly3_dumper_svg dumper_svg(N); + N.visit_shell_objects(CGAL_Nef_polyhedron3::SFace_const_handle(it), dumper_svg ); out << dumper_svg.out.str(); - out << " \n"; - } - out << " \n"; - } - out << "\n"; + out << " \n"; + } + out << " \n"; + } + out << "\n"; out << ""; std::string tmp = out.str(); boost::replace_all( tmp, "'", "\"" ); - return tmp; + return tmp; } } // namespace -- cgit v0.10.1 From 8cea6834f68cbbfb85c2568d388bf3b2e707cca5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 8 Jan 2013 13:24:54 -0500 Subject: bugfix for recently introduced bug: Render negative 2D objects slightly thicker than positive objects to avoid z-buffer tearing with OpenCSG rendering diff --git a/src/polyset.cc b/src/polyset.cc index 3b3be34..e601585 100644 --- a/src/polyset.cc +++ b/src/polyset.cc @@ -157,7 +157,8 @@ void PolySet::render_surface(csgmode_e csgmode, const Transform3d &m, GLint *sha } #endif /* ENABLE_OPENCSG */ if (this->is2d) { - double zbase = 1; // Render 2D objects 1mm thick + // Render 2D objects 1mm thick, but differences slightly larger + double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1; glBegin(GL_TRIANGLES); for (double z = -zbase/2; z < zbase; z += zbase) { @@ -248,7 +249,8 @@ void PolySet::render_edges(csgmode_e csgmode) const { glDisable(GL_LIGHTING); if (this->is2d) { - double zbase = 1; // Render 2D objects 1mm thick + // Render 2D objects 1mm thick, but differences slightly larger + double zbase = 1 + (csgmode & CSGMODE_DIFFERENCE_FLAG) * 0.1; for (double z = -zbase/2; z < zbase; z += zbase) { for (size_t i = 0; i < borders.size(); i++) { diff --git a/src/polyset.h b/src/polyset.h index 4ca57bf..6626f79 100644 --- a/src/polyset.h +++ b/src/polyset.h @@ -29,14 +29,15 @@ public: BoundingBox getBoundingBox() const; +#define CSGMODE_DIFFERENCE_FLAG 0x10 enum csgmode_e { - CSGMODE_NONE, - CSGMODE_NORMAL = 1, - CSGMODE_DIFFERENCE = 2, - CSGMODE_BACKGROUND = 11, - CSGMODE_BACKGROUND_DIFFERENCE = 12, - CSGMODE_HIGHLIGHT = 21, - CSGMODE_HIGHLIGHT_DIFFERENCE = 22 + CSGMODE_NONE = 0x00, + CSGMODE_NORMAL = 0x01, + CSGMODE_DIFFERENCE = CSGMODE_NORMAL | CSGMODE_DIFFERENCE_FLAG, + CSGMODE_BACKGROUND = 0x02, + CSGMODE_BACKGROUND_DIFFERENCE = CSGMODE_BACKGROUND | CSGMODE_DIFFERENCE_FLAG, + CSGMODE_HIGHLIGHT = 0x03, + CSGMODE_HIGHLIGHT_DIFFERENCE = CSGMODE_HIGHLIGHT | CSGMODE_DIFFERENCE_FLAG }; void render_surface(csgmode_e csgmode, const Transform3d &m, GLint *shaderinfo = NULL) const; -- cgit v0.10.1 From 810f1a86189555023240507848ff9eebb161b8de Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 8 Jan 2013 13:26:25 -0500 Subject: Don't just ignore geometric nodes having zero volume/area - when doing difference/intersection, they tend to turn negative objects into positive ones. Fixes #221 diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index a4744c2..4deb3b3 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -61,14 +61,16 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr if (target.dim != 2 && target.dim != 3) { assert(false && "Dimension of Nef polyhedron must be 2 or 3"); } - if (src.empty()) return; // Empty polyhedron. This can happen for e.g. square([0,0]) + if (src.isEmpty()) return; // Empty polyhedron. This can happen for e.g. square([0,0]) + if (target.isEmpty() && op != CGE_UNION) return; // empty op => empty if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); try { switch (op) { case CGE_UNION: - target += src; + if (target.isEmpty()) target = src.copy(); + else target += src; break; case CGE_INTERSECTION: target *= src; @@ -110,7 +112,8 @@ CGAL_Nef_polyhedron CGALEvaluator::applyToChildren(const AbstractNode &node, CGA if (!isCached(*chnode)) { CGALCache::instance()->insert(this->tree.getIdString(*chnode), chN); } - if (N.empty()) N = chN.copy(); + // Initialize N on first iteration with first expected geometric object + if (N.isNull() && !N.isEmpty()) N = chN.copy(); else process(N, chN, op); chnode->progress_report(); @@ -245,7 +248,6 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) if (!isCached(node)) { // First union all children N = applyToChildren(node, CGE_UNION); - if ( matrix_contains_infinity( node.matrix ) || matrix_contains_nan( node.matrix ) ) { // due to the way parse/eval works we can't currently distinguish between NaN and Inf PRINT("Warning: Transformation matrix contains Not-a-Number and/or Infinity - removing object."); @@ -253,51 +255,53 @@ Response CGALEvaluator::visit(State &state, const TransformNode &node) } // Then apply transform - // If there is no geometry under the transform, N will be empty and of dim 0, - // just just silently ignore such nodes - if (N.dim == 2) { - // Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2 - // objects. So we convert in to our internal 2d data format, transform it, - // tesselate it and create a new CGAL_Nef_polyhedron2 from it.. What a hack! - - Eigen::Matrix2f testmat; - testmat << node.matrix(0,0), node.matrix(0,1), node.matrix(1,0), node.matrix(1,1); - if (testmat.determinant() == 0) { - PRINT("Warning: Scaling a 2D object with 0 - removing object"); - N.reset(); - } - else { - CGAL_Aff_transformation2 t( - node.matrix(0,0), node.matrix(0,1), node.matrix(0,3), - node.matrix(1,0), node.matrix(1,1), node.matrix(1,3), node.matrix(3,3)); + // If there is no geometry under the transform, N will be empty + // just silently ignore such nodes + if (!N.isNull()) { + if (N.dim == 2) { + // Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2 + // objects. So we convert in to our internal 2d data format, transform it, + // tesselate it and create a new CGAL_Nef_polyhedron2 from it.. What a hack! - DxfData *dd = N.convertToDxfData(); - for (size_t i=0; i < dd->points.size(); i++) { - CGAL_Kernel2::Point_2 p = CGAL_Kernel2::Point_2(dd->points[i][0], dd->points[i][1]); - p = t.transform(p); - dd->points[i][0] = to_double(p.x()); - dd->points[i][1] = to_double(p.y()); + Eigen::Matrix2f testmat; + testmat << node.matrix(0,0), node.matrix(0,1), node.matrix(1,0), node.matrix(1,1); + if (testmat.determinant() == 0) { + PRINT("Warning: Scaling a 2D object with 0 - removing object"); + N.reset(); + } + else { + CGAL_Aff_transformation2 t( + node.matrix(0,0), node.matrix(0,1), node.matrix(0,3), + node.matrix(1,0), node.matrix(1,1), node.matrix(1,3), node.matrix(3,3)); + + DxfData *dd = N.convertToDxfData(); + for (size_t i=0; i < dd->points.size(); i++) { + CGAL_Kernel2::Point_2 p = CGAL_Kernel2::Point_2(dd->points[i][0], dd->points[i][1]); + p = t.transform(p); + dd->points[i][0] = to_double(p.x()); + dd->points[i][1] = to_double(p.y()); + } + + PolySet ps; + ps.is2d = true; + dxf_tesselate(&ps, *dd, 0, true, false, 0); + + N = evaluateCGALMesh(ps); + delete dd; } - - PolySet ps; - ps.is2d = true; - dxf_tesselate(&ps, *dd, 0, true, false, 0); - - N = evaluateCGALMesh(ps); - delete dd; - } - } - else if (N.dim == 3) { - if (node.matrix.matrix().determinant() == 0) { - PRINT("Warning: Scaling a 3D object with 0 - removing object"); - N.reset(); } - else { - CGAL_Aff_transformation t( - node.matrix(0,0), node.matrix(0,1), node.matrix(0,2), node.matrix(0,3), - node.matrix(1,0), node.matrix(1,1), node.matrix(1,2), node.matrix(1,3), - node.matrix(2,0), node.matrix(2,1), node.matrix(2,2), node.matrix(2,3), node.matrix(3,3)); - N.p3->transform(t); + else if (N.dim == 3) { + if (node.matrix.matrix().determinant() == 0) { + PRINT("Warning: Scaling a 3D object with 0 - removing object"); + N.reset(); + } + else { + CGAL_Aff_transformation t( + node.matrix(0,0), node.matrix(0,1), node.matrix(0,2), node.matrix(0,3), + node.matrix(1,0), node.matrix(1,1), node.matrix(1,2), node.matrix(1,3), + node.matrix(2,0), node.matrix(2,1), node.matrix(2,2), node.matrix(2,3), node.matrix(3,3)); + N.p3->transform(t); + } } } } @@ -388,7 +392,7 @@ void CGALEvaluator::addToParent(const State &state, const AbstractNode &node, co CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps) { - if (ps.empty()) return CGAL_Nef_polyhedron(); + if (ps.empty()) return CGAL_Nef_polyhedron(ps.is2d ? 2 : 3); if (ps.is2d) { diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index adf1217..4357e44 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -43,7 +43,11 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) { - if (root.dim == 2) { + if (this->root.isNull()) { + this->polyhedron = NULL; + this->polyset = NULL; + } + else if (root.dim == 2) { DxfData *dd = root.convertToDxfData(); this->polyhedron = NULL; this->polyset = new PolySet(); @@ -67,10 +71,6 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) CGAL::OGL::Nef3_Converter::convert_to_OGLPolyhedron(*this->root.p3, this->polyhedron); this->polyhedron->init(); } - else { - this->polyhedron = NULL; - this->polyset = NULL; - } } CGALRenderer::~CGALRenderer() @@ -81,6 +81,7 @@ CGALRenderer::~CGALRenderer() void CGALRenderer::draw(bool showfaces, bool showedges) const { + if (this->root.isNull()) return; if (this->root.dim == 2) { // Draw 2D polygons glDisable(GL_LIGHTING); diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index ad2e4e2..8906595 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -61,7 +61,7 @@ CGAL_Nef_polyhedron &CGAL_Nef_polyhedron::minkowski(const CGAL_Nef_polyhedron &o int CGAL_Nef_polyhedron::weight() const { - if (this->empty()) return 0; + if (this->isNull()) return 0; size_t memsize = sizeof(CGAL_Nef_polyhedron); if (this->dim == 2) { @@ -84,8 +84,7 @@ int CGAL_Nef_polyhedron::weight() const */ PolySet *CGAL_Nef_polyhedron::convertToPolyset() { - if (this->empty()) - return new PolySet(); + if (this->isNull()) return new PolySet(); PolySet *ps = NULL; if (this->dim == 2) { ps = new PolySet(); diff --git a/src/CGAL_Nef_polyhedron.h b/src/CGAL_Nef_polyhedron.h index e8c505b..d949a2a 100644 --- a/src/CGAL_Nef_polyhedron.h +++ b/src/CGAL_Nef_polyhedron.h @@ -8,12 +8,15 @@ class CGAL_Nef_polyhedron { public: - CGAL_Nef_polyhedron() : dim(0) {} + CGAL_Nef_polyhedron(int dim = 0) : dim(dim) {} CGAL_Nef_polyhedron(CGAL_Nef_polyhedron2 *p); CGAL_Nef_polyhedron(CGAL_Nef_polyhedron3 *p); ~CGAL_Nef_polyhedron() {} - bool empty() const { return (dim == 0 || (!p2 && !p3)); } + // Empty means it is a geometric node which has zero area/volume + bool isEmpty() const { return (dim > 0 && !p2 && !p3); } + // Null means the node doesn't contain any geometry (for whatever reason) + bool isNull() const { return !p2 && !p3; } void reset() { dim=0; p2.reset(); p3.reset(); } CGAL_Nef_polyhedron &operator+=(const CGAL_Nef_polyhedron &other); CGAL_Nef_polyhedron &operator*=(const CGAL_Nef_polyhedron &other); diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 8e08e19..224e657 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -134,11 +134,11 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) if (v->modinst->isBackground()) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); if (N.dim == 3) { - if (sum.empty()) sum = N.copy(); + if (sum.isNull()) sum = N.copy(); else sum += N; } } - if (sum.empty()) return NULL; + if (sum.isNull()) return NULL; if (!sum.p3->is_simple()) { if (!node.cut_mode) { PRINT("WARNING: Body of projection(cut = false) isn't valid 2-manifold! Modify your design.."); @@ -149,7 +149,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) //std::cout << sum.dump(); //std::cout.flush(); - CGAL_Nef_polyhedron nef_poly; + CGAL_Nef_polyhedron nef_poly(2); if (node.cut_mode) { CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); @@ -180,7 +180,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } } - if ( sum.p3->is_empty() ) { + if (sum.p3->is_empty()) { CGAL::set_error_behaviour(old_behaviour); PRINT("WARNING: projection() failed."); return NULL; @@ -204,7 +204,6 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) log << "\n"; } nef_poly.p2 = zremover.output_nefpoly2d; - nef_poly.dim = 2; } catch (const CGAL::Failure_exception &e) { PRINTB("CGAL error in projection node while flattening: %s", e.what()); } @@ -284,8 +283,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) plist.push_back(p); } // FIXME: Should the CGAL_Nef_polyhedron2 be cached? - if (nef_poly.empty()) { - nef_poly.dim = 2; + if (nef_poly.isEmpty()) { nef_poly.p2.reset(new CGAL_Nef_polyhedron2(plist.begin(), plist.end(), CGAL_Nef_polyhedron2::INCLUDED)); } else { @@ -385,18 +383,18 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node) BOOST_FOREACH (AbstractNode * v, node.getChildren()) { if (v->modinst->isBackground()) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); - if (!N.empty()) { + if (!N.isNull()) { if (N.dim != 2) { PRINT("ERROR: linear_extrude() is not defined for 3D child objects!"); } else { - if (sum.empty()) sum = N.copy(); + if (sum.isNull()) sum = N.copy(); else sum += N; } } } - if (sum.empty()) return NULL; + if (sum.isNull()) return NULL; dxf = sum.convertToDxfData();; } else { dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale); @@ -485,18 +483,18 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RotateExtrudeNode &node) BOOST_FOREACH (AbstractNode * v, node.getChildren()) { if (v->modinst->isBackground()) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); - if (!N.empty()) { + if (!N.isNull()) { if (N.dim != 2) { PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!"); } else { - if (sum.empty()) sum = N.copy(); + if (sum.isNull()) sum = N.copy(); else sum += N; } } } - if (sum.empty()) return NULL; + if (sum.isNull()) return NULL; dxf = sum.convertToDxfData(); } else { dxf = new DxfData(node.fn, node.fs, node.fa, node.filename, node.layername, node.origin_x, node.origin_y, node.scale); @@ -511,7 +509,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const CgaladvNode &node) { CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node); PolySet *ps = NULL; - if (!N.empty()) { + if (!N.isNull()) { ps = N.convertToPolyset(); if (ps) ps->convexity = node.convexity; } @@ -523,7 +521,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node) { CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node); PolySet *ps = NULL; - if (!N.empty()) { + if (!N.isNull()) { if (N.dim == 3 && !N.p3->is_simple()) { PRINT("WARNING: Body of render() isn't valid 2-manifold!"); } diff --git a/src/mainwin.cc b/src/mainwin.cc index dc5b79b..dde6761 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1236,35 +1236,37 @@ void MainWindow::actionRenderCGALDone(CGAL_Nef_polyhedron *root_N) PolySetCache::instance()->print(); CGALCache::instance()->print(); - if (root_N->dim == 2) { - PRINT(" Top level object is a 2D object:"); - PRINTB(" Empty: %6s", (root_N->p2->is_empty() ? "yes" : "no")); - PRINTB(" Plane: %6s", (root_N->p2->is_plane() ? "yes" : "no")); - PRINTB(" Vertices: %6d", root_N->p2->explorer().number_of_vertices()); - PRINTB(" Halfedges: %6d", root_N->p2->explorer().number_of_halfedges()); - PRINTB(" Edges: %6d", root_N->p2->explorer().number_of_edges()); - PRINTB(" Faces: %6d", root_N->p2->explorer().number_of_faces()); - PRINTB(" FaceCycles: %6d", root_N->p2->explorer().number_of_face_cycles()); - PRINTB(" ConnComp: %6d", root_N->p2->explorer().number_of_connected_components()); - } - - if (root_N->dim == 3) { - PRINT(" Top level object is a 3D object:"); - PRINTB(" Simple: %6s", (root_N->p3->is_simple() ? "yes" : "no")); - PRINTB(" Valid: %6s", (root_N->p3->is_valid() ? "yes" : "no")); - PRINTB(" Vertices: %6d", root_N->p3->number_of_vertices()); - PRINTB(" Halfedges: %6d", root_N->p3->number_of_halfedges()); - PRINTB(" Edges: %6d", root_N->p3->number_of_edges()); - PRINTB(" Halffacets: %6d", root_N->p3->number_of_halffacets()); - PRINTB(" Facets: %6d", root_N->p3->number_of_facets()); - PRINTB(" Volumes: %6d", root_N->p3->number_of_volumes()); + if (!root_N->isNull()) { + if (root_N->dim == 2) { + PRINT(" Top level object is a 2D object:"); + PRINTB(" Empty: %6s", (root_N->p2->is_empty() ? "yes" : "no")); + PRINTB(" Plane: %6s", (root_N->p2->is_plane() ? "yes" : "no")); + PRINTB(" Vertices: %6d", root_N->p2->explorer().number_of_vertices()); + PRINTB(" Halfedges: %6d", root_N->p2->explorer().number_of_halfedges()); + PRINTB(" Edges: %6d", root_N->p2->explorer().number_of_edges()); + PRINTB(" Faces: %6d", root_N->p2->explorer().number_of_faces()); + PRINTB(" FaceCycles: %6d", root_N->p2->explorer().number_of_face_cycles()); + PRINTB(" ConnComp: %6d", root_N->p2->explorer().number_of_connected_components()); + } + + if (root_N->dim == 3) { + PRINT(" Top level object is a 3D object:"); + PRINTB(" Simple: %6s", (root_N->p3->is_simple() ? "yes" : "no")); + PRINTB(" Valid: %6s", (root_N->p3->is_valid() ? "yes" : "no")); + PRINTB(" Vertices: %6d", root_N->p3->number_of_vertices()); + PRINTB(" Halfedges: %6d", root_N->p3->number_of_halfedges()); + PRINTB(" Edges: %6d", root_N->p3->number_of_edges()); + PRINTB(" Halffacets: %6d", root_N->p3->number_of_halffacets()); + PRINTB(" Facets: %6d", root_N->p3->number_of_facets()); + PRINTB(" Volumes: %6d", root_N->p3->number_of_volumes()); + } } int s = this->progresswidget->elapsedTime() / 1000; PRINTB("Total rendering time: %d hours, %d minutes, %d seconds", (s / (60*60)) % ((s / 60) % 60) % (s % 60)); this->root_N = root_N; - if (!this->root_N->empty()) { + if (!this->root_N->isNull()) { this->cgalRenderer = new CGALRenderer(*this->root_N); // Go to CGAL view mode if (viewActionCGALGrid->isChecked()) { diff --git a/testdata/scad/features/difference-tests.scad b/testdata/scad/features/difference-tests.scad index 186772f..b770764 100644 --- a/testdata/scad/features/difference-tests.scad +++ b/testdata/scad/features/difference-tests.scad @@ -29,6 +29,7 @@ translate([24,0,0]) difference() { translate([0,0,6.99]) cylinder(r=4, h=4, center=true); } +// Subtracting something from nothing translate([24,12,0]) difference() { cube([0,10,10], center=true); # cylinder(r=4, h=20, center=true); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 18f4469..87e5319 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -773,7 +773,6 @@ set_test_config(Heavy opencsgtest_minkowski3-tests cgalpngtest_minkowski3-tests cgalpngtest_for-tests cgalpngtest_for-nested-tests - cgalpngtest_difference-tests cgalpngtest_intersection-tests) foreach(FILE ${EXAMPLE_FILES}) diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 08e539e..56861c6 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -153,30 +153,30 @@ int main(int argc, char **argv) exit(1); } - CGALRenderer cgalRenderer(N); - + CGALRenderer cgalRenderer(N); + BoundingBox bbox; if (cgalRenderer.polyhedron) { CGAL::Bbox_3 cgalbbox = cgalRenderer.polyhedron->bbox(); bbox = BoundingBox(Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()), - Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax())); + Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax())); } else if (cgalRenderer.polyset) { bbox = cgalRenderer.polyset->getBoundingBox(); } - + Vector3d center = getBoundingCenter(bbox); double radius = getBoundingRadius(bbox); - + Vector3d cameradir(1, 1, -0.5); Vector3d camerapos = center - radius*2*cameradir; csgInfo.glview->setCamera(camerapos, center); - - + + csgInfo.glview->setRenderer(&cgalRenderer); csgInfo.glview->paintGL(); csgInfo.glview->save(outfile); - + delete root_node; delete root_module; diff --git a/tests/cgalstlsanitytest.cc b/tests/cgalstlsanitytest.cc index 137f626..52cfb41 100644 --- a/tests/cgalstlsanitytest.cc +++ b/tests/cgalstlsanitytest.cc @@ -129,7 +129,7 @@ int main(int argc, char **argv) CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node); current_path(original_path); - if (!N.empty()) { + if (!N.isNull()) { std::ofstream outfile; outfile.open(outfilename); diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index e4761db..b546286 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -122,7 +122,7 @@ int main(int argc, char **argv) CGAL_Nef_polyhedron N = cgalevaluator.evaluateCGALMesh(*root_node); current_path(original_path); - if (!N.empty()) { + if (!N.isNull()) { export_stl(&N, std::cout); } -- cgit v0.10.1 From 7defd5d5a978e647d6e6b61e4190f3d9b60c0cc7 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 8 Jan 2013 13:34:22 -0500 Subject: sync diff --git a/doc/TODO.txt b/doc/TODO.txt index be70c26..44b11ad 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -135,6 +135,7 @@ o Hollow donut problem rendering keeps the hole, but renders slightly incorrect. o CGAL issues - CGAL doesn't handle almost planar polygons. Consider splitting into triangles ourselves. See WillamAdams/dodec.scad +o Look at the EPEC kernel for improved performance (suggested by Giles) LANGUAGE && BUILTINS -------------------- -- cgit v0.10.1 From cd152aaefcc8d8e118be4249291863182711cc45 Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 8 Jan 2013 21:35:36 -0600 Subject: add to acknowledgements diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 371ea46..bb48f6c 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -109,12 +109,12 @@ Please visit this link for a copy of the license: Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at> +Copyright (C) 2009-2013 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>

    @@ -105,7 +105,7 @@ Please visit this link for a copy of the license: 0: + if user_name is None: + # Read username if not specified or loaded from svn config, or on + # subsequent tries. + sys.stdout.write('Please enter your googlecode.com username: ') + sys.stdout.flush() + user_name = sys.stdin.readline().rstrip() + if password is None: + # Read password if not loaded from svn config, or on subsequent tries. + print 'Please enter your googlecode.com password.' + print '** Note that this is NOT your Gmail account password! **' + print 'It is the password you use to access Subversion repositories,' + print 'and can be found here: http://code.google.com/hosting/settings' + password = getpass.getpass() + + status, reason, url = upload(file_path, project_name, user_name, password, + summary, labels) + # Returns 403 Forbidden instead of 401 Unauthorized for bad + # credentials as of 2007-07-17. + if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: + # Rest for another try. + user_name = password = None + tries = tries - 1 + else: + # We're done. + break + + return status, reason, url + + +def main(): + parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' + '-p PROJECT [options] FILE') + parser.add_option('-s', '--summary', dest='summary', + help='Short description of the file') + parser.add_option('-p', '--project', dest='project', + help='Google Code project name') + parser.add_option('-u', '--user', dest='user', + help='Your Google Code username') + parser.add_option('-w', '--password', dest='password', + help='Your Google Code password') + parser.add_option('-l', '--labels', dest='labels', + help='An optional list of comma-separated labels to attach ' + 'to the file') + + options, args = parser.parse_args() + + if not options.summary: + parser.error('File summary is missing.') + elif not options.project: + parser.error('Project name is missing.') + elif len(args) < 1: + parser.error('File to upload not provided.') + elif len(args) > 1: + parser.error('Only one file may be specified.') + + file_path = args[0] + + if options.labels: + labels = options.labels.split(',') + else: + labels = None + + status, reason, url = upload_find_auth(file_path, options.project, + options.summary, labels, + options.user, options.password) + if url: + print 'The file was uploaded successfully.' + print 'URL: %s' % url + return 0 + else: + print 'An error occurred. Your file was not uploaded.' + print 'Google Code upload server said: %s (%s)' % (reason, status) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) -- cgit v0.10.1 From 8d23b5b07b0fcc9a2c75db85954bb32dc57fc6e9 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 9 Jan 2013 19:56:56 -0600 Subject: dont crash if there's no .netrc file. add security notice. discourage .netrc use. diff --git a/scripts/googlecode_upload.py b/scripts/googlecode_upload.py index 5e25feb..375d7aa 100644 --- a/scripts/googlecode_upload.py +++ b/scripts/googlecode_upload.py @@ -4,27 +4,35 @@ # OpenSCAD Usage: # # 1. get a google account, get it added to the Google Code OpenSCAD project -# 2. go to https://code.google.com/hosting/settings to find your password +# 2. go to https://code.google.com/hosting/settings for username & password # ----- # # security note - # -# dont use the ~/.netrc file to store your password -# keep your password secret +# it's not advisable to use a ~/.netrc file to store your password +# keep your googlecode password secret # only upload from a secure machine # user's personal data can be at risk if your account -# is compromised and a fake openscad were to be uploaded -# +# is compromised and a fake openscad were to be uploaded. +# notify the OpenSCAD maintainer if your computer is stolen or +# your google account is ever compromised. # ----- # 4. if you are making a Stable Release, check 'docs/release_checklist.txt' # 5. create an OpenSCAD package (linux dev snapshot: ./scripts/release-common.sh) # 6. Run this to do the upload: # export SUMMARY="Linux x86-64 Snapshot" # replace as appropriate # export PACKAGEFILE=openscad-2013.01.10.x86-64.tar.gz # replace as appropriate -# python ./scripts/googlecode_upload.py -s $SUMMARY -p openscad $PACKAGEFILE -# 7. Wait.... (there is no progress meter). It should say 'success' eventually. +# python ./scripts/googlecode_upload.py -s '$SUMMARY' -p openscad $PACKAGEFILE +# 7. It will ask for username. Use user.name@gmail.com (include the @ mail address) +# 8. It will ask for password. Copy/paste the password from the https google code settings page above +# Don't use the big bold password, use the 'plain font' password from the 'machine' line +# 9. Wait.... (there is no progress meter). It should say 'success' eventually. # -# The rest of this file is original from Google. +# The rest of this file is original from Google with slight modifications by the +# OpenSCAD team. Modifications licensed under the same license as the +# original code from google - the Apache Software License 2.0: +# http://www.apache.org/licenses/LICENSE-2.0 + # # Copyright 2006, 2007 Google Inc. All Rights Reserved. @@ -196,7 +204,11 @@ def upload_find_auth(file_path, project_name, summary, labels=None, """ if user_name is None or password is None: from netrc import netrc - authenticators = netrc().authenticators("code.google.com") + authenticators = None + try: + authenticators = netrc().authenticators("code.google.com") + except: + print "Error accessing netrc authenticator. Trying alternate method" if authenticators: if user_name is None: user_name = authenticators[0] -- cgit v0.10.1 From 51d8350113ece0d80ae92aeec1d9f99ac5021b65 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 11 Jan 2013 15:43:09 -0500 Subject: Added hashbang diff --git a/scripts/googlecode_upload.py b/scripts/googlecode_upload.py old mode 100644 new mode 100755 index 375d7aa..188dd6c --- a/scripts/googlecode_upload.py +++ b/scripts/googlecode_upload.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Google Code binary package uploader # with Insturctions for uploading packages for OpenSCAD # -- cgit v0.10.1 From a1da6b2aded1c930a5ffdb5ecdbee708aefea243 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 13 Jan 2013 13:46:36 -0500 Subject: Moved Mac download site from github to google code diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt index e85e97c..cc85009 100644 --- a/doc/release-checklist.txt +++ b/doc/release-checklist.txt @@ -43,9 +43,15 @@ o Remove VERSION environment variable o git push --tags o Upload - - Github - Upload manually here: https://github.com/openscad/openscad/downloads - FIXME: Write a script + - Source: + scripts/googlecode_upload.py -s 'Source Code' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,Type-Source openscad-$VERSION.src.tar.gz + - Linux: + scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-32.tar.gz + scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-64.tar.gz + - Windows: + scripts/googlecode_upload.py -s 'Windows Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Windows,Type-Archive OpenSCAD-$VERSION.zip + scripts/googlecode_upload.py -s 'Windows Installer' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Windows,Type-Installer OpenSCAD-$VERSION-Installer.exe + - Mac: Already done by public-macosx.sh o Update web page o Write email to mailing list diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index a2ded8a..b0cf3a5 100755 --- a/scripts/publish-macosx.sh +++ b/scripts/publish-macosx.sh @@ -6,6 +6,7 @@ if test -z "$VERSION"; then VERSION=`date "+%Y.%m.%d"` COMMIT=-c + SNAPSHOT=true fi # Turn off ccache, just for safety @@ -24,10 +25,11 @@ echo "Sanity check of the app bundle..." if [[ $? != 0 ]]; then exit 1 fi -cp OpenSCAD-$VERSION.dmg ~/Dropbox/Public -ln -sf OpenSCAD-$VERSION.dmg ~/Dropbox/Public/OpenSCAD-latest.dmg -echo "Upload in progress..." +echo "Uploading..." +LABELS=OpSys-OSX,Type-Executable +if ! $SNAPSHOT; then LABELS=$LABELS,Featured; fi +`dirname $0`/googlecode_upload.py -s 'Mac OS X Snapshot' -p openscad OpenSCAD-$VERSION.dmg -l $LABELS # Update snapshot filename on wab page `dirname $0`/update-web.sh OpenSCAD-$VERSION.dmg -- cgit v0.10.1 From db8d8919433cc68ee777fcfc3199448419733c92 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 13 Jan 2013 18:28:13 -0500 Subject: bugfix: Wrong slot names for OpenCSG warning dialog diff --git a/src/OpenCSGWarningDialog.cc b/src/OpenCSGWarningDialog.cc index 5648576..926a55b 100644 --- a/src/OpenCSGWarningDialog.cc +++ b/src/OpenCSGWarningDialog.cc @@ -8,12 +8,12 @@ OpenCSGWarningDialog::OpenCSGWarningDialog(QWidget*) connect(this->showBox, SIGNAL(toggled(bool)), Preferences::inst()->openCSGWarningBox, SLOT(setChecked(bool))); connect(this->showBox, SIGNAL(toggled(bool)), - Preferences::inst(), SLOT(openCSGWarningChanged(bool))); + Preferences::inst(), SLOT(on_openCSGWarningBox_toggled(bool))); connect(this->enableOpenCSGBox, SIGNAL(toggled(bool)), Preferences::inst()->enableOpenCSGBox, SLOT(setChecked(bool))); connect(this->enableOpenCSGBox, SIGNAL(toggled(bool)), - Preferences::inst(), SLOT(enableOpenCSGChanged(bool))); + Preferences::inst(), SLOT(on_enableOpenCSGBox_toggled(bool))); } void OpenCSGWarningDialog::setText(const QString &text) -- cgit v0.10.1 From 5639fdba23559d0c14fd8d5245992dae406ec1a7 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 14 Jan 2013 21:23:10 -0500 Subject: sync diff --git a/doc/TODO.txt b/doc/TODO.txt index 44b11ad..62db614 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -113,6 +113,7 @@ o Misc for confirmation. - Go through keyboard shortcuts and make them more conformant to platform standards - Show design info/stats (sizes, caches etc.) + - Support Voice Over and related technologies for vision-impaired users o Cmd-line - Add verbose option (PRINT command from mainwin.cc and progress output) -- cgit v0.10.1 From 1d8c634663a8d6b99bf6b4c6466a5d2d654504b3 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 14 Jan 2013 21:23:40 -0500 Subject: Reorganized section for building binaries diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt index cc85009..93780df 100644 --- a/doc/release-checklist.txt +++ b/doc/release-checklist.txt @@ -1,6 +1,8 @@ OpenSCAD Release Checklist -------------------------- +(See bottom of this file for how to build release binaries) + o Update VERSION environment variable export VERSION=2012.08 @@ -19,22 +21,7 @@ o Tag release o build source package scripts/git-archive-all.py --prefix=openscad-$VERSION/ openscad-$VERSION.src.tar.gz -o build binaries - tar xzf openscad-$VERSION.src.tar.gz - cd openscad-$VERSION - Mac OS X - (For Qt-4.7.3: Remove /Developers/Applications/Qt/plugins/qmltooling) - ./scripts/publish-macosx.sh -> OpenSCAD-$VERSION.dmg - Linux: - 32-bit: run on a 32-bit machine or VM - 64-bit: run on a 64-bit machine or VM - ./scripts/release-common.sh -> openscad-$VERSION.x86-ARCH.tar.gz - (where ARCH will be detected and set to 32 or 64) - Windows mingw cross-build: FIXME 32 vs. 64 bit - ./scripts/publish-mingw-x.sh -> mingw32/Openscad-$VERSION.zip - -> mingw32/Openscad-$VERSION-Installer.exe - -o FIXME: Run some tests +o Sanity check; build a binary or two and manually run some tests o Remove VERSION environment variable @@ -42,16 +29,8 @@ o Remove VERSION environment variable o git push --tags -o Upload - - Source: - scripts/googlecode_upload.py -s 'Source Code' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,Type-Source openscad-$VERSION.src.tar.gz - - Linux: - scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-32.tar.gz - scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-64.tar.gz - - Windows: - scripts/googlecode_upload.py -s 'Windows Binaries' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Windows,Type-Archive OpenSCAD-$VERSION.zip - scripts/googlecode_upload.py -s 'Windows Installer' -p openscad OpenSCAD-2013.01.08.dmg -l Featured,OpSys-Windows,Type-Installer OpenSCAD-$VERSION-Installer.exe - - Mac: Already done by public-macosx.sh +o Upload Source package + $ ./scripts/googlecode_upload.py -s 'Source Code' -p openscad openscad-$VERSION.src.tar.gz -l Featured,Type-Source openscad-$VERSION.src.tar.gz o Update web page o Write email to mailing list @@ -59,3 +38,33 @@ o Update external resources: - http://en.wikipedia.org/wiki/OpenSCAD o Notify package managers - Ubuntu: https://launchpad.net/~chrysn + - MacPorts: + + +Build and Upload Release Binaries +--------------------------------- + +$ export VERSION= +$ tar xzf openscad-$VERSION.src.tar.gz +$ cd openscad-$VERSION + +Mac OS X: + + $ ./scripts/publish-macosx.sh -> OpenSCAD-$VERSION.dmg + +Linux: + 32-bit: run on a 32-bit machine or VM + 64-bit: run on a 64-bit machine or VM + + $ ./scripts/release-common.sh -> openscad-$VERSION.x86-ARCH.tar.gz + (where ARCH will be detected and set to 32 or 64) + $ ./scripts/googlecode_upload.py -s 'Linux Binaries' -p openscad openscad-$VERSION.x86-ARCH.tar.gz -l Featured,OpSys-Linux,Type-Archive openscad-$VERSION.x86-ARCH.tar.gz + o Update web page with download links + +Windows mingw cross-build: FIXME 32 vs. 64 bit + + $ ./scripts/publish-mingw-x.sh -> mingw32/Openscad-$VERSION.zip + -> mingw32/Openscad-$VERSION-Installer.exe + $ ./scripts/googlecode_upload.py -s 'Windows Binaries' -p openscad OpenSCAD-$VERSION.zip -l Featured,OpSys-Windows,Type-Archive OpenSCAD-$VERSION.zip + $ ./scripts/googlecode_upload.py -s 'Windows Installer' -p openscad OpenSCAD-$VERSION-Installer.exe -l Featured,OpSys-Windows,Type-Installer OpenSCAD-$VERSION-Installer.exe + o Update web page with download links -- cgit v0.10.1 From 3d36baed60b340b508c0963d94eb011ddeefa02b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 15 Jan 2013 19:06:02 -0500 Subject: Updated RELEASE_NOTES diff --git a/RELEASE_NOTES b/RELEASE_NOTES index f629cd6..4448e89 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,4 +1,4 @@ -OpenSCAD 2012.11 +OpenSCAD 2013.01 ================ Features: @@ -26,6 +26,8 @@ o cmd-line overrides using -D now also work for USEd modules o Modifier characters can now be used in front of if statements o rotate() with a vector argument with less that 3 elements used uninitialized variables, ending up being non-deterministic. o .csg files will now have relative filenames whenever possible +o Don't just ignore geometric nodes having zero volume/area - when doing difference/intersection, they tend to turn negative objects into positive ones. +o Always use utf-8 file encoding, also under Windows o A lot of build script fixes o Some other crash bugs fixes -- cgit v0.10.1 From 7ea7ea9aee398b3ed63a9ec2b155fe154eb9ba54 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 16 Jan 2013 14:59:45 -0500 Subject: Linux build fix: qmake exists() was using the variable name instead of its contents diff --git a/eigen.pri b/eigen.pri index efb2d3c..0ee551c 100644 --- a/eigen.pri +++ b/eigen.pri @@ -51,7 +51,7 @@ isEmpty(EIGEN_INCLUDEPATH) { netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen3 linux*|hurd*|unix: EIGEN_INCLUDEPATH = /usr/include/eigen3 macx: EIGEN_INCLUDEPATH = /opt/local/include/eigen3 - !exists(EIGEN_INCLUDEPATH) { + !exists($$EIGEN_INCLUDEPATH) { freebsd-g++: EIGEN_INCLUDEPATH = /usr/local/include/eigen2 netbsd*: EIGEN_INCLUDEPATH = /usr/pkg/include/eigen2 linux*|hurd*|unix*: EIGEN_INCLUDEPATH = /usr/include/eigen2 -- cgit v0.10.1 From 202c57773e378ce092243f8803032564d9103023 Mon Sep 17 00:00:00 2001 From: don bright Date: Thu, 17 Jan 2013 03:51:33 +0100 Subject: allow dxf deps writing diff --git a/src/openscad.cc b/src/openscad.cc index df7adb3..472b5d4 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -304,8 +304,19 @@ int main(int argc, char **argv) fs::current_path(original_path); if (deps_output_file) { - if (!write_deps(deps_output_file, - stl_output_file ? stl_output_file : off_output_file)) { + std::string deps_out( deps_output_file ); + std::string geom_out; + if ( stl_output_file ) geom_out = std::string(stl_output_file); + else if ( off_output_file ) geom_out = std::string(off_output_file); + else if ( dxf_output_file ) geom_out = std::string(dxf_output_file); + else { + PRINTB("Output file:%s\n",output_file); + PRINT("Sorry, don't know how to write deps for that file type. Exiting\n"); + exit(1); + } + int result = write_deps( deps_out, geom_out ); + if ( !result ) { + PRINT("error writing deps"); exit(1); } } -- cgit v0.10.1