OpenBSD Journal

Porting TeX Live to OpenBSD

Contributed by dwc on from the typecasting dept.

Edd Barrett writes in with his experiences porting TEX Live to OpenBSD. TEX Live is the heir apparent to the venerable TEX typesetting system by Donald Knuth. Edd's article was originally published in TUGboat 29:2.

Porting TEX Live to OpenBSD

Edward Barrett

Abstract:

The history, creation, and fruition of porting TEX Live to OpenBSD.

Why TEX?

At the time that I became a student, I had been using *NIX systems for years, in particular an operating system called OpenBSD, which is one of the BSD1 derived open-source Unix-a-likes. OpenBSD aims to be “Free, Functional and Secure”, but it also has other qualities which made it appealing to me: it was small, it did not demand a fast computer and is developed with “correctness” in mind.

The existing WYSIWYG2 document preparation software packages for OpenBSD either did not suit the nature of the document, or did not feel natural to me as a computing student. In particular:

  • Most of my assignments required source code listings. Standard procedure generally consisted of copy and pasting large chunks of code into a word processor (screen by screen if you were in a terminal appplication). It did work, but it was tedious to repeat when the sources changed.
  • During my two years in industry, Vim3 had become second nature to me when editing text. In comparison a word processor seemed very limited and inefficient.

It was only when I saw what some of the members of staff at University had done with TEX that I became fully aware of its purpose. The concept of logical markup in a document felt right, and my previous gripes with word processors could be solved, not to mention that documents typeset with TEX looked a much more professional than anything I could make with a word processor. I started learning how to make documents like this myself using the existing teTEX package on my OpenBSD systems.

The retirement of the teTEX distribution

Oddly enough, the porting process of TEX Live started with the simple need for the rcs package in a document. I had one day decided that a verbatim CVS tag in the preface of my documents looked ugly and that I should find a solution.

A search revealed the rcs package, but it was not included in teTEX. I visited the teTEX web page to see if there was a possibility of including it in future versions. It was then that I realized that teTEX development had sadly been retired for almost a year. The web page suggested that I pursue a project called “TEX Live”, so I did. I was mostly pleased with what I saw, but found the ISO disk image distribution format inconvenient, and the DVD only supplied i386 binaries for OpenBSD, which needless to say would not work on my Sun Sparc systems.

This was when I started the porting process, after an email to the ports@openbsd.org mailing list in March 2007 to see if anyone else had been working on a port. At the time I remember thinking that this was a week's work at most. How wrong I was ...

Porting

My initial build confirmed that TEX Live was quite happy to build on OpenBSD. Now I had to integrate the build with the OpenBSD “ports” build system. The “ports” build system is basically a set of instructions (in the form of Makefiles) for building third party software, whose concept was originally devised by the FreeBSD project. NetBSD also has a similar system, as does the Gentoo Linux project. The advantage of these systems is that packages need not be manually built upon each new release of the operating system, as it can be powerfully automated.

Getting TEX Live to play nice with the ports infrastructure was not easy. A lot of the TEX Live build system did not honour the GNU standard DESTDIR environment variable, which is required to fool software into installing into a fake root filesystem ready for packaging. Luckily a tool called systrace allowed me to detect these bugs and I was able to “patch them away” before the build commenced. I applied just under 40 patches to the TEX Live build system, resulting in a package named texlive_base-2007. Following the conventions of the existing teTEX port, I made the texmf tree a separate package named texlive_texmf-2007.

On May 8 2007 I posted my hopefully “completed” work onto the porting mailing list and waited.

Responses to my work were positive, but there was concern with the size of the texmf package which had exceeded 512MB. I was asked to “trim it down”, if at all possible. The next few months proved to be the most difficult stage of the port, not only because I was studying for exams as well as porting, but also because I had uncovered some nasty bus errors in when run on the sparc64 CPU architecture. I think my housemates must have thought I was chasing a lost cause, but I was not prepared to give up.

I decided to first concentrate on splitting the texmf tree. This involved learning how the (now deprecated) “TPM”4 hierarchy worked as well as the various configuration files, so that they matched the relevant texmf subset that was installed. Norbert Preining had done a similar task for Debian Linux and generously shared what he knew. Also, a lecturer at University, Peter Knaggs, who had been using TEX for a while was able to explain some of the mechanisms of a TEX system. A Python script I called MFSplit sprang into existence. This creation split the large texmf tree into three smaller counterparts (minimal, full and documentation) and helped to generate configuration files. I must admit I found this quite challenging, even frustrating at times, and the TEX Live mailing list was a invaluable resource during times of confusion.

A major cause of the aforementioned frustration was due to the slowness of my dated Sun hardware. In an attempt to find something more practical, I placed a banner on my web page asking for hardware donations. I had expected to hear nothing. Within a few days one individual donated some money for a beer, which pleasantly shocked me, but not as much as when a company contacted me saying that they wished to donate a machine to the port! The company was yellowshift LLC, a consultancy company in America that believed in giving back to open source (https://www.yellowshift.com/giving-back). Gratefully I accepted and now I am a proud owner of a Sun Blade 1000 for development of TEX LiveOpenBSD for sparc64 systems.

As for the issues, the author and a very dedicated member of the TEX community, Jonathan Kew, helped me out greatly. It proved very difficult to debug over email, so I ended up granting him remote access to my build box in order for him to look more closely at the problem. Very quickly he put together some patches which fixed the issue (and a few others too), which were committed upstream and to the port.

Integrating TEX Live into OpenBSD

On July 17 2007 the TEX Live port was committed on my behalf to the head branch of the ports tree, but not yet linked to the build as a replacement for teTEX, since further community testing was needed. Small bug fixes and cleanups were applied. Eventually, on October 11 2007, TEX Live replaced teTEX entirely for OpenBSD developer snapshots, and will certainly be included in upcoming OpenBSD-4.3. I consider this is a great personal achievement, as I had always wished I could give something back to the open source community. I have been in contact with several developers interested in developing ports of TEX Live for their operating systems, including a developer from the Macports project who succeeded in translating the OpenBSD port to their ports system. I certainly do enjoy the freedom of open source software development.

If you are running the developer branch of OpenBSD (or -current as it is known), then you can get TEX Live now from the OpenBSD FTP servers. OpenBSD 4.3 pre-orders are available now; this is a great way to help the project.

Thanks

I would like to take the opportunity to thank all of the people who have answered my questions on mailing lists, donated resources, helped me bug-fix or otherwise contributed to porting TEX Live to OpenBSD. It is greatly appreciated and I hope to meet some of you at the conference in Cork.

About the author

Allow me to introduce myself, as I am new to the TEX community. I am a student at Bournemouth University in England. As far as I can remember, I have always been fascinated by computers, starting with the Sinclair Spectrum 48K. After messing about on computers most of my childhood (and advancing through almost all of the Sinclair Spectrum models), I studied computing at college and entered the real world as a programmer for a kitchen manufacture company. During this time I learned a web scripting language inside out, programmed some really interesting industrial machinery and pulled out a lot of hair trying to interpret 20-year-old BASIC code. Having done this for two years, I felt a change was in order and enrolled for a BSc computing degree. At the time of writing I am on the 3 year of the degree, which is a “sandwich year” in which students work in industry for a year before returning to University to complete the final year. It turned out that I really liked the academic environment and wished to look into the possibility of an academic future. After enquiring if the University accepted placement students, I became a Unix systems administrator for the school of design, engineering and computing.

by 2pc

About this document ...

Porting TEX Live to OpenBSD

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -no_navigation tb92barrett.ltx

The translation was initiated by Edd on 2008-07-15

[Further HTML editing by me -dwc]


Footnotes

...BSD1
Berkeley Software Distribution
...WYSIWYG2
What you see is what you get
... Vim3
Vi Improved, http://www.vim.org
...TPM”4
TEX Package Manager


Edd 2008-07-15

Thanks to Edd for allowing us to reprint the article. Please remember to share your own experiences using OpenBSD.

(Comments are closed)


Comments
  1. By Marc Balmer (2001:8a8:1001:0:216:76ff:fe72:356c) on

    I am using TeX and LaTeX now for well over twenty years and I am really happy that we have a modern and maintained package of it available on OpenBSD. Thanks for taking the effort!

    Comments
    1. By Igor Sobrado (89.128.5.72) on

      > I am using TeX and LaTeX now for well over twenty years and I am really happy that we have a modern and maintained package of it available on OpenBSD. Thanks for taking the effort!

      I would like to thank Edd Barrett for porting TeXlive too -- an update to the TeX typesetting system was certainly required. I started using LaTeX more than fifteen years ago (it was emTeX, on a 286 computer manufactured by Nixdorf Computer AG... it required 20 MB of the 40 MB available on the hard disk drive of that computer!)

      Well, I suppose that my background in fundamental physics helps but I would recommend LaTeX to anyone interested in writing high quality documents (not only papers, or mathematical documents). For these that do not know what TeX is, I can only say that it is a tool to write documents using a descriptive markup language (in some way comparable to roff or Scribe). Current LaTeX distributions (TeXlive is the one recommended by the TeX Users Group) support a lot of packages useful for write code, music, graphs, slides...

      It is good to have TeXlive as a replacement for teTeX.

      Thanks for porting TeXlive to OpenBSD and for writing this nice article about how this work was done.

  2. By Jared (209.59.105.36) jjsolomon@gmail.com on

    I haven't used TeX for a long time, but I look forward to being able to use a couple of sane environments to do my writing again. Thanks for your work.

  3. By Predrag Punosevac (128.196.224.24) on

    I can second the previous comment. I have been using LaTeX/TeX for almost 20 years. The development of the TeX based macros has been staggering in the past couple of years. Just like you Edd, I discovered that teTeX distribution was dead by seeking a specific LaTeX package I needed for my work. After waisting couple of hours trying to back port myself macros I needed to teTeX, I found out that it was not worthy due to very complex
    font dependences. The way to go forward was just to move on to TeXLive. The only problem was that TeXLive was not ported to FreeBSD which I used to run my desktops and laptops. To much of my surprise, I discovered that TeXLive was in the port three of 4.1 current. I gave a shoot to OpenBSD and TeXLive and never looked back. Withing two weeks because of you Edd, I have not just replaced teTeX but I completely switched all my computers to OpenBSD. It might have been the most unusual way to discover the simplest and the most logical operating system in existence but sure it did work for me. Edd you ROCK man for porting TeXLive and getting me start with OpenBSD. Thanks body!!!

  4. By Anonymous Coward (24.215.82.194) on

    Well, I guess I'm a mere TeX newbie since I've only been using it for ... hmm ... several years. Still, I'm relieved someone has picked up where tetex left off (I wouldn't much care for going back to a WP). I'm particularly glad someone else has ported the effort to OpenBSD. Thanks!

  5. By jason (TheDudeAbides) jason@snakelegs.org on http://www.snakelegs.org

    Great job, Edd.

    XeTeX is really a pleasure [one of these days I must figure out how to configure Kile for it....]. Pick some decent fonts, organize your thoughts, and it's pretty simple to create authoritative-looking documents, as compared, to say, some hellish alternative.

    Great job, again.

  6. By Paul 'WEiRD' de Weerd (weerd) weerd@weirdnet.nl on http://www.weirdnet.nl/

    I'd like to add my gratitude to the growing list. Thanks, Edd, for your work in porting TeXLive to OpenBSD. I've been using TeX on and off for about 13 years now, never for very exciting stuff, but the last years it has always been on OpenBSD so this port is quite important to me.

    Thanks, also, for writing up your experience in porting, it was an interesting read.

  7. By Didi (137.138.34.41) ribalba@gmail.com on www.ribalba.de

    Good work Edd. :) We never thought you could not do it.

  8. By Anonymous Coward (153.96.215.75) on

    2007 is a typo right?

    Comments
    1. By Igor Sobrado (89.128.5.72) on

      > 2007 is a typo right?

      I think that it is not a typo. TeXlive is available on OpenBSD 4.3. The article was written some months ago and translated to HTML recently.

    2. By Anonymous Coward (128.196.224.24) on

      > 2007 is a typo right?

      No, It is not typo. TeXLive has annual release cycle. TeXLive 2007 was released in May of 2007. TeXLive 2008 is still in preparation.

  9. By Lawrence Teo (lteo) lteo.openbsd1 ! calyptix.com on http://labs.calyptix.com/

    It has been more than two years since I last used TeX in grad school, but I'm sure this will be beneficial to a lot of people.

    On another note, Edd, you just motivated me to be more persistent at finishing up the items on my personal OpenBSD wishlist and contributing my work to the project! :)

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]