-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathkicad.rb
91 lines (75 loc) · 2.7 KB
/
kicad.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require 'formula'
class KicadLibrary < Formula
homepage 'https://code.launchpad.net/~kicad-lib-committers/kicad/library'
url 'https://code.launchpad.net/~kicad-lib-committers/kicad/library', :using => :bzr
version 'HEAD'
def initialize; super 'kicad-library'; end
end
class Kicad < Formula
homepage 'https://launchpad.net/kicad'
url "http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/", :revision => '3920', :using => :bzr
head "http://bazaar.launchpad.net/~kicad-testing-committers/kicad/testing/", :using => :bzr
version 'testing-3920'
depends_on 'bazaar'
depends_on 'cmake' => :build
depends_on :x11
depends_on 'Wxmac'
def patches
[
# fixes wx-config not requiring aui module
"https://gist.github.com/raw/4602653/0e4397884062c8fc44a9627e78fb4d2af20eed5b/gistfile1.txt",
# enable retina display for OSX
"https://gist.github.com/raw/4602849/2fe826c13992c4238a0462c03138f4c6aabd4968/gistfile1.txt"
]
end
def install
# install the component libraries
KicadLibrary.new.brew do
args = std_cmake_args + %W[
-DKICAD_MODULES=#{share}/kicad/modules
-DKICAD_LIBRARY=#{share}/kicad/library
-DKICAD_TEMPLATES=#{share}/kicad/template
]
system "cmake", ".", *args
system "make install"
end
if build.devel?
args = std_cmake_args + %W[
-DKICAD_TESTING_VERSION=ON
-DCMAKE_CXX_FLAGS=-D__ASSERTMACROS__
]
else
args = std_cmake_args + %W[
-DKICAD_STABLE_VERSION=ON
-DCMAKE_CXX_FLAGS=-D__ASSERTMACROS__
]
end
system "cmake", ".", *args
# fix the osx search path for the library components to the homebrew directory
inreplace 'common/edaappl.cpp','/Library/Application Support/kicad', "#{HOMEBREW_PREFIX}/share/kicad"
system "make install"
end
def caveats; <<-EOS.undent
kicad.app and friends installed to:
#{bin}
If you get "bzr: ERROR: unknown command "patch"" error, then you should probably install bzrtools:
wget -O /tmp/bzrtools.tar.gz http://launchpad.net/bzrtools/stable/2.5/+download/bzrtools-2.5.tar.gz
mkdir -p ~/.bazaar/plugins/
tar zxf /tmp/bzrtools.tar.gz -C ~/.bazaar/plugins/
To link the application to a normal Mac OS X location:
brew linkapps
or:
ln -s #{bin}/bitmap2component.app /Applications
ln -s #{bin}/cvpcb.app /Applications
ln -s #{bin}/eeschema.app /Applications
ln -s #{bin}/gerbview.app /Applications
ln -s #{bin}/kicad.app /Applications
ln -s #{bin}/pcb_calculation.app /Applications
ln -s #{bin}/pcbnew.app /Applications
EOS
end
def test
# run main kicad UI
system "open #{bin}/kicad.app"
end
end