-
-
Save EconGeo/52ec94c1b4afc157ca54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Osrm < Formula | |
head 'https://github.com/DennisOSRM/Project-OSRM', :using => :git | |
homepage 'https://github.com/DennisOSRM/Project-OSRM' | |
depends_on 'protobuf' | |
depends_on 'boost' | |
depends_on 'libzip' | |
depends_on 'libstxxl' | |
depends_on 'osm-pbf' | |
def glob s | |
s.split.map { |t| Dir.glob(t)*' ' }*' ' | |
end | |
def options | |
[ | |
['--build-debug', 'Build debug version.'], | |
] | |
end | |
def install | |
if ARGV.include? '--build-debug' | |
opt = '-Wall -g3' | |
else | |
opt = '-O3 -DNDEBUG' | |
end | |
protobuf_prefix = Formula.factory('protobuf').prefix | |
protobuf = "-I#{protobuf_prefix}/include -L#{protobuf_prefix}/lib -lprotobuf" | |
stxxl_prefix = Formula.factory('libstxxl').prefix | |
stxxl = "-I#{stxxl_prefix}/include -L#{stxxl_prefix}/lib -lstxxl" | |
boost_prefix = `brew --prefix boost`.strip # for some reason, Formula.factory('boost').prefix returns /usr/local/Cellar/boost/HEAD | |
boost = "-L#{boost_prefix}/lib -lboost_system-mt -lboost_thread-mt -lboost_regex-mt -lboost_filesystem-mt" | |
osm_pbf_prefix = Formula.factory('osm-pbf').prefix | |
osm_pbf = "-L#{osm_pbf_prefix}/lib -losmpbf" | |
xml2 = "-I/usr/include/libxml2 -lxml2" | |
bz = "-lbz2 -lz" | |
png = "-I/usr/X11/include -L/usr/X11/lib -lpng" | |
system [ENV.cxx, '-o osrm-extract', glob('extractor.cpp'), stxxl, xml2, boost, bz,osm_pbf,protobuf, opt]*' ' | |
system [ENV.cxx, '-o osrm-prepare', glob('createHierarchy.cpp Contractor/*.cpp Algorithms/*.cpp'), stxxl, xml2, boost, opt]*' ' | |
system [ENV.cxx, '-o osrm-routed', glob('routed.cpp Descriptors/DescriptionFactory.cpp ThirdParty/*.cc Server/DataStructures/*.cpp'), stxxl, xml2, boost, bz, png, opt]*' ' | |
bin.install ['osrm-extract','osrm-prepare','osrm-routed'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment