Skip to content

Instantly share code, notes, and snippets.

@ArrEssJay
Last active August 15, 2018 00:47
Show Gist options
  • Save ArrEssJay/535373827ed4418e58160298252ffc34 to your computer and use it in GitHub Desktop.
Save ArrEssJay/535373827ed4418e58160298252ffc34 to your computer and use it in GitHub Desktop.
Survex Homebrew Formula
class Survex < Formula
desc "Cave Surveying Tool"
homepage "https://www.survex.com"
url "https://survex.com/software/1.2.36/survex-1.2.36.tar.gz"
sha256 "8781f33daf61c5d22e52400e6130e66a1fec7557cf9aa793d0e26e9b37204ed0"
revision 4
depends_on "wxmac"
depends_on "proj"
depends_on "ffmpeg"
depends_on "gettext" => :build
depends_on "pkg-config" => :build
def install
system "./configure", "--prefix=#{prefix}",
"--bindir=#{bin}",
"--mandir=#{man}",
"--docdir=#{doc}",
"--datadir=#{share}"
system "make"
system "make", "install"
# Create and populate Aven.app
system "make", "create-aven-app", "APP_PATH=Aven.app"
ln_s ["#{bin}/aven", "#{bin}/cavern", "#{bin}/extend"], "Aven.app/Contents/MacOS"
prefix.install "Aven.app"
end
def caveats; <<~EOS
Aven.app has been installed into #{prefix}. It can be manually linked into
the 'Applications' folder by running:
ln -s #{prefix}/Aven.app /Applications/Aven.app
EOS
end
test do
(testpath/"test.svx").write <<~EOS
*begin test
*cs custom "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs"
*cs out custom "+proj=utm +zone=56 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
*fix 0 150.020166 -33.815585 812
0 1 10 - DOWN
*end test
EOS
pos = <<~EOS
( Easting, Northing, Altitude )
(224177.87, 6254297.49, 812.00 ) test.0
(224177.87, 6254297.49, 802.00 ) test.1
EOS
system "#{bin}/cavern", (testpath/"test.svx")
ENV["LC_MESSAGES"] = "C"
system "#{bin}/survexport", (testpath/"test.3d"), (testpath/"test.pos")
File.open(testpath/"test.pos", "r") { |f| assert_equal f.read, pos }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment