require 'formula' class CurlXZDownloadStrategy < CurlDownloadStrategy def stage # As far as I can tell, the LZMA format does not have any magic header bits that we could use to # identify LZMA archives in the CurlDownloadStrategy, so use this awesome hack safe_system "lzma -k --force --stdout --decompress #{@dl} | /usr/bin/tar x" # You could also do this, but it leaves the tar file lying around... #safe_system '/usr/local/bin/lzma', '-k', '--force', '--decompress', @dl #safe_system '/usr/bin/tar', 'xf', @dl.to_s.gsub( ".lzma", "" ) chdir end end class Texmf patches, :p1 => DATA } end def install # Notes: # Several OSX-specific files (texk/web2c/xetexdir/XeTeXFontMgr_Mac.mm and others) can't build in # 64 bit mode on OSX, since they use deprecated functions only available when building in 32bit. ENV.gcc_4_2 ENV.m32 ENV.deparallelize #Some of the makefiles doesn't use CFLAGS during linking, which causes things to break when building as 32bit. # Ugly hack to force -m32 always and forever. ENV['CC']="gcc-4.2 -m32 -arch i386" ENV['CXX']="g++-4.2 -m32 -arch i386" # I even had to patch a Makefile since it hardcoded using cc and c++, see below. # Is there a way to get these programmatically? # no, but they will always be these directories on OS X --mxcl x11_libdir = "/usr/X11/lib/" x11_includedir = "/usr/X11/include/" # The build scripts don't create this directory for no apparent reason... # It's easier to just do it here than it is to patch the Makefiles # Actually, if compilation fails brew thinks that we succeeded because this directory exists. Maybe we should patch the makefiles... FileUtils.mkdir_p "#{prefix}/share/man/man5" build_dir='Work' FileUtils.mkdir build_dir Dir.chdir build_dir do system "../configure", "--prefix=#{prefix}", "--datadir=#{prefix}", \ "--with-xdvi-x-toolkit=xaw", "--disable-threads", "--with-old-mac-fonts", "--without-xindy", \ "--x-libraries=#{x11_libdir}", "--x-includes=#{x11_includedir}", \ "--with-freetype2-libdir=#{x11_libdir}", "--with-freetype2-include=#{x11_includedir}", \ "--with-pnglib-libdir=#{x11_libdir}", "--with-pnglib-include=#{x11_includedir}", \ "--with-system-ncurses", "--with-system-freetype2", "--with-system-pnglib", \ "--with-system-zlib", "--with-system-gd", "--with-system-icu", \ "--disable-multiplatform", "--without-texinfo", "--without-xdvipdfmx", \ "--without-texi2html", "--without-psutils" system "make world" end Texmf.new.brew{ share.install Dir['*'] } # The texlive makefiles are supposed to do this, I don't know why they don't... Dir.chdir bin do system "PATH=$PATH:#{bin} texlinks -f #{share}/texmf/web2c/fmtutil.cnf" system "PATH=$PATH:#{bin} fmtutil-sys --all" end end end # OpenBSD patches: # http://www.openbsd.org/cgi-bin/cvsweb/ports/print/texlive/ # Notes for below: # Patch 1: No idea why this declaration is wrong, but we'll go ahead and fix it. # Patch 2: Slightly modified patch from OpenBSD. Adding the _XOPEN_SOURCE preprocessor flag in # libs/lua51/Makefile undeprecates some things in /usr/include/ucontext.h (Snow Leopard). # Patch 3: These are hardcoded and do not respect CFLAGS, so force them to use 32bit mode. __END__ --- nonsense/texk/web2c/xetexdir/XeTeX_ext.h 2009-10-28 02:27:34.000000000 -0700 +++ nonsense/texk/web2c/xetexdir/XeTeX_ext.h 2009-10-28 02:31:38.000000000 -0700 @@ -300,7 +300,7 @@ #ifdef XETEX_MAC /* functions in XeTeX_mac.c */ - void* loadAATfont(ATSFontRef fontRef, integer scaled_size, const char* cp1); + void* loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1); void DoAtsuiLayout(void* node, int justify); void GetGlyphBBox_AAT(ATSUStyle style, UInt16 gid, GlyphBBox* bbox); float GetGlyphWidth_AAT(ATSUStyle style, UInt16 gid); $OpenBSD: patch-libs_lua51_Makefile,v 1.2 2008/12/04 22:29:06 steven Exp $ --- nonsense/libs/lua51/Makefile.orig Mon Mar 24 15:47:15 2008 +++ nonsense/libs/lua51/Makefile Sun Oct 26 15:30:26 2008 @@ -8,7 +8,7 @@ PLAT= none CC= gcc -CFLAGS= -g -O2 -Wall $(XCFLAGS) $(MYCFLAGS) $(COCOFLAGS) +LOCALCFLAGS= -g -O2 -Wall -D_XOPEN_SOURCE $(MYCFLAGS) $(COCOCFLAGS) AR= ar rcu RANLIB= ranlib RM= rm -f @@ -77,12 +77,14 @@ clean: $(RM) $(ALL_T) $(ALL_O) depend: - @$(CC) $(CFLAGS) -MM l*.c print.c + @$(CC) $(LOCALCFLAGS) $(CFLAGS) $(XCFLAGS) -MM l*.c print.c echo: @echo "PLAT = $(PLAT)" @echo "CC = $(CC)" + @echo "LOCALCFLAGS = $(LOCALCFLAGS)" @echo "CFLAGS = $(CFLAGS)" + @echo "XCFLAGS = $(XCFLAGS)" @echo "AR = $(AR)" @echo "RANLIB = $(RANLIB)" @echo "RM = $(RM)" @@ -96,7 +98,7 @@ none: @echo "Please choose a platform: $(PLATS)" aix: - $(MAKE) a CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" + $(MAKE) a CC="xlc" LOCALCFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" ansi: $(MAKE) a MYCFLAGS=-DLUA_ANSI @@ -130,6 +132,10 @@ posix: solaris: $(MAKE) a MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" + +.c.o: + $(CC) $(LOCALCFLAGS) $(CFLAGS) $(XCFLAGS) -c $< + # list targets that do not create files (but not all makes understand .PHONY) .PHONY: all $(PLATS) default o a clean depend echo none --- nonsense/texk/xdv2pdf/Makefile.in.orig 2009-10-28 15:18:25.000000000 -0700 +++ nonsense/texk/xdv2pdf/Makefile.in 2009-10-28 15:18:51.000000000 -0700 @@ -4,8 +4,8 @@ kpse_include ../make/common.mk kpse_include ../make/programs.mk -CXX = c++ -OBJC = cc +CXX = c++ -m32 -arch i386 +OBJC = cc -m32 -arch i386 CXXLD = $(CXX) cxx_link_command = $(CXXLD) -o $@ $(LDFLAGS) kpathsea_cxx_link = $(LIBTOOL) --mode=link $(cxx_link_command)