Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add formula for unac.

unac is a C library and command that removes accents from a string. For instance the string été will become ete. It provides a command line interface that removes accents from a input flow or a string given in argument (unaccent command).

This package is what I would consider to be extremely stable. Even though the project was somewhat abandoned in the 2002-2004 timeframe, Debian has continued to ensure the package works. The formula gets the code and patches from them, then makes local patches in order to compile properly under Mac OS.
  • Loading branch information...
commit 0a0cad381bfccf9d7d286f8d76c0d2fed792dbbe 1 parent c5d69ae
Sean Goller authored
Showing with 49 additions and 0 deletions.
  1. +49 −0 Library/Formula/unac.rb
49 Library/Formula/unac.rb
View
@@ -0,0 +1,49 @@
+require 'formula'
+
+class Unac < Formula
+ homepage ''
+ url 'http://ftp.de.debian.org/debian/pool/main/u/unac/unac_1.8.0.orig.tar.gz'
+ sha1 '3e779bb7f3b505880ac4f43b48ee2f935ef8aa36'
+
+ depends_on 'gettext' => :build
+ depends_on 'autoconf' => :build
+ depends_on 'automake' => :build
Adam Vandenberg
adamv added a note

autoconf and automake should use :symbol syntax too I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ depends_on :libtool => :build
+
+ def patches
+ {
+ :p0 => ["http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=patch-libunac1.txt;att=1;bug=623340",
+ "http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=patch-unaccent.c.txt;att=1;bug=623340"],
+ :p1 => ["http://ftp.de.debian.org/debian/pool/main/u/unac/unac_1.8.0-6.diff.gz",
+ DATA]
Adam Vandenberg
adamv added a note

Please document the DATA patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ }
+ end
+
+ def install
+ system "chmod","+x","./configure"
+ touch "config.rpath"
+ inreplace "autogen.sh", "libtool", "glibtool"
+ system "./autogen.sh"
+ system "./configure", "--disable-debug", "--disable-dependency-tracking",
+ "--prefix=#{prefix}"
Adam Vandenberg
adamv added a note

indentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ system "make install"
+ end
+
+ def test
+ `#{bin}/unaccent utf-8 fóó`.chomp == 'foo'
Adam Vandenberg
adamv added a note

Does this...break ruby?

Sean Goller Owner
smgoller added a note

Does it? I got the test from mistym, who knows way more about ruby than I do. I didn't write it.

Ruby 1.8 doesn't care because all chars are just bytes; it has no concept of encoding. Ruby 1.9 would throw a fit though.

Add this line as the very first in the line and it works on Ruby 1.9 too:

# -*- coding: utf-8 -*-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+end
+
+__END__
+diff --git a/configure.ac b/configure.ac
+index 4a4eab6..9f25d50 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -49,6 +49,7 @@ AM_MAINTAINER_MODE
+
+ AM_ICONV
+
++LIBS="$LIBS -liconv"
+ AC_CHECK_FUNCS(iconv_open,,AC_MSG_ERROR([
+ iconv_open not found try to install replacement from
+ http://www.gnu.org/software/libiconv/
Adam Vandenberg

autoconf and automake should use :symbol syntax too I think?

Adam Vandenberg

Does this...break ruby?

Adam Vandenberg

Please document the DATA patch.

Sean Goller

Does it? I got the test from mistym, who knows way more about ruby than I do. I didn't write it.

Misty De Meo

Ruby 1.8 doesn't care because all chars are just bytes; it has no concept of encoding. Ruby 1.9 would throw a fit though.

Misty De Meo

Add this line as the very first in the line and it works on Ruby 1.9 too:

# -*- coding: utf-8 -*-

Please sign in to comment.
Something went wrong with that request. Please try again.