Difference between revisions of "Scribus and Homebrew"

From Scribus Wiki
Jump to: navigation, search
m (CRITICAL NOTE)
m (Prerequisites)
Line 38: Line 38:
 
* '''Python (>=v2.7)''' (could possibly work with 2.6 not sure)
 
* '''Python (>=v2.7)''' (could possibly work with 2.6 not sure)
 
* The Cairo dependency may require installing xQuartz (from http://xquartz.macosforge.org/landing/) if you haven't already (Inkscape & Synfig require it)
 
* The Cairo dependency may require installing xQuartz (from http://xquartz.macosforge.org/landing/) if you haven't already (Inkscape & Synfig require it)
 +
<br />
  
 
===Dependencies===
 
===Dependencies===

Revision as of 15:10, 13 June 2014

Announcement: Extremely Experimental OSX Build
Updated 2014/06/13
Any feedback contact: scribusdotuseratgmail
Please follow exact instructions for successful results

Background

Homebrew is a MacOSX Package Manager. Currently it is the younger of the Package Managers available. Other package managers include:

Goal

Essentially by using Homebrew, one can automatically:

  1. download the source code directly from the SVN
  2. download the dependencies Scribus needs to compile
  3. run the compiler on the source with the appropriate flags
  4. generate the Scribus executable
  5. install Scribus executable by placing it in /usr/local/Cellar/ and symlinking it to ~/Applications
  6. rejoice



Prerequisites

  • Make note where you install this because you will need to specify it in the formula below unless it's placed in ~/Qt/5.x.x/
  • Python (>=v2.7) (could possibly work with 2.6 not sure)
  • The Cairo dependency may require installing xQuartz (from http://xquartz.macosforge.org/landing/) if you haven't already (Inkscape & Synfig require it)


Dependencies

v1.5.0svn

Note: OSX 10.6 is for sure not supported because Qt5 will not install on it This formula will install the most basic dependencies (libraries) that Homebrew needs to compile (see below for adding optional dependencies that offer extended functionality). Then it will connect to the SVN and pull whatever the most current source of the Scribus trunk is hence it will build an unstable 1.5.0 release not to be used in a production environment.

CRITICAL NOTE
  1. You'll need to download the latest Qt version from URL highlighted above
  2. install into ~/Qt (~ means home directory, i.e. /Users/<name of you computer>/Qt)

Important: If the Qt version is different than the one in the brew formula: ---->

  1. You'll need to make a Github account
  2. Fork the gist (make a copy of the current formula in to your own gist) in order to customize the Qt path on your cmake line.
  3. Change the Cmake flag to your custom location and version number : "-DQT_PREFIX=/path/to/Qt/x.y.z/clang_64"
    x.y.z indicates the version of Qt
  4. Click on the 'Raw' button to make sure that you are using the 'Raw' version of the gist (without markup)
  5. Then swap out the listed gist in Scribus_and_Homebrew#Invoke_from_Command_Line to the gist that you just made.



Formula

Warning Warning: The following Homebrew formula is extremely experimental (and unstable). Should only be used for testing bleeding edge builds. Not recommended to be used for production purposes. The formula is subject to change and may actually be out of date. In fact it's just here for educational purposes. To use the most up-to-date forumla refer to the instructions below
require 'formula'
 
# TODO
#  Add a patch template to test Scribus patches (https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook#patches)
#  Add Messaging (https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook#messaging)
#  Add the possibility to download only certain languages
 
class ScribusDownloadStrategy < SubversionDownloadStrategy
  def stage
    FileUtils.cp_r @clone.children, '.'
  end
end
 
 
class ScribusDev < Formula
  head 'svn://scribus.net//trunk/Scribus', 
    # use :revision => '######', for downloading a specific revision 
    :using => ScribusDownloadStrategy
  depends_on 'cmake' => :build
  depends_on 'little-cms2'
  # Install Qt5 beforehand and link to it via CMAKE below
  # depends_on 'qt5'
  depends_on 'cairo'
  depends_on 'jpeg'
  depends_on 'libtiff'
  depends_on 'libart'
  depends_on 'fontconfig'
  depends_on 'openssl'
  depends_on 'pkg-config' => :build
  depends_on 'python'
  depends_on 'hunspell'
  # zlib on 10.8.5 is not up to date enough hence the following:
  depends_on 'homebrew/dupes/zlib'
  depends_on 'ghostscript' => :recommended
  depends_on 'graphicsmagick' => :recommended
  depends_on 'boost' => :recommended
  depends_on 'poppler' => :recommended
  # depends_on 'podofo' => :recommended
  depends_on 'freetype' => :recommended
 
   def install
    args = %W[ 
    -DBUILD_OSX_BUNDLE=1
    -DWANT_HUNSPELL=1
    -DCMAKE_INSTALL_PREFIX:PATH=#{prefix}/ScribusDev.app/Contents/
    -DWITH_PODOFO=1
    -DWANT_DEBUG=1
    -DQT_PREFIX=~/Qt/5.3/clang_64
    ]
    # Other Options:
    # Change -DQT_PREFIX=<PATH-TO>/Qt/x.y.z/clang_64 to where you have downloaded it and based on the most current version installed
    # Enable Scripter2 with -DWANT_SCRIPTER2=1
 
    system "cmake", ".", *args                    
    system "make"
    system "make install"
  end
end

Formula Options

These need to be added in to brew formula as options at compile time: ---->

  • PoDoFo (highly recommended) is a library to work with the PDF file format and includes also a few tools.
homebrew: depends_on 'podofo'
cmake: "-DWITH_PODOFO=1" Enable support for PDF embedded in AI import
  • Boost (recommended) is a set of C++ libraries
homebrew: depends_on 'boost'
cmake: "-D?????=1" (Incomplete here)
  • Ghostscript (highly recommended) an interpreter for the PostScript language and for PDF.
homebrew: depends_on 'ghostscript'
  • GraphicsMagick (recommended) to install for ...
homebrew: depends_on 'graphicsmagick'
cmake: "-DWANT_GRAPHICSMAGICK=1'"
  • Hunspell
cmake: "-DWANT_HUNSPELL=1"
  • Scripter2 (experimental and may crash) experimental next gen scribus python script interpreter
cmake: "-DWANT_SCRIPTER2=1"
  • Debugging. If you want to debug the compile process add this to cmake
cmake: "-DWANT_DEBUG=1" for Dev build




Invoke from Command Line

Warning Warning: The following Homebrew formula for Scribus development snapshop testing is extremely experimental (and unstable). Use at your own risk for production purposes. The formula is subject to change.

Invoke with:

  1. Install this temporary patched podofo forumla (based on this issue) brew install https://raw.github.com/MeckiCologne/homebrew/804f42d170ba3a61a124a69c72e3a312e47c4e88/Library/Formula/podofo.rb
  2. brew install -v --HEAD https://gist.githubusercontent.com/luzpaz/9042115/raw/scribus-dev.rb
  3. brew linkapps symbolically linking to /Applications folder

Problems

If installation fails please use: brew gist-logs scribus-dev and submit to the BugTracker.

Debugging Scribus with gdb (GNU Debugger)

In order for us to troubleshoot Scribus problems on MacOS X we need to install the GNU Debugger and invoke Scribus within it. This will generate a backtrace that we can Submit to the BugTracker
Note: The file paths used below assume that you installed via Homebrew Package Manager.

  • Install gdb via: brew install gdb
  • gdb requires that a signed certificate be made
codesign -s gdb-cert /usr/local/Cellar/gdb/7.7.1/bin/gdb
  • Invoke Scribus through gdb with: gdb /usr/local/Cellar/scribus-dev/HEAD/ScribusDev.app/Contents/MacOS/./Scribus
  • What are the commands that need to be used?
bt = backtrace
run = run the program


ToDo

Ordered by priority

  • Clean up formula, does it really need some of the deps like depends_on 'pkg-config' => :build ?
  • Add Homebrew formula jargon to choose optional dependencies at compile time
  • Fix the formula to use home directory (~) instead of current /Users/YourUserName/
  • Mac OS X v10.8 (Mountain Lion) option to compile with Python v3 (in order to use Scripter2(?) FIX: Add "-DWANT_SCRIPTER2=1" to Cmake
  • Circumvent compiling for Mac OS X users by creating a homebrew-cask to distribute the binary directly. (Done)
  • Mac OS X v10.9 (Mavericks) needs someone to test it (Patrice tested on 10.9.2) + add python 3 functionality
  • Mac OS X v10.7 (Lion): need someone to test this + add python 3 functionality
  • Consider submitting bleeding edge nightly to Homebrew or just turn into a gist through Scribus's official Github account
  • Create a stable formula and submit to Homebrew (1.4.x uses Qt4 framework) <-- probably not going to happen


Acknowledgements

  • freenode #scribus MrB, s_uv, a-l-e
  • freenode #machomebrew mistym and durka42

Related


Experimental

Still trying to understand Homebrew's formula syntax based on Homebrew Example Formula

  # The optional devel block is only executed if the user passes `--devel`.
  # Use this to specify a not-yet-released version of a software.
  devel do
   url 'https://example.com/archive-2.0-beta.tar.gz'
   sha1 '1234567890123456789012345678901234567890'
  end
  • Good example of the complex formula Git