Skip to content

Instantly share code, notes, and snippets.

@crucialfelix
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crucialfelix/4044b265f8549b68ecda to your computer and use it in GitHub Desktop.
Save crucialfelix/4044b265f8549b68ecda to your computer and use it in GitHub Desktop.
WIP homebrew formula to build supercollider latest version
class Supercollider < Formula
homepage "https://supercollider.github.io"
url "https://github.com/supercollider/supercollider.git", :using => :git
depends_on :xcode => :build
depends_on :macos => :lion
depends_on "cmake" => :build
depends_on "qt5" => :build
depends_on "readline" => :build
version "3.7-devel"
def install
ENV.deparallelize
bp = buildpath/"build"
mkdir_p bp
# std_cmake_args +
args = [
"-G", "Xcode",
"-DCMAKE_PREFIX_PATH=#{Formula['qt5'].opt_prefix}",
"-DSC_QT=1",
# defaults to the user's OS
# "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7",
"-DREADLINE_INCLUDE_DIR=#{Formula['readline'].opt_include}",
"-DREADLINE_LIBRARY=#{Formula['readline'].opt_lib}/libreadline.dylib",
".."
]
cd bp do
system "cmake", *args
xcodebuild "-target", "install"
end
# Copy the app into the cellar
# User should then run `brew linkapps supercollider`
# to install it into /Applications
cp_r "./build/Install/SuperCollider/SuperCollider.app", prefix/"SuperCollider.app"
# Install sclang and scsynth binaries.
# sclang and scsynth need to be executed in the bundle
# or the dynamic linking to the Qt libraries gets confused.
# write_exec_script creates a wrapper to exec it
bin.write_exec_script prefix/"SuperCollider.app/Contents/MacOS/sclang"
bin.write_exec_script prefix/"SuperCollider.app/Contents/MacOS/scsynth"
end
test do
# `test do` will create, run in and delete a temporary directory.
assert File.exist?("#{prefix}/SuperCollider.app")
assert File.exist?("#{bin}/sclang")
assert File.exist?("#{bin}/scsynth")
# when -V is implemented in sclang then we can run the process
# system "#{bin}/sclang", "-V"
end
end
@bagong
Copy link

bagong commented Mar 10, 2015

Current master still requires qt4. So changing that in line 19 and changing line 31 to:
"-DCMAKE_PREFIX_PATH=#{Formula['qt4'].prefix}"
should make it work. I also changed line 30 to:
"-DREADLINE_LIBRARY=#{Formula['readline'].opt_lib}/libreadline.dylib",
and added
"-DCMAKE_BUILD_TYPE=Release",
and removed line 20 - which I am not sure about as 3.7 does not build on 10.6 any more.
Not sure if those later three are required, but it built successfully for me with those changes.

If you use:
brew install supercollider --verbose --debug
you'll get cmake output to stdout and some options when the build fails...
Best
.r.

@bagong
Copy link

bagong commented Mar 12, 2015

Since qt5 was merged brew-readline is found automatically. The only required cmake-argument remains:
"-DCMAKE_PREFIX_PATH=#{Formula['qt5'].prefix}"
Best
.r.

@crucialfelix
Copy link
Author

I didn't see your comments before. thanks ! I did realize shortly afterwards that qt5 wasn't in master yet.

updated the gist. this works now.

@crucialfelix
Copy link
Author

It seemed to find readline on its own. It would be safer to specify it though.

it defaulted to Release already. -DCMAKE_BUILD_TYPE=Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment