Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added formula for opendetex 2.8.1 #18347

Closed
wants to merge 1 commit into from

4 participants

@dotemacs

Nifty utility that I thought others might find handy

@dotemacs

Hey @adamv, apart from squashing the commits, is there anything here that needs clarifying/modification?

Thanks

@adamv
Owner

I don't know; squashing will make it easier to audit

@dotemacs

Hey @adamv your suggestions were incorporated, is there anything else that's outstanding?

Thanks

@adamv
Owner

Is this a self-submission? What does this software do? Why can't the patches be incorporated into the main distribution?

@dotemacs

Hey @adamv

Is this a self-submission?

As in, am I the author of this package?
If that is the question, the answer is that I'm not. I'm just a user of Homebrew that found detex useful and thought that others might find it handy, so decided to contribute.

What does this software do?

It removes La/TeX markup from a La/TeX documents and produces a plain text document.

Why can't the patches be incorporated into the main distribution?

The package does not use autoconf or any such tool which generates a Makefile. But instead it expects the user to edit the Makefile using their $EDITOR. My changes accomodate building & installation of the software for Homebrew without resorting to manual editing.

Please let me know if you have any other points that need clarifying.

Thanks

@dotemacs

Hey @adamv, any progress on this?
Thanks

Library/Formula/opendetex.rb
@@ -0,0 +1,18 @@
+require 'formula'
+
+class Opendetex < Formula
+ homepage 'https://code.google.com/p/opendetex/'
+ url 'https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2'
+ sha1 'd62d39d383eec66ba945090616d1d10b853a98fb'
+
+ def patches
+ { :p0 => [ "https://gist.github.com/dotemacs/5120774/raw/e224c6fae4a34d16fd1da78b290355ec02554ccf/opendetex-2.8.1-Makefile-homebrew.patch",
+ "https://gist.github.com/dotemacs/5120774/raw/319b511392c23490246b2172cd79e3e3829c4d9d/opendetex-2.8.1-detex.1l-homebrew.patch" ]
+ }
@jacknagel Owner

These patches are small enough that they can be included inline; instead of monkeying with the Makefile, you might want to use Pathname#install (e.g. bin.install, man1.install, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@adamv adamv was assigned
@adamv
Owner

Please inline these patches and use install methods per Jack's suggestion, thanks.

@dotemacs

Just to be on the safe side, since I'm not fully homebrew versed, is this how you'd do inline patches:

:point_down:

https://gist.github.com/5585866

Thanks

@adamv
Owner

Yes; you'll also need this above def install:

def patches
  DATA
end
@dotemacs

Thanks for that @adamv that works brilliantly. :thumbsup:

Going back to @jacknagel suggestion for using bin.install, man1.install, etc, when I use

def install
  bin.install "detex"
  bin.install "delatex"
  man1.install "detex"
end

tried even:

def install
  system "make"
  bin.install "detex"
  bin.install "delatex"
  man1.install "detex"
end

I get the following error:

$ brew install opendetex
==> Downloading https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/opendetex-2.8.1.tar.bz2
==> Patching
patching file Makefile
patching file detex.1l
Error: detex does not exist

:disappointed:

but if I leave the install method as:

def install
  inreplace "Makefile", "/usr/local/bin", prefix
  system "make", "install"
end

everything gets installed, the executables and the man page in the correct place. :triumph:

@adamv whats your advice ?

@adamv
Owner

This doesn't work for me at all; the sha1 is busted and when I fix it the patches don't apply.

@adamv
Owner

Building gives me:

==> make
make
sed -f states.sed detex.l > detex-temp.l
lex  detex-temp.l
rm -f detex-temp.l
mv lex.yy.c detex.c
cc -O  -Wall   -c -o detex.o detex.c
brew: superenv removed: -O -Wall
cc -O  -Wall -o detex detex.o -ll
brew: superenv removed: -O -Wall
ld: library not found for -ll
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [detex] Error 1
@dotemacs

The saga continues :heart_eyes_cat:

I've implemented the changes so that it builds clean.

If it doesn't build clean and install without any issues, can you do the following:

  • show me the link to documentation which will show me how to run the build with the verbose output, since:

    brew -v install opendetex

doesn't provide as much output as your step above.

  • once the build starts, it copies the repo to /tmp and builds it there. Regardless if the build succeeds of fails, the repo is then removed. How do I keep the directory under which the package build so that I can inspect what's going on? I've looked into the Wiki and I can't dig it up.

Muchas gracias :kiss:

@mistydemeo
Owner

sha1 doesn't match for me:

==> Downloading https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2
######################################################################## 100.0%
SHA1: a811635519dc6573735ca9d406f7032eccacd7e0
SHA256: 8a47e4c7052672dfe5e0a4214dd5db42ac4322eb382efe6fd1fb271b409d051e
Warning: Formula reports different SHA1: d62d39d383eec66ba945090616d1d10b853a98fb
@dotemacs

Hello :wave:

  • updated the SHA1 :white_check_mark:
  • re-did the patches :white_check_mark:

Please try it out now :sparkling_heart:

Thanks

@mistydemeo mistydemeo commented on the diff
Library/Formula/opendetex.rb
@@ -0,0 +1,39 @@
+require 'formula'
+
+class Opendetex < Formula
+ homepage 'https://code.google.com/p/opendetex/'
+ url 'https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2'
+ sha1 'a811635519dc6573735ca9d406f7032eccacd7e0'
+
+ def patches
@mistydemeo Owner

Is this patch necessary? You're not using make install.

I'm sorry, but I don't understand the question.

Please be patient and spell it out for me as I'm not a regular homebrew contributor so I'm not familiar with all the nuances of how things are supposed to gel.

@mistydemeo Owner

It looks like the patch you added makes some changes to the install target in the Makefile - e.g., its behaviour when you do make install. Since the formula doesn't do make install, and installs the files manually, the lines the patch is affecting aren't actually being used.

@mistydemeo Owner

Can you document what this new patch is, why it's necessary, where it came from, etc.?

Has the problem it solves been reported to the opendetex maintainers?

Can you document what this new patch is, why it's necessary, where it came from, etc.?

Sure :bowtie:

Man pages have different sections :books:
http://en.wikipedia.org/wiki/Man_page#Manual_sections

OS X doesn't have a section called 1L. I just stripped away the L part and left 1.

Have I reported it to the maintainer? No. Because I don't think he can do anything about the way OS X organises its man page sections and the original code was written on a different flavour of UNIX so it's probably left there for legacy reasons.

What else ? :cake:

P.S. this comment was more applicable to the only remaining patch, the one for the man page. The other patch for the Makefile was removed. See the commit. Thanks

@mistydemeo Owner

I'd still prefer if you reported it to them. They might not know that that section isn't usable in OS X and consider a solution.

By the way, the patch you submitted still doesn't work because the file is still named .1l, and hence man detex doesn't work. ;)

I'll submit a report to them :pencil:

Can you clarify what doesn't work?

If I run man detex, once I install the package, I get the man page for detex but there isn't a page for delatex or opendetex. What man page did you try?

I'll submit a new patch, just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mistydemeo
Owner

once the build starts, it copies the repo to /tmp and builds it there. Regardless if the build succeeds of fails, the repo is then removed. How do I keep the directory under which the package build so that I can inspect what's going on? I've looked into the Wiki and I can't dig it up.

Just add the -d flag when installing, e.g. brew install opendetex -d. On build failure you'll get a menu that will give you various options, including the option to drop to a shell in the temporary build directory.

@dotemacs

Thanks for the feedback :rose:

Removed the unnecessary patch :white_check_mark:

Your thoughts :question:

@dotemacs

@mistydemeo how about now?

Also, issue raised with the package's maintainer :pencil2:
https://code.google.com/p/opendetex/issues/detail?id=3&thanks=3&ts=1371315742

What else?

Library/Formula/opendetex.rb
@@ -0,0 +1,40 @@
+require 'formula'
+
+class Opendetex < Formula
+ homepage 'https://code.google.com/p/opendetex/'
+ url 'https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2'
+ sha1 'a811635519dc6573735ca9d406f7032eccacd7e0'
+
+ def patches
+ DATA
+ end
+
+ def install
+ system "make"
+ system "mv detex.1l detex.1"
@mistydemeo Owner

Just do the rename all in one step with the install:

man1.install 'detex.1l' => 'detex.1'

(We also prefer to avoid shelling out for these kinds of things. If you really need to rename/symlink items, look at the FileUtils module.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mistydemeo
Owner

By the way, we prefer commit messages in the format formula version, e.g. opendetex 2.8.1.

@dotemacs

How about now ? :panda_face:

@mistydemeo
Owner

Don't use mv then install it under the new name, just use the install one-liner I gave before:

man1.install 'detex.1l' => 'detex.1'
@dotemacs

:gift: done.

How about now?

@adamv
Owner

Does not build for me on Lion with a non-standard Homebrew location (~/brew) with an Xcode only install:

$ brew install -v opendetex
Warning: Your Xcode (4.6) is outdated
Please install Xcode 4.6.3.
==> Downloading https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2
Already downloaded: /usr/local/homebrew-cache/opendetex-2.8.1.tar.bz2
tar xf /usr/local/homebrew-cache/opendetex-2.8.1.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file detex.1l
==> make
make
sed -f states.sed detex.l > detex-temp.l
lex  detex-temp.l
rm -f detex-temp.l
mv lex.yy.c detex.c
cc -O  -Wall   -c -o detex.o detex.c
brew: superenv removed: -O -Wall
cc -O  -Wall -o detex detex.o -ll
brew: superenv removed: -O -Wall
ld: library not found for -ll
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [detex] Error 1
==> Configuration
HOMEBREW_VERSION: 0.9.4
HEAD: b9d567683177d8a99b36b378b302ec20b2244059
HOMEBREW_PREFIX: /Users/vandenbe/brew
CPU: quad-core 64-bit sandybridge
OS X: 10.7.5-x86_64
Xcode: 4.6
X11: 2.6.5 => /usr/X11
==> ENV
HOMEBREW_CC: clang
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /Users/vandenbe/brew:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr
CMAKE_INCLUDE_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/apache2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/
CMAKE_LIBRARY_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig
HOMEBREW_SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
ACLOCAL_PATH: /Users/vandenbe/brew/share/aclocal
OBJC: cc
PATH: /Users/vandenbe/brew/Library/ENV/4.3:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: opendetex did not build

The linker is not finding the lex library.

@adamv
Owner

So... is this available as part of the tex download?

@adamv adamv closed this pull request from a commit
@dotemacs dotemacs opendetex 2.8.1
Closes #18347.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
43068c5
@adamv adamv closed this in 43068c5
@yriveiro yriveiro referenced this pull request from a commit
@dotemacs dotemacs opendetex 2.8.1
Closes #18347.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
7f3395b
@nddrylliog nddrylliog referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@handyman5 handyman5 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@shelhamer shelhamer referenced this pull request from a commit
@dotemacs dotemacs opendetex 2.8.1
Closes #18347.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
1eafc14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 15, 2013
  1. @dotemacs

    opendetex 2.8.1

    dotemacs authored
This page is out of date. Refresh to see the latest.
Showing with 39 additions and 0 deletions.
  1. +39 −0 Library/Formula/opendetex.rb
View
39 Library/Formula/opendetex.rb
@@ -0,0 +1,39 @@
+require 'formula'
+
+class Opendetex < Formula
+ homepage 'https://code.google.com/p/opendetex/'
+ url 'https://opendetex.googlecode.com/files/opendetex-2.8.1.tar.bz2'
+ sha1 'a811635519dc6573735ca9d406f7032eccacd7e0'
+
+ def patches
@mistydemeo Owner

Is this patch necessary? You're not using make install.

I'm sorry, but I don't understand the question.

Please be patient and spell it out for me as I'm not a regular homebrew contributor so I'm not familiar with all the nuances of how things are supposed to gel.

@mistydemeo Owner

It looks like the patch you added makes some changes to the install target in the Makefile - e.g., its behaviour when you do make install. Since the formula doesn't do make install, and installs the files manually, the lines the patch is affecting aren't actually being used.

@mistydemeo Owner

Can you document what this new patch is, why it's necessary, where it came from, etc.?

Has the problem it solves been reported to the opendetex maintainers?

Can you document what this new patch is, why it's necessary, where it came from, etc.?

Sure :bowtie:

Man pages have different sections :books:
http://en.wikipedia.org/wiki/Man_page#Manual_sections

OS X doesn't have a section called 1L. I just stripped away the L part and left 1.

Have I reported it to the maintainer? No. Because I don't think he can do anything about the way OS X organises its man page sections and the original code was written on a different flavour of UNIX so it's probably left there for legacy reasons.

What else ? :cake:

P.S. this comment was more applicable to the only remaining patch, the one for the man page. The other patch for the Makefile was removed. See the commit. Thanks

@mistydemeo Owner

I'd still prefer if you reported it to them. They might not know that that section isn't usable in OS X and consider a solution.

By the way, the patch you submitted still doesn't work because the file is still named .1l, and hence man detex doesn't work. ;)

I'll submit a report to them :pencil:

Can you clarify what doesn't work?

If I run man detex, once I install the package, I get the man page for detex but there isn't a page for delatex or opendetex. What man page did you try?

I'll submit a new patch, just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ DATA
+ end
+
+ def install
+ system 'make'
+ bin.install 'detex'
+ bin.install 'delatex'
+ man1.install 'detex.1l' => 'detex.1'
+ end
+end
+
+__END__
+diff --git a/detex.1l b/detex.1l
+index a70c813..7033b44 100644
+--- a/detex.1l
++++ b/detex.1l
+@@ -1,4 +1,4 @@
+-.TH DETEX 1L "12 August 1993" "Purdue University"
++.TH DETEX 1 "12 August 1993" "Purdue University"
+ .SH NAME
+ detex \- a filter to strip \fITeX\fP commands from a .tex file.
+ .SH SYNOPSIS
+@@ -103,7 +103,7 @@ The old functionality can be essentially duplicated by using the
+ .B \-s
+ option.
+ .SH SEE ALSO
+-tex(1L)
++tex(1)
+ .SH DIAGNOSTICS
+ Nesting of \\input is allowed but the number of opened files must not
+ exceed the system's limit on the number of simultaneously opened files.
Something went wrong with that request. Please try again.