5e97de00e0
Closes Homebrew/homebrew#28322. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
52 lines
1.4 KiB
Ruby
52 lines
1.4 KiB
Ruby
require 'formula'
|
|
|
|
class Dos2unix < Formula
|
|
homepage 'http://waterlan.home.xs4all.nl/dos2unix.html'
|
|
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.4.tar.gz'
|
|
sha1 '93d73148c09908a42dcbf5339312c9aa1f18ba7c'
|
|
|
|
patch do
|
|
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-pod-encoding.patch'
|
|
sha1 '01601899597dcb361ba0b499f537588145ec08a9'
|
|
end
|
|
|
|
depends_on 'gettext'
|
|
|
|
devel do
|
|
url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-6.0.5-beta11.tar.gz'
|
|
sha1 'f7d17dc4dbf723c81d1459b9664fc8045a77541d'
|
|
end
|
|
|
|
def install
|
|
gettext = Formula["gettext"]
|
|
system "make", "prefix=#{prefix}",
|
|
"CC=#{ENV.cc}",
|
|
"CPP=#{ENV.cc}",
|
|
"CFLAGS=#{ENV.cflags}",
|
|
"CFLAGS_OS=-I#{gettext.include}",
|
|
"LDFLAGS_EXTRA=-L#{gettext.lib} -lintl",
|
|
"install"
|
|
end
|
|
|
|
test do
|
|
# write a file with lf
|
|
path = testpath/"test.txt"
|
|
path.write "foo\nbar\n"
|
|
|
|
# unix2mac: convert lf to cr
|
|
system "#{bin}/unix2mac", path
|
|
assert_equal "foo\rbar\r", path.read
|
|
|
|
# mac2unix: convert cr to lf
|
|
system "#{bin}/mac2unix", path
|
|
assert_equal "foo\nbar\n", path.read
|
|
|
|
# unix2dos: convert lf to cr+lf
|
|
system "#{bin}/unix2dos", path
|
|
assert_equal "foo\r\nbar\r\n", path.read
|
|
|
|
# dos2unix: convert cr+lf to lf
|
|
system "#{bin}/dos2unix", path
|
|
assert_equal "foo\nbar\n", path.read
|
|
end
|
|
end
|