Permalink
Browse files

Add Zlib 1.2.7 recipe

  • Loading branch information...
1 parent 339ddd9 commit 212c4d4ea4d8afc1a84737c0420cd7525f00db9d @luislavena luislavena committed May 20, 2012
Showing with 34 additions and 0 deletions.
  1. +34 −0 zlib/zlib-1.2.7.knapfile
@@ -0,0 +1,34 @@
+recipe "zlib", "1.2.7" do
+ use :autotools
+
+ fetch "http://distfiles.openknapsack.org/#{name}/#{name}-#{version}.tar.bz2",
+ :md5 => "2ab442d169156f34c379c968f3f482dd"
+
+ action :configure do
+ if platform.mingw?
+ # win32/Makefile.gcc needs to be adjusted
+ options.makefile = "win32/Makefile.gcc"
+ work_makefile = work_path(options.makefile)
+ mk = File.read work_makefile
+ File.open work_makefile, "wb" do |f|
+ f.puts "BINARY_PATH = #{install_path('bin')}"
+ f.puts "INCLUDE_PATH = #{install_path('include')}"
+ f.puts "LIBRARY_PATH = #{install_path('lib')}"
+
+ # TODO: change PREFIX if cross-compiling
+ unless platform.native?
+ mg.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{platform.host}-")
+ end
+
+ # enable shared object
+ mk.sub!(/^SHARED_MODE\s*=\d*$/, "SHARED_MODE = 1")
+
+ # write the original Makefile content
+ f.puts mk
+ end
+ else
+ # run will chdir into work_path prior executing the command
+ run "sh configure --prefix=#{install_path}"
+ end
+ end
+end

0 comments on commit 212c4d4

Please sign in to comment.