[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcaca] [PATCH] add gemspec to ruby binding
- To: libcaca@lists.zoy.org
- Subject: [libcaca] [PATCH] add gemspec to ruby binding
- From: Tony Miller <mcfiredrill@gmail.com>
- Date: Sun, 17 Mar 2013 21:05:52 -0700
- Delivered-to: list-libcaca@zoy.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=cr9tohlA48LGXWt898lH2KXCfmevtfvzsO2P/R01zOM=; b=h0PX8a9jGMIohU41gvdVIZNnjf87wl/8zgpDeX7UcO9cuTV/5OhRLG7z5800nwBKAg RSpmnkSLT9TK6ws3G7VxulKvCRT7Ydv8r1Jyhs5c5kDOOsykNfJHRc6I1Om6gxIpTy63 dBSieS/QEzop2/ucSjb7QR56rpB2WUoBy+ngN5EMBizZOYBlz60ZLtAPFVRwiwghJW2P 213LgEad5Vr+xuoqrQq3nIVgUsEURr3uKXCZY6yNaIA+wgJwedbs/qxclF0YtbbHhVqw OblDaFq8VTc2sQOG5RU/AJuX9Sq9LvnAoccmD1TClaMCl6K/0grFyu1WfcERxsJsluD7 ZrwA==
- Reply-to: libcaca@lists.zoy.org
- Sender: libcaca-bounce@lists.zoy.org
- User-agent: Mutt/1.5.21 (2010-09-15)
Hi,
Here's a patch that adds a .gemspec to the ruby binding so we can
publish it on rubygems.org.
concerns:
* I'm not sure if I filled out the authors field correctly. The convention
seems to be to just credit the people who worked on the ruby binding
itself, and not the original C project. So I just listed Sam, Pterjan,
and myself.
* Switched to using extconf.rb instead of autotools. I'm not sure if its
possible to get rubygems to work with autotools.
I replaced Makefile.am with a single line that
runs `ruby ext/caca/extconf.rb`. This way it seems to still compile
the extension if you do the normal ./configure && make.
* I defined the gem version in caca/version.rb. Do we want to start at
version 1.0.0? I'm guessing not, since libcaca itself isnt at 1.0 yet.
---
.gitignore | 1 +
ruby/Makefile.am | 43 +-------------------------------------
ruby/{ => ext/caca}/caca-canvas.c | 0
ruby/{ => ext/caca}/caca-canvas.h | 0
ruby/{ => ext/caca}/caca-display.c | 0
ruby/{ => ext/caca}/caca-display.h | 0
ruby/{ => ext/caca}/caca-dither.c | 0
ruby/{ => ext/caca}/caca-dither.h | 0
ruby/{ => ext/caca}/caca-event.c | 0
ruby/{ => ext/caca}/caca-event.h | 0
ruby/{ => ext/caca}/caca-font.c | 0
ruby/{ => ext/caca}/caca-font.h | 0
ruby/{ => ext/caca}/caca.c | 0
ruby/{ => ext/caca}/common.h | 0
ruby/ext/caca/extconf.rb | 43 ++++++++++++++++++++++++++++++++++++++
ruby/lib/caca.rb | 3 ++-
ruby/lib/caca/version.rb | 3 +++
ruby/libcaca.gemspec | 31 +++++++++++++++++++++++++++
18 files changed, 81 insertions(+), 43 deletions(-)
rename ruby/{ => ext/caca}/caca-canvas.c (100%)
rename ruby/{ => ext/caca}/caca-canvas.h (100%)
rename ruby/{ => ext/caca}/caca-display.c (100%)
rename ruby/{ => ext/caca}/caca-display.h (100%)
rename ruby/{ => ext/caca}/caca-dither.c (100%)
rename ruby/{ => ext/caca}/caca-dither.h (100%)
rename ruby/{ => ext/caca}/caca-event.c (100%)
rename ruby/{ => ext/caca}/caca-event.h (100%)
rename ruby/{ => ext/caca}/caca-font.c (100%)
rename ruby/{ => ext/caca}/caca-font.h (100%)
rename ruby/{ => ext/caca}/caca.c (100%)
rename ruby/{ => ext/caca}/common.h (100%)
create mode 100644 ruby/ext/caca/extconf.rb
create mode 100644 ruby/lib/caca/version.rb
create mode 100644 ruby/libcaca.gemspec
diff --git a/.gitignore b/.gitignore
index aba7cb1..807011a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,7 @@ examples/unicode
# Ruby binaries
ruby/*/mkmf.log
ruby/*/*.so
+ruby/*.gem
# Python binaries
python/*/*.pyc
python/*.egg-info
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index 680418e..4bd35be 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -1,42 +1 @@
-
-rubylibdir = $(RUBY_SITEARCHDIR)
-rubysitedir = $(RUBY_SITELIBDIR)
-
-if USE_RUBY
-rubylib_LTLIBRARIES = caca.la
-rubysite_DATA = lib/caca.rb
-TESTS = test
-endif
-
-CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes
-
-caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I../caca $(RUBY_CFLAGS)
-caca_la_SOURCES = caca.c \
- common.h \
- caca-canvas.c \
- caca-canvas.h \
- caca-dither.c \
- caca-dither.h \
- caca-font.c \
- caca-font.h \
- caca-display.c \
- caca-display.h \
- caca-event.c \
- caca-event.h \
- $(NULL)
-caca_la_LDFLAGS = -module -avoid-version -shared $(RUBY_LIBS)
-caca_la_LIBADD = ../caca/libcaca.la
-
-EXTRA_DIST = ruby.dox \
- ruby-caca.dox \
- lib/caca.rb \
- test \
- t/tc_canvas.rb \
- t/tc_dither.rb \
- t/tc_font.rb \
- t/tc_frame.rb \
- README \
- $(NULL)
-
-echo-sources: ; echo $(SOURCES)
-
+all: ; ruby ext/caca/extconf.rb
diff --git a/ruby/caca-canvas.c b/ruby/ext/caca/caca-canvas.c
similarity index 100%
rename from ruby/caca-canvas.c
rename to ruby/ext/caca/caca-canvas.c
diff --git a/ruby/caca-canvas.h b/ruby/ext/caca/caca-canvas.h
similarity index 100%
rename from ruby/caca-canvas.h
rename to ruby/ext/caca/caca-canvas.h
diff --git a/ruby/caca-display.c b/ruby/ext/caca/caca-display.c
similarity index 100%
rename from ruby/caca-display.c
rename to ruby/ext/caca/caca-display.c
diff --git a/ruby/caca-display.h b/ruby/ext/caca/caca-display.h
similarity index 100%
rename from ruby/caca-display.h
rename to ruby/ext/caca/caca-display.h
diff --git a/ruby/caca-dither.c b/ruby/ext/caca/caca-dither.c
similarity index 100%
rename from ruby/caca-dither.c
rename to ruby/ext/caca/caca-dither.c
diff --git a/ruby/caca-dither.h b/ruby/ext/caca/caca-dither.h
similarity index 100%
rename from ruby/caca-dither.h
rename to ruby/ext/caca/caca-dither.h
diff --git a/ruby/caca-event.c b/ruby/ext/caca/caca-event.c
similarity index 100%
rename from ruby/caca-event.c
rename to ruby/ext/caca/caca-event.c
diff --git a/ruby/caca-event.h b/ruby/ext/caca/caca-event.h
similarity index 100%
rename from ruby/caca-event.h
rename to ruby/ext/caca/caca-event.h
diff --git a/ruby/caca-font.c b/ruby/ext/caca/caca-font.c
similarity index 100%
rename from ruby/caca-font.c
rename to ruby/ext/caca/caca-font.c
diff --git a/ruby/caca-font.h b/ruby/ext/caca/caca-font.h
similarity index 100%
rename from ruby/caca-font.h
rename to ruby/ext/caca/caca-font.h
diff --git a/ruby/caca.c b/ruby/ext/caca/caca.c
similarity index 100%
rename from ruby/caca.c
rename to ruby/ext/caca/caca.c
diff --git a/ruby/common.h b/ruby/ext/caca/common.h
similarity index 100%
rename from ruby/common.h
rename to ruby/ext/caca/common.h
diff --git a/ruby/ext/caca/extconf.rb b/ruby/ext/caca/extconf.rb
new file mode 100644
index 0000000..6b7a09a
--- /dev/null
+++ b/ruby/ext/caca/extconf.rb
@@ -0,0 +1,43 @@
+require 'mkmf'
+
+LIBDIR = RbConfig::CONFIG['libdir']
+INCLUDEDIR = RbConfig::CONFIG['includedir']
+
+HEADER_DIRS = [
+ # First search /opt/local for macports
+ '/opt/local/include',
+
+ # Then search /usr/local for people that installed from source
+ '/usr/local/include',
+
+ # Check the ruby install locations
+ INCLUDEDIR,
+
+ # Finally fall back to /usr
+ '/usr/include',
+]
+
+LIB_DIRS = [
+ # First search /opt/local for macports
+ '/opt/local/lib',
+
+ # Then search /usr/local for people that installed from source
+ '/usr/local/lib',
+
+ # Check the ruby install locations
+ LIBDIR,
+
+ # Finally fall back to /usr
+ '/usr/lib',
+]
+
+dir_config('caca', HEADER_DIRS, LIB_DIRS)
+
+unless find_header('caca.h')
+ abort "libcaca is missing. please install libcaca"
+end
+
+unless find_library('caca', 'caca_create_display')
+ abort "libcaca is missing. please install libcaca"
+end
+create_makefile('caca/caca')
diff --git a/ruby/lib/caca.rb b/ruby/lib/caca.rb
index d7b5923..e8dc9d4 100644
--- a/ruby/lib/caca.rb
+++ b/ruby/lib/caca.rb
@@ -1,4 +1,5 @@
-require 'caca.so'
+require 'caca/caca.so'
+require 'caca/version'
module Caca
class Display
diff --git a/ruby/lib/caca/version.rb b/ruby/lib/caca/version.rb
new file mode 100644
index 0000000..8cada60
--- /dev/null
+++ b/ruby/lib/caca/version.rb
@@ -0,0 +1,3 @@
+module Caca
+ VERSION = "1.0.0"
+end
diff --git a/ruby/libcaca.gemspec b/ruby/libcaca.gemspec
new file mode 100644
index 0000000..415fdce
--- /dev/null
+++ b/ruby/libcaca.gemspec
@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require 'caca/version'
+
+Gem::Specification.new do |s|
+ s.name = "libcaca-ruby"
+ s.version = Caca::VERSION
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = [
+ "Tony Miller",
+ "Pascal Terjan",
+ "Sam Hocevar"
+ ]
+ s.licenses = ["WTFPL"]
+ s.email = ["mcfiredrill@gmail.com"]
+ s.homepage = "http://caca.zoy.org/"
+ s.summary = "ruby bindings for libcaca"
+ s.description = "libcaca is a graphics library that outputs text instead of pixels."
+
+ s.extensions = ["ext/caca/extconf.rb"]
+
+ s.rubyforge_project = "libcaca-ruby"
+
+ s.files = Dir.glob("lib/**/*.rb") +
+ Dir.glob("ext/**/*.{c,h,rb}") +
+ %w(README ruby.dox ruby-caca.dox)
+ s.test_files = Dir.glob("t/*") << "test"
+ s.require_path = "lib"
+end
--
1.7.12.3
--
-Tony Miller
github.com/mcfiredrill
@freedrull
freedrool.us
--
This is the Caca Labs mailing-list, see http://caca.zoy.org/
Trouble unsubscribing? Please contact <sam@zoy.org>
List archives are at http://caca.zoy.org/list/