I am going to try installing this on the iPad 2. Hopefully it will allow me to compile XeteX on the iPad, making this a useful device for work, combined with the BibDesk reader app on itunes.
here is the original post:
TeX Live for iPhone
Installing via Cydia
The easiest way to install TeX Live for the iPhone is my Cydia repository. Be warned that TeX is huge. You will end up downloading 500 megabytes of data from my site, and after installation, it will take up a whole gigabyte or so. Make sure your device doesn’t go to sleep during installation.To install TeX Live, you will need to add both my repo and the coredev.nl repo. Adding my repo is as simple as adding my URL in Cydia, but the coredev repo is a bit trickier. Install
apt-get
and wget
in Cydia, then fire up a terminal (as root, and make sure Cydia is closed!) and run the following:iphone:~ root# wget http://coredev.nl/cydia/coredev.pub iphone:~ root# apt-key add coredev.pub iphone:~ root# echo 'deb http://coredev.nl/cydia iphone main' > /etc/apt/sources.list.d/coredev.nl.list iphone:~ root# apt-get update
Compiling it Yourself
If you want to compile it yourself, you will need an on-iPhone development environment. Also you will need a copy of XZ Utils. You can either build it yourself or get it from my Cydia repository.Luckily, the TeX Live source includes all the libraries it needs, so you don’t have many dependencies to go through. Using these libraries is easy, but they link statically so the final TeX binaries are much bigger. This works right now; my next goal is using system libraries instead.
The TeX Live build is long: make sure your device won’t go into sleep mode, or otherwise interrupt the build. TeX Live is mighty picky about build order, sometimes, so an interruption could be bad. It might not be, but it’s best not to risk it.
As always, if you have any questions, feel free to contact me.
The Easy Way
Here, I’m using the term “easy” lightly. There’s still a lot of steps, even with a patch file. Again, be sure your device won’t fall asleep on you!Installing Build Tools
We need to add the coredev.nl APT repository so we can downloadperl
. The following commands will add the source and its public key. Note that we use su
to become root for a bit; the password asked for is root
‘s.iphone:~ mobile$ wget http://coredev.nl/cydia/coredev.pub iphone:~ mobile$ su iphone:/var/mobile root# apt-key add coredev.pub iphone:/var/mobile root# echo 'deb http://coredev.nl/cydia iphone main' > /etc/apt/sources.list.d/coredev.nl.list iphone:/var/mobile root# apt-get update iphone:/var/mobile root# exit
perl
is broken into a ton of small packages, so don’t be alarmed when APT tells you it’s installing about 100 things.iphone:~ mobile$ sudo apt-get install perl bison flex m4
m4
manually, even though it should be included as a dependency of either bison
or flex
.)The iPhone OS limits the number of processes that a single user can run to some small number. Normally, this isn’t a problem, even when building things like Emacs. However, the TeX Live build system is massive, and you’ll quickly run up against this limit. I’ve written a little script that launches a subshell where this limit is much higher (64, in fact), so you can complete the TeX build.
#!/bin/bash (whoami | grep --quiet root) || sudo $0 (whoami | grep --quiet root) || exit sysctl -w kern.maxprocperuid=256 > /dev/null || exit ulimit -u 64 > /dev/null || exit echo Entering supermode... sudo -i -u mobile echo Leaving supermode...
supermode
in your home directory, and chmod +x supermode
. Then, whenever you need the extra processes, use the command ~/supermode
, type in your password if it asks, and a new shell will launch. To leave, just use exit
. For the rest of this guide, I’ll assume you’re in “supermode”.Fetching, Installing, and Building
Now we can fetch the TeX Live sources and the patch.iphone:~ mobile$ wget ftp://tug.org/historic/systems/texlive/2009/texlive-20091107-source.tar.xz iphone:~ mobile$ wget http://gammalevel.com/forever/texlive-20091107-iPad.patch
iphone:~ mobile$ xzcat texlive-20091107-source.tar.xz | tar xv iphone:~ mobile$ cd texlive-20091107-source iphone:~/texlive-20091107-source mobile$ patch -p1 < ../texlive-20091107-iPad.patch
pwd
is inside back-ticks (the un-shifted version of ~
on most keyboards). In fact, it’d probably be best if you just copy and paste that last command…iphone:~/texlive-20091107-source mobile$ mkdir ../texlive-build iphone:~/texlive-20091107-source mobile$ cd ../texlive-build iphone:~/texlive-build mobile$ ../texlive-20091107-source/configure --datadir=`pwd` --prefix=/usr --with-tex-banner="TeX Live 2009/iPhone OS [gammalevel.com]" --disable-xetex --disable-shared --disable-missing --disable-largefile --disable-threads --without-x --disable-native-texlive-build --disable-multiplatform --disable-xdvipdfmx
iphone:~/texlive-build mobile$ make texmf=${TEXMF_PATH:-/usr/share/texmf} iphone:~/texlive-build mobile$ sudo make texmf=${TEXMF_PATH:-/usr/share/texmf} install-strip
Installing the texmf
Tree
First of all, TeX Live just installed a useless baby texmf
tree already, and into the wrong place no less, so let’s remove that:iphone:~/texlive-build mobile$ cd ../ iphone:~ mobile$ sudo rm -rf /usr/texmf /usr/texmf-dist
texmf
tree. This file is gigantic: around 900MB! This part will probably take even longer than the compile, so if you want, you could download it on a computer, then move it to your device.iphone:~ mobile$ wget ftp://tug.org/historic/systems/texlive/2009/texlive-20091107-texmf.tar.xz
wget
command again with -c
to ensure it will continue downloading where it left off.)At this point, you really should make sure the file is correct:
iphone:~ mobile$ sha256sum texlive-20091107-texmf.tar.xz 63e38a218c04e28081e12b4f48969a7e25cf5f81a8c4807aae815a49b575ae5d texlive-20091107-texmf.tar.xz
iphone:~ mobile$ xzcat texlive-20091107-texmf.tar.xz | tar xv iphone:~ mobile$ sudo mv texlive-20091107-texmf/texmf* /usr/share/
Finishing Up
Thetexmf.cnf
we installed has the wrong paths, so we’ll replace it:iphone:~ mobile$ wget http://gammalevel.com/forever/texlive-20091107-texmf.cnf iphone:~ mobile$ sudo mv texlive-20091107-texmf.cnf /usr/share/texmf/web2c/texmf.cnf
iphone:~ mobile$ sudo mktexlsr iphone:~ mobile$ sudo texlinks iphone:~ mobile$ sudo texconfig-sys init
xetex
: these are normal, because we disabled it! If there’s any other errors, though, those are real problems.)Congratulations! You have just finished installing TeX Live! To configure your new system (for example, to set the default paper size), use this command (though honestly, it’s never worked for me):
iphone:~ mobile$ texconfig
The Hard Way
I’m still backtracking through what I did to find out all these patches and configure options, but when I figure it all out again, I’ll put why I made those changes here.Created July 11, 2011, 10:44 p.m.; last modified Oct. 25, 2011, 7:27 p.m. (history).
No comments:
Post a Comment