sfnt2woff 1.0 (new formula) #26922

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

ppicazo commented Feb 22, 2014

sfnt2woff converts existing TrueType/OpenType fonts to WOFF format.

Github mirror of the original code is located at: https://github.com/ppicazo/sfnt2woff

The build now uses cmake to install binaries properly.

The original location of the project and its sourcecode can be found at: http://people.mozilla.org/~jkew/woff/

@ppicazo ppicazo sfnt2woff 1.0 (new formula)
sfnt2woff converts existing TrueType/OpenType fonts to WOFF format.
63a0172

@MikeMcQuaid MikeMcQuaid commented on the diff Feb 22, 2014

Library/Formula/sfnt2woff.rb
@@ -0,0 +1,47 @@
+require "formula"
+require "digest"
+
+class Sfnt2woff < Formula
+ homepage "https://github.com/ppicazo/sfnt2woff"
+ url "https://github.com/ppicazo/sfnt2woff/archive/1.0.tar.gz"
@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

Can we use the original upstream instead?

@ppicazo

ppicazo Feb 22, 2014

It may be possible.

The original location only provides the latest source in a zip ( http://people.mozilla.org/~jkew/woff/woff-code-latest.zip ) which makes versioning a bit confusing. If the author updated the zip file, there would be no record of changes, and the sha1 would not match the formula.

I was also not satisfied with the existing Makefile. It did not have a mechanism for installing the built binaries, which I believed should be part of the build script rather than the formula.

@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

We can always bottle and/or mirror this to help with the file changing underneath us.
I'd ask the author about these things; I'm not happy with us using your fork instead I'm afraid.

@MikeMcQuaid MikeMcQuaid commented on an outdated diff Feb 22, 2014

Library/Formula/sfnt2woff.rb
@@ -0,0 +1,47 @@
+require "formula"
+require "digest"
+
+class Sfnt2woff < Formula
+ homepage "https://github.com/ppicazo/sfnt2woff"
+ url "https://github.com/ppicazo/sfnt2woff/archive/1.0.tar.gz"
+ sha1 "1707f3a1b16339fe5b5c4431d4988e628c184832"
+
+ depends_on "cmake" => :build
+
+ def install
+
+ Dir.mkdir "build"
+ Dir.chdir "build" do
@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

Dir.mkdir can act as a block which changes directory.

@MikeMcQuaid MikeMcQuaid commented on an outdated diff Feb 22, 2014

Library/Formula/sfnt2woff.rb
+ sha1 "1707f3a1b16339fe5b5c4431d4988e628c184832"
+
+ depends_on "cmake" => :build
+
+ def install
+
+ Dir.mkdir "build"
+ Dir.chdir "build" do
+ system "cmake", "..", *std_cmake_args
+ system "make install"
+ end
+
+ end
+
+ test do
+
@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

Remove this space.

@MikeMcQuaid MikeMcQuaid commented on an outdated diff Feb 22, 2014

Library/Formula/sfnt2woff.rb
@@ -0,0 +1,47 @@
+require "formula"
+require "digest"
+
+class Sfnt2woff < Formula
+ homepage "https://github.com/ppicazo/sfnt2woff"
+ url "https://github.com/ppicazo/sfnt2woff/archive/1.0.tar.gz"
+ sha1 "1707f3a1b16339fe5b5c4431d4988e628c184832"
+
+ depends_on "cmake" => :build
+
+ def install
+
@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

Remove this space.

@MikeMcQuaid MikeMcQuaid commented on an outdated diff Feb 22, 2014

Library/Formula/sfnt2woff.rb
+ system "curl", "-o", original_woff, "http://ppicazo.github.io/sfnt2woff/test_files/AdobeBlank.otf.woff"
+
+ # Test 1: passing an otf through both executables should result in the same file
+ test1_sfnt2woff_result = "AdobeBlank.otf.original.woff"
+ test1_woff2sfnt_result = "test1.otf"
+
+ system "#{bin}/sfnt2woff #{original_otf}"
+ raise "The result of sfnt2woff should match the downloaded woff." unless Digest::MD5.file(test1_sfnt2woff_result) == original_woff_md5
+ system "#{bin}/woff2sfnt #{test1_sfnt2woff_result} > #{test1_woff2sfnt_result}"
+ raise "The result of woff2sfnt should match the downloaded otf." unless Digest::MD5.file(test1_woff2sfnt_result) == original_otf_md5
+
+ # Test 2: the woff downloaded and passed through woff2sfnt should be the same otf as we downloaded
+ test2_woff2sfnt_result = "test2.otf"
+
+ system "#{bin}/woff2sfnt #{original_woff} > #{test2_woff2sfnt_result}"
+ raise "MD5 Mismatch" unless Digest::MD5.file(test2_woff2sfnt_result) == original_otf_md5
@MikeMcQuaid

MikeMcQuaid Feb 22, 2014

Owner

Use assert instead of raise.

@ppicazo ppicazo sfnt2woff: Changes per review feedback.
Use mkdir rather than Dir.mkdir and Dir.chdir.
Remove empty lines.
Use assert rather than raise.
2a0a0c1

adamv added the new formula label Feb 22, 2014

Contributor

adamv commented Mar 16, 2014

@MikeMcQuaid any remaining issues?

Contributor

adamv commented Mar 16, 2014

I see this is still using a fork or mirror.

Owner

MikeMcQuaid commented Mar 17, 2014

@adamv I'd rather we used the real upstream and bottle/mirror it but feel free to decide otherwise, not strong on this.

adamv referenced this pull request May 4, 2014

Closed

sfnt2woff (latest) #28951

Contributor

adamv commented May 5, 2014

Given that upstream isn't likely to start providing versioned tarballs, I'm going to pass on this.

Options for packaging in Homebrew are to submit it to https://github.com/Homebrew/homebrew-headonly or to package it in an external tap.

adamv closed this May 5, 2014

xu-cheng locked and limited conversation to collaborators Feb 17, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.