Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds the "zookeeper" ruby gem #6

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions ruby-zookeeper/DESCR
@@ -0,0 +1,4 @@
A low-level multi-Ruby wrapper around the ZooKeeper API bindings. For a
friendlier interface, see http://github.com/slyphon/zk. Currently supported:
MRI: {1.8.7, 1.9.2, 1.9.3}, JRuby: ~> 1.6.7, Rubinius: 2.0.testing, REE 1.8.7.

15 changes: 15 additions & 0 deletions ruby-zookeeper/Makefile
@@ -0,0 +1,15 @@
# $NetBSD: Makefile,v 1.37 2013/03/02 20:33:24 wiz Exp $
#
DISTNAME= zookeeper-1.4.6
PKGNAME= ${RUBY_PKGPREFIX}-${DISTNAME}
PKGREVISION= 1
CATEGORIES= ruby devel

MAINTAINER = thomas@freeagent.com
HOMEPAGE= http://github.com/zk-ruby/zookeeper
COMMENT= Low-level ruby extension for ZooKeeper
LICENSE= mit

.include "../../lang/ruby/gem.mk"
.include "../../wip/zookeeper-client/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
83 changes: 83 additions & 0 deletions ruby-zookeeper/PLIST
@@ -0,0 +1,83 @@
@comment $NetBSD$
${GEM_HOME}/cache/${GEM_NAME}.gem
${GEM_LIBDIR}/.ctags_paths
${GEM_LIBDIR}/.dotfiles/ruby-gemset
${GEM_LIBDIR}/.dotfiles/ruby-version
${GEM_LIBDIR}/.dotfiles/rvmrc
${GEM_LIBDIR}/.gitignore
${GEM_LIBDIR}/.gitmodules
${GEM_LIBDIR}/.travis.yml
${GEM_LIBDIR}/CHANGELOG
${GEM_LIBDIR}/Gemfile
${GEM_LIBDIR}/Guardfile
${GEM_LIBDIR}/LICENSE
${GEM_LIBDIR}/Manifest
${GEM_LIBDIR}/README.markdown
${GEM_LIBDIR}/Rakefile
${GEM_LIBDIR}/cause-abort.rb
${GEM_LIBDIR}/ext/.gitignore
${GEM_LIBDIR}/ext/Rakefile
${GEM_LIBDIR}/ext/c_zookeeper.rb
${GEM_LIBDIR}/ext/common.h
${GEM_LIBDIR}/ext/dbg.h
${GEM_LIBDIR}/ext/depend
${GEM_LIBDIR}/ext/event_lib.c
${GEM_LIBDIR}/ext/event_lib.h
${GEM_LIBDIR}/ext/extconf.rb
${GEM_LIBDIR}/ext/generate_gvl_code.rb
${GEM_LIBDIR}/ext/patches/zkc-3.3.5-network.patch
${GEM_LIBDIR}/ext/patches/zkc-3.4.5-logging.patch
${GEM_LIBDIR}/ext/zkc-3.4.5.tar.gz
${GEM_LIBDIR}/ext/zkrb.c
${GEM_LIBDIR}/ext/zkrb_wrapper.c
${GEM_LIBDIR}/ext/zkrb_wrapper.h
${GEM_LIBDIR}/ext/zkrb_wrapper_compat.c
${GEM_LIBDIR}/ext/zkrb_wrapper_compat.h
${GEM_LIBDIR}/ext/zookeeper_base.rb
${GEM_LIBDIR}/java/java_base.rb
${GEM_LIBDIR}/lib/zookeeper.rb
${GEM_LIBDIR}/lib/zookeeper/acls.rb
${GEM_LIBDIR}/lib/zookeeper/callbacks.rb
${GEM_LIBDIR}/lib/zookeeper/client.rb
${GEM_LIBDIR}/lib/zookeeper/client_methods.rb
${GEM_LIBDIR}/lib/zookeeper/common.rb
${GEM_LIBDIR}/lib/zookeeper/common/queue_with_pipe.rb
${GEM_LIBDIR}/lib/zookeeper/compatibility.rb
${GEM_LIBDIR}/lib/zookeeper/constants.rb
${GEM_LIBDIR}/lib/zookeeper/continuation.rb
${GEM_LIBDIR}/lib/zookeeper/core_ext.rb
${GEM_LIBDIR}/lib/zookeeper/em_client.rb
${GEM_LIBDIR}/lib/zookeeper/exceptions.rb
${GEM_LIBDIR}/lib/zookeeper/forked.rb
${GEM_LIBDIR}/lib/zookeeper/latch.rb
${GEM_LIBDIR}/lib/zookeeper/logger.rb
${GEM_LIBDIR}/lib/zookeeper/logger/forwarding_logger.rb
${GEM_LIBDIR}/lib/zookeeper/monitor.rb
${GEM_LIBDIR}/lib/zookeeper/rake_tasks.rb
${GEM_LIBDIR}/lib/zookeeper/request_registry.rb
${GEM_LIBDIR}/lib/zookeeper/stat.rb
${GEM_LIBDIR}/lib/zookeeper/version.rb
${GEM_LIBDIR}/lib/zookeeper_c.so
${GEM_LIBDIR}/notes.txt
${GEM_LIBDIR}/scripts/upgrade-1.0-sed-alike.rb
${GEM_LIBDIR}/spec/c_zookeeper_spec.rb
${GEM_LIBDIR}/spec/chrooted_connection_spec.rb
${GEM_LIBDIR}/spec/compatibilty_spec.rb
${GEM_LIBDIR}/spec/default_watcher_spec.rb
${GEM_LIBDIR}/spec/em_spec.rb
${GEM_LIBDIR}/spec/ext/zookeeper_base_spec.rb
${GEM_LIBDIR}/spec/forked_connection_spec.rb
${GEM_LIBDIR}/spec/latch_spec.rb
${GEM_LIBDIR}/spec/log4j.properties
${GEM_LIBDIR}/spec/shared/all_success_return_values.rb
${GEM_LIBDIR}/spec/shared/connection_examples.rb
${GEM_LIBDIR}/spec/spec_helper.rb
${GEM_LIBDIR}/spec/support/00_logging.rb
${GEM_LIBDIR}/spec/support/10_spawn_zookeeper.rb
${GEM_LIBDIR}/spec/support/progress_formatter.rb
${GEM_LIBDIR}/spec/support/zookeeper_spec_helpers.rb
${GEM_LIBDIR}/spec/zookeeper_spec.rb
${GEM_LIBDIR}/zookeeper.gemspec
${GEM_LIBDIR}/zoomonkey/duplicates
${GEM_LIBDIR}/zoomonkey/zoomonkey.rb
${GEM_HOME}/specifications/${GEM_NAME}.gemspec
7 changes: 7 additions & 0 deletions ruby-zookeeper/distinfo
@@ -0,0 +1,7 @@
$NetBSD: distinfo,v 1.14 2010/09/10 04:34:12 taca Exp $

SHA1 (zookeeper-1.4.6.gem) = a56fdadb919483135cbdaa946de19100831f8e30
RMD160 (zookeeper-1.4.6.gem) = 23dd679ef57535bd090dd16bb18b2b842f47bd39
Size (zookeeper-1.4.6.gem) = 929792 bytes
SHA1 (patch-aa) = 634fa9cd4561a8dc03e82c2532ba4f29986ab122
SHA1 (patch-so-pos) = cbad35a04c55b766c1869087b1e7aa87e8205a0b
104 changes: 104 additions & 0 deletions ruby-zookeeper/patches/patch-aa
@@ -0,0 +1,104 @@
$NetBSD$

--- ext/extconf.rb.orig 2013-11-06 03:19:20.253531759 +0000
+++ ext/extconf.rb
@@ -2,97 +2,11 @@ require 'mkmf'
require 'rbconfig'
require 'fileutils'

-HERE = File.expand_path(File.dirname(__FILE__))
-BUNDLE = Dir.glob("zkc-*.tar.gz").sort.last
-ZKC_VERSION = BUNDLE[/(zkc-.*?)\.tar.gz$/, 1]
-PATCHES = Dir.glob("patches/#{ZKC_VERSION}*.patch")
+build_root = ENV['BUILDLINK_DIR'] || "/opt/local"

-BUNDLE_PATH = File.join(HERE, ZKC_VERSION, 'c')
-
-$EXTRA_CONF = ''
-
-# CLANG!!!! jeez, if apple would only *stop* "thinking different"
-if cc = RbConfig::CONFIG['CC'] && cc =~ /^gcc/
- $CC = cc
- $EXTRA_CONF = "#{$EXTRA_CONF} CC=#{$CC}"
-end
-
-$CFLAGS = "#{$CFLAGS}".gsub("$(cflags)", "").gsub("-arch ppc", "")
-$LDFLAGS = "#{$LDFLAGS}".gsub("$(ldflags)", "").gsub("-arch ppc", "")
-$CXXFLAGS = " -std=gnu++98 #{$CFLAGS}"
-$CPPFLAGS = $ARCH_FLAG = ""
-
-if RUBY_VERSION == '1.8.7'
- $CFLAGS << ' -DZKRB_RUBY_187'
-end
-
-ZK_DEBUG = (ENV['DEBUG'] or ARGV.any? { |arg| arg == '--debug' })
-ZK_DEV = ENV['ZK_DEV']
-DEBUG_CFLAGS = " -O0 -ggdb3 -DHAVE_DEBUG -fstack-protector-all"
-
-if ZK_DEBUG
- $stderr.puts "*** Setting debug flags. ***"
- $EXTRA_CONF = "#{$EXTRA_CONF} --enable-debug"
- $CFLAGS.gsub!(/ -O[^0] /, ' ')
- $CFLAGS << DEBUG_CFLAGS
-end
-
-$includes = " -I#{HERE}/include"
-$libraries = " -L#{HERE}/lib -L#{RbConfig::CONFIG['libdir']}"
-$CFLAGS = "#{$includes} #{$libraries} #{$CFLAGS}"
-$LDFLAGS = "#{$libraries} #{$LDFLAGS}"
-$LIBPATH = ["#{HERE}/lib"]
-$DEFLIBPATH = []
-
-def safe_sh(cmd)
- puts cmd
- system(cmd)
- unless $?.exited? and $?.success?
- raise "command failed! #{cmd}"
- end
-end
-
-Dir.chdir(HERE) do
- if File.exist?("lib")
- puts "Zkc already built; run 'rake clobber' in ext/ first if you need to rebuild."
- else
- puts "Building zkc."
-
- unless File.exists?('c')
- safe_sh "tar xzf #{BUNDLE} 2>&1"
- PATCHES.each do |patch|
- safe_sh "patch -p0 < #{patch} 2>&1"
- end
- end
-
- # clean up stupid apple rsrc fork bullshit
- FileUtils.rm_f(Dir['**/._*'].select{|p| test(?f, p)})
-
- Dir.chdir(BUNDLE_PATH) do
- configure = "./configure --prefix=#{HERE} --with-pic --without-cppunit --disable-dependency-tracking #{$EXTRA_CONF} 2>&1"
- configure = "env CFLAGS='#{DEBUG_CFLAGS}' #{configure}" if ZK_DEBUG
-
- safe_sh(configure)
- safe_sh("make 2>&1")
- safe_sh("make install 2>&1")
- end
-
- system("rm -rf #{BUNDLE_PATH}") unless ZK_DEBUG or ZK_DEV
- end
-end
-
-# Absolutely prevent the linker from picking up any other zookeeper_mt
-Dir.chdir("#{HERE}/lib") do
- %w[st mt].each do |stmt|
- %w[a la].each do |ext|
- system("cp -f libzookeeper_#{stmt}.#{ext} libzookeeper_#{stmt}_gem.#{ext}")
- end
- end
-end
-$LIBS << " -lzookeeper_st_gem"
+$LIBS << " #{build_root}/lib/libzookeeper_st.a"

have_func('rb_thread_blocking_region')

-$CFLAGS << ' -Wall' if ZK_DEV
create_makefile 'zookeeper_c'

13 changes: 13 additions & 0 deletions ruby-zookeeper/patches/patch-so-pos
@@ -0,0 +1,13 @@
$NetBSD$

--- ext/c_zookeeper.rb.orig 2013-11-06 02:37:55.023185230 +0000
+++ ext/c_zookeeper.rb
@@ -5,7 +5,7 @@ Zookeeper.require_lib(
'zookeeper/exceptions' # zookeeper_c depends on exceptions defined in here
)

-Zookeeper.require_root 'ext/zookeeper_c'
+Zookeeper.require_root 'lib/zookeeper_c'

# require File.expand_path('../zookeeper_c', __FILE__)

2 changes: 1 addition & 1 deletion zookeeper-client/Makefile
Expand Up @@ -15,7 +15,7 @@ BUILD_DEPENDS+= cppunit-[0-9]*:../../devel/cppunit


CONFIGURE_DIRS= src/c CONFIGURE_DIRS= src/c


CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS CFLAGS.SunOS+= -pthreads -D_POSIX_PTHREAD_SEMANTICS
LIBS.SunOS+= -lnsl -lsocket LIBS.SunOS+= -lnsl -lsocket


TEST_TARGET= run-check TEST_TARGET= run-check
Expand Down
12 changes: 12 additions & 0 deletions zookeeper-client/buildlink3.mk
@@ -0,0 +1,12 @@
# $NetBSD$

BUILDLINK_TREE+= zookeeper-client

.if !defined(ZOOKEEPER_CLIENT_BUILDLINK3_MK)
ZOOKEEPER_CLIENT_BUILDLINK3_MK:=

BUILDLINK_API_DEPENDS.zookeeper-client+= zookeeper-client>=3.4.5
BUILDLINK_PKGSRCDIR.zookeeper-client?= ../../wip/zookeeper-client
.endif # ZOOKEEPER_CLIENT_BUILDLINK3_MK

BUILDLINK_TREE+= -zookeeper-client