first pass at a squashfs recipe #8648

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

freeformz commented Nov 17, 2011

Take #2

@Sharpie Sharpie commented on an outdated diff Nov 17, 2011

Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
@Sharpie

Sharpie Nov 17, 2011

Contributor

Should use the inreplace function instead of shelling out to sed:

inreplace %w[squashfs-tools/mksquashfs.c squashfs-tools/unsquashfs.c], '|FNM_EXTMATCH', ''

@Sharpie Sharpie commented on an outdated diff Nov 17, 2011

Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
+ system "cd squashfs-tools; sed -i.orig $'/#include \"unsquashfs.h\"/{i\\\n#include <sys/sysctl.h>\n}' unsquashfs.c"
@Sharpie

Sharpie Nov 17, 2011

Contributor

This could also be done via inreplace:

inreplace 'squashfs-tools/unsquashfs.c', /(#include "unsquashfs.h")/, "#include <sys/sysctl.h>\n\\1"

Although, at this point it is probably best to use a commented patch. This is easier on future maintainers who don't know sed or regular expressions that well and provides some insight into why the changes are needed. The Pyside formula has a good example of a bundled patch:

https://github.com/mxcl/homebrew/blob/master/Library/Formula/pyside.rb#L52-72

@Sharpie Sharpie commented on an outdated diff Nov 17, 2011

Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
+ system "cd squashfs-tools; sed -i.orig $'/#include \"unsquashfs.h\"/{i\\\n#include <sys/sysctl.h>\n}' unsquashfs.c"
+ system "cd squashfs-tools; make"
+
+ bin.install ["squashfs-tools/mksquashfs", "squashfs-tools/unsquashfs"]
@Sharpie

Sharpie Nov 17, 2011

Contributor

Since most of this action is happening in squashfs-tools, you could just wrap everything in a Dir.chdir block:

Dir.chdir 'squashfs-tools' do

   # Everything in here does not need `cd squashfs-tools` or a `squashfs-tools/` prefix

end
Contributor

freeformz commented Nov 18, 2011

That's pretty much all done now.

Sharpie closed this in c9e3530 Nov 23, 2011

Contributor

Sharpie commented Nov 23, 2011

Looks good. Pulled.

@Sharpie Sharpie added a commit to Sharpie/homebrew that referenced this pull request Sep 12, 2012

@freeformz @Sharpie freeformz + Sharpie New Formula: squashfs
Closes #8648.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
c6e1004

@snakeyroc3 snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this pull request Dec 17, 2012

@freeformz @Sharpie freeformz + Sharpie New Formula: squashfs
Closes #8648.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
046a781

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

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