Mandelbulber for mac

From VoidWarranties - Hackerspace Antwerp, Belgium
Revision as of 13:14, 19 December 2014 by Bermarte (Talk | contribs)
Jump to: navigation, search


Mandelbulber for mac
What:
from http://sourceforge.net/projects/mandelbulber/

"Mandelbulber is an easy to use, handy but experimental application designed to help you render 3D Mandelbrot fractals called Mandelbulb and some other kind of 3D fractals like Mandelbox, Bulbbox, Juliabulb, Menger Sponge"

Mandelbulber small.jpg
Participants:
Bermarte
Category:
Misc
Locations:
Den Bunker, Terra

Hallo! these are a few links that may explain a bit what is it all about: http://www.mandelbulber.com/ https://sites.google.com/site/mandelbulber/

I would like to build version 1.12.1 and version 1.13 and a version using openCL (https://mandelbulber.googlecode.com/files/mandelbulber1.09_opencl.orig.tar.gz). At the moment I don't have a mac ): so I hope somebody will help me to continue to distribute this software. Anyway one can download versions for OS 10.4 (powerPC and intel) and versions for 32/64 bit for OS 10.5+..my latest version is here: http://sourceforge.net/projects/mandelbulber/files/mandelbulber-mac-1.12.zip/download.

I usually use macports to create the libs (GTK2) that are necessary to build mandelbulber, but it would be nice to create a proper bundle (maybe using GTK+ http://www.gtk.org/download/macos.php). Latest thing: even if not really necessary it would be nice to create a port for mac ports.


Trip to center of hybrid fractal

So far I was not able to upload the binary to sourceforge nor I know if I will be able to do it in the future.It was possible to build a GTK version without X11. Jhbuild and GTK-OSX were used to build mandelbulber 1.16, gtk-mac-bundler was used to create a bundle for it. https://wiki.gnome.org/GTK%2B/OSX/Building https://wiki.gnome.org/GTK%2B/OSX/Bundling

Once jhbuild and gtk are installed, before I build, I set things this way using terminal:
PATH=~/gtk/inst/bin:~/bin:$PATH
export CPFLAGS="-I$HOME/gtk/inst/include"
export LDFLAGS="-L$HOME/gtk/inst/lib"

my own objects.mk file is
LIBS := -lgthread-2.0 -lglib-2.0 -lgtk-quartz-2.0 -lgdk-quartz-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lgthread-2.0 -lglib-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lpng -ljpeg -lgobject-2.0
It could be necessary to omit the brackets of "mandelbulber" when building using terminal (see makefile); this is not the case when you are using gcc 4.8+; this means that probably you compiled and installed yourself a more recent version of the one provided by Apple.
To create the app.bundle, once the binary is inside ~/gtk/bin I just do:
~/.local/bin/jhbuild shell
cd ~/.local/bin
./gtk-mac-bundler /Users/bermarte/mandelbulber.bundle

this is a pretty standard mandelbulber.bundle:


<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<app-bundle>

  <meta>
    <!-- Where to pick up the GTK+ installation, icon themes,
         etc. Note that "${env:JHBUILD_PREFIX}" is evaluated to the
         value of the environment variable JHBUILD_PREFIX. You can
         define additional prefixes and refer to them in paths
         throughout this file on the form "${prefix:name}". This is
         useful for installing certain libraries or even the
         application itself separately. Note that JHBUILD_PREFIX is
         defined by jhbuild, so it you are not using jhbuild you can
         either define your own or just hardcode the path here.
    -->
    <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
    <!--example of prefix: <prefix name="stuff">/Extra/mandelbulber_GTK/inst</prefix>-->
    <!-- The project directory is the default location of the created
         app. If you leave out the path, the current directory is
         used. Note the usage of an environment variable here again.
    -->
    <destination overwrite="yes">${env:HOME}/Desktop</destination>

    <image>
      <!-- Not implemented yet (DMG image). -->
    </image>

    <!-- Comment this out to keep the install names in binaries -->
    <run-install-name-tool/>
 
    <!-- Optionally specify a launcher script to use. If the
         application sets up everything needed itself, like
         environment variable, linker paths, etc, a launcher script is
         not needed. If the source path is left out, the default
         script will be used.
    -->
    <launcher-script>${project}/launcher.sh</launcher-script >

    <!-- Not implemented: Optional runtime, could be python or mono
         for example.
    -->
    <!-- runtime copy="yes">/usr/bin/python</runtime -->
    <!-- Indicate the active gtk version to use. This is needed only
         for gtk+-3.0 projects. -->
    <gtk>gtk+-2.0</gtk>
  </meta>

  <!-- The special macro "${project}" refers to the directory where
       this bundle file is located. The application name and bundle
       identifier are taken from the plist file.
  -->
  <plist>${project}/mandelbulber.plist</plist>

 <main-binary>${prefix}/bin/mandelbulber</main-binary>
  
  <!-- Copy in GTK+ modules.  Note the ${gtkdir} macro, which expands
       to the correct library subdirectory for the specified gtk
       version.
  -->

  <binary>
    ${prefix}/lib/libfreetype.6.dylib
  </binary>

  <binary>
     ${prefix}/lib/${gtkdir}/modules/*.so
  </binary>
  <!-- Copy in GTK+ theme engines and print backends. Note the use of the
       "${pkg:module:variable}" macro, which evaluates to a pkg-config
       variable in the specified module. Note that any libraries that
       binaries link to are also copied in automatically.  Note also
       the included ${gtk} macro, which gets the correct package name
       to get. -->
  <binary>
    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so
  </binary>
  

  <binary>
    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
  </binary>

<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
  <binary>
    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:${gtk}:gtk_binary_version}/loaders/*.so
  </binary>

   <binary>
    ${prefix}/lib/pango/${pkg:pango:pango_module_version}/modules/*.so
  </binary>

  <!--
  <binary>
     ${prefix:stuff}/lib
  </binary>
  -->
  <!--
  <data>
    ${prefix}/etc/pango/
   </data>
  -->

 <!-- Translation filenames, one for each program or library that you
       want to copy in to the bundle. The "dest" attribute is
       optional, as usual. Bundler will find all translations of that
       library/program under the indicated directory and copy them.-->
  <translations name="gtk20">
    ${prefix}/share/locale
  </translations>


  <!-- Data to copy in, usually Glade/UI files, images, sounds files
       etc. The destination inside the bundle can be specified if the
       files should end up at a different location, by using the
       "dest" property. The destination must then start with the macro
       "${bundle}", which refers to the bundle root directory.
  -->
  <!-- data>
    ${prefix}/share/gtk-demo
  </data -->

  <!-- Copy in the themes data. You may want to trim this to save space
       in your bundle. -->
  <data>
    ${prefix}/share/themes
  </data>

  <!-- Copy icons. Note that the .icns file is an Apple format which
       contains up to 4 sizes of icon. You can use
       /Developer/Applications/Utilities/Icon Composer.app to import
       artwork and create the file. >
  -->
  <data dest="${bundle}/Contents/Resources">
    ${project}/mandelbulber.icns
  </data>

  <!-- This is where theme commands go. You can copy them in from your
       theme of choice if they provide and example, or you can just
       change the source path. -->

  <data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc">
    ${project}/gtkrc
  </data>

  <!-- Icon themes to copy. The "icons" property can be either of
       "auto", "all", or "none". All or none should be
       self-explanatory, while auto means that the script will try to
       figure out which icons are needed. This is done by getting all
       the strings from all copied binaries, and matching them against
       icon names. To be safe, you should use "all". "none" is useful
       if you want just the index.theme file but no icons, mostly
       needed for the "hicolor" base theme.
  >
 <icon-theme icons="auto">
    Tango
  </icon-theme -->  
</app-bundle>

Other files, together with the bundler file and in the same location, are needed

mandelbulber.plist<br />
launcher.sh<br />
mandelbulber.icns<br />
gtkrc<br />

this is otool -L mandelbulber's output (The otool command displays libraries used by file):
@executable_path/../Resources/lib/libgthread-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libglib-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libgtk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.16.0)
@executable_path/../Resources/lib/libgdk-quartz-2.0.0.dylib (compatibility version 2401.0.0, current version 2401.16.0)
@executable_path/../Resources/lib/libatk-1.0.0.dylib (compatibility version 20610.0.0, current version 20610.1.0)
@executable_path/../Resources/lib/libgio-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
@executable_path/../Resources/lib/libpangocairo-1.0.0.dylib (compatibility version 3401.0.0, current version 3401.0.0)
@executable_path/../Resources/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 2601.0.0, current version 2601.5.0)
@executable_path/../Resources/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.6.0)
@executable_path/../Resources/lib/libpango-1.0.0.dylib (compatibility version 3401.0.0, current version 3401.0.0)
@executable_path/../Resources/lib/libfreetype.6.dylib (compatibility version 16.0.0, current version 16.0.0)
@executable_path/../Resources/lib/libpng15.15.dylib (compatibility version 29.0.0, current version 29.0.0)
@executable_path/../Resources/lib/libjpeg.8.dylib (compatibility version 13.0.0, current version 13.0.0)
@executable_path/../Resources/lib/libgobject-2.0.0.dylib (compatibility version 3401.0.0, current version 3401.3.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
For OpenCL version, we need to set libraries and headers before launching makefile.Pkg-config's magic always simplify the task of building against GTK+.
PATH=~/gtk/inst/bin:~/bin:$PATH
export LDFLAGS="-L$HOME/gtk/inst/lib -L/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries"
export CPPFLAGS="-I$HOME/gtk/inst/include -I/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers"
in OSX, every time we need to call OpenCL (cl.hpp, cl_support.hpp) we need to set specifically

#include <OpenCL/opencl.h>

while in linux is:

#include <CL/opencl.h>

we need to change the content of objects.mk this way:
LIBS := -framework OpenCL -lgthread-2.0 -lglib-2.0 -lgtk-quartz-2.0 -lgdk-quartz-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lgthread-2.0 -lglib-2.0 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lpng -ljpeg -lgobject-2.0

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Content Creation
Belgian Spaces