Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#16133 closed defect (fixed)

Fix for XeTeX Leopard Build Failure

Reported by: kthenriksson@… Owned by: milosh@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: texlive xetex Cc: pguyot (Paul Guyot), raimue (Rainer Müller)


Right now, XeTeX will not build on Leopard, and even if it did, two of its files to install conflict with files in texlive_base. Because it wouldn't compile in Leopard, it was removed from texlive_base in changeset [31087], but there I can't seem to find any tickets about this particular issue. Ticket #11388 seems to be similar, especially in the suggested fix, but does not show the same build error.

The following patch applied to 'libs/icu-xetex/config/mh-darwin' in the texlive_base or xetex packages corrects this error and allows the build to complete successfully:

--- mh-darwin.orig	2008-07-29 21:55:37.000000000 -0700
+++ mh-darwin	2008-07-29 21:56:16.000000000 -0700
@@ -58,7 +58,7 @@
 	@echo "generating dependency information for $<"
 	@$(GEN_DEPS.c) $< > /dev/null
 	@mv $@ $@~
-	@echo -n "$@ " > $@
+	@/bin/echo -n "$@ " > $@
 	@cat < $@~ >> $@
 	@-rm $@~
@@ -66,7 +66,7 @@
 	@echo "generating dependency information for $<"
 	@$( $< >/dev/null
 	@mv $@ $@~
-	@echo -n "$@ " > $@
+	@/bin/echo -n "$@ " > $@
 	@cat < $@~ >> $@
 	@-rm $@~

The problem that occurs is that make uses sh to invoke commands in a Makefile, but perhaps from the bash configure option --enable-strict-posix-default, the bash shell option xpg_echo defaults to on. Because sh was compiled to default to POSIX mode, this means that echo no longer recognizes any options and prints all arguments verbatim (except for backslash escape expansion, see and search for xpg_echo for details).

So the Makefile that wants echo -n to mean no new line actually gets it to mean print a -n literally, which ends up ruining another Makefile called stubdata.d and prevents successful compilation. As you can see from the patch, the fix is to invoke the actual echo program instead of the shell builtin called echo, which is accomplished here by using the full path to echo.

The patch should be applied to both the texlive_base and xetex file trees and the texlive_base Portfile can hopefully be updated to reenable compilation of xetex. I believe that the xetex package can actually be removed as well once xetex has be reenabled in texlive_base.

Due to a file conflict that the inclusion of xetex brings, texlive_texmf-full needs the line "delete ${worksrcpath}/texmf/web2c/xetex.pool" in the build section.

One other change is that texlive will need the line "ln -s ${prefix}/bin/xetex ${destroot}${prefix}/bin/xelatex" added to the destroot section to give the correct xelatex symbolic link.

Attachments (2)

svnportsdiff.patch (4.5 KB) - added by kthenriksson@… 13 years ago.
Patch to reenable xetex
xetex2.patch (1.3 KB) - added by kthenriksson@… 13 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 13 years ago by blb@…

Cc: pguyot@… added
Milestone: Port Bugs
Owner: changed from macports-tickets@… to milosh@…

Assigning/Cc maintainers.

FYI, the base change is due to the Unix 03 conformance stuff Apple did for 10.5.

comment:2 Changed 13 years ago by kthenriksson@…

According to that link you provided, it seems that printf is the preferred way to replace echo in this usage, although it probably doesn't matter.

On closer inspection, other lines need to be removed from other Portfiles to add xetex back. The lines

delete ${worksrcpath}/texmf-dist/tex/latex/latexconfig/xelatex.ini
delete ${worksrcpath}/texmf-dist/tex/plain/config/xetex.ini

need to be removed from the texlive_texmf-minimal Portfile, otherwise the xetex.fmt and xelatex.fmt files required by xetex and xelatex respectively can't be built. The lines

delete ${worksrcpath}/texmf/fmtutil/format.xetex.cnf
delete ${worksrcpath}/texmf-dist/tex/generic/xetexconfig
delete ${worksrcpath}/texmf-dist/tex/xelatex/xetexconfig
delete ${worksrcpath}/texmf-dist/tex/xelatex/xetexurl

need to be removed from the texlive_texmf-full Portfile, because they also delete required files.

comment:3 Changed 13 years ago by informatique@…

Hello, Is there any news on this? Will it be integrated soon?

If not, how can I integrate it manually? I'm new to Macports, but I'm not new to other packaging systems. Thank you in advance.

comment:4 Changed 13 years ago by kthenriksson@…

I don't know what the deal is with this. I reported it and said what was the proper fix, but there doesn't seem to be any progress. I'd be happy to detail exactly what you need to do to get everything working. Please let me know if you run into a problem.

First, you need to have some kind of command line text editor, like nano, vi, emacs, or joe. I use joe, and that's the example I'll use here, but you should just substitute the one you want.


sudo -s
export EDITOR=joe
port edit texlive

Be sure to enter your password after the sudo command. Increment the value of revision by one, e.g. 1->2. Go down to the destroot section and add the line

ln -s ${prefix}/bin/xetex ${destroot}${prefix}/bin/xelatex

to this section. Save and exit the text editor.

Now run

port edit texlive_texmf-minimal

Increment the revision by one, then go down to the build section and remove the lines

delete ${worksrcpath}/texmf-dist/tex/latex/latexconfig/xelatex.ini
delete ${worksrcpath}/texmf-dist/tex/plain/config/xetex.ini

from the file. These should be the second and third lines. Save and exit the text editor. Like before, run port edit texlive_texmf-full and remove the lines

delete ${worksrcpath}/texmf/fmtutil/format.xetex.cnf
delete ${worksrcpath}/texmf-dist/tex/generic/xetexconfig
delete ${worksrcpath}/texmf-dist/tex/xelatex/xetexconfig
delete ${worksrcpath}/texmf-dist/tex/xelatex/xetexurl

from the file. These should be all but the first lines. Also, increment the revision by one. Save and exit again. Now run port edit texlive_base and increment the revision by one again. Then go down to the post-destroot section. Remove the line

reinplace "s|.*xetex.*||" ${destroot}${prefix}/share/texmf/web2c/fmtutil.cnf

and save and quit.

Now run port extract texlive_base and wait for everything to finish executing so you get dropped back to the command line. Now copy and paste the command (as one long line)

joe /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_tex_texlive_base/work/texlive_base-2007/libs/icu-xetex/config/mh-darwin

and go down to a line that says Dependency rules, which is about 60 lines down. Just a little below you'll see a couple lines that say "@echo -n ..." where I've substituted the end of the lines with ... just for the purpose of this explanation. Replace both instances of "echo -n" with "/bin/echo -n" and leave everything else alone. Save and exit again.

Now as the very final step, run port install texlive and you should get everything installing properly. Now you should be all set to use xetex.

comment:5 Changed 13 years ago by kthenriksson@…

Sorry, I have something to add that I forgot above. After executing port edit texlive_base, you need to edit not just the post-destroot section, but also the configure.args section right above it. In that section, remove the text "--without-xetex" from the end.

comment:6 Changed 13 years ago by raimue (Rainer Müller)

Cc: raimue@… added

Looks like the maintainer is not available. Please provide a patch, this will make the process a lot faster.

Changed 13 years ago by kthenriksson@…

Attachment: svnportsdiff.patch added

Patch to reenable xetex

comment:7 Changed 13 years ago by kthenriksson@…

I'm not familiar with the whole MacPorts system overall. However, I checked out the dports directory from SVN and made all the changes that (I believe) are necessary. This is the output of svn diff run from the dports directory and implements the instructions I included above.

comment:8 Changed 13 years ago by milosh@…

I committed your changes in r39684. I don't know about xetex so I couldn't test that it really works.

Changed 13 years ago by kthenriksson@…

Attachment: xetex2.patch added

comment:9 Changed 13 years ago by kthenriksson@…

I realized that I made an omission in my previous patch. I forgot to add a certain "delete" line to a portfile. Also, it turns out that the fmtutil-sys --all command depends on a file in texlive_texmf-full when xetex is enabled so I changed the depends on texlive_base. This is I realize a dramatic change, so if necessary I'll find some other way to make it work.

comment:10 Changed 12 years ago by milosh@…

Resolution: fixed
Status: newclosed

Yep, quite a dramatic change as it disables the minimal variant. It would be too much work to fix, so I applied the change and got rid of variant minimal in r39696.

comment:11 Changed 12 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.