[texworks] Mac build available here

Jjgod Jiang gzjjgod at gmail.com
Wed Mar 23 19:27:43 CET 2011


On Wed, Mar 23, 2011 at 12:40 PM, Stefan Löffler <st.loeffler at gmail.com> wrote:
> Thanks, this is awesome. I'll add a link to it to the homepage (if I may).


> BTW, svn trunk is functionally identical with 0.4.0 at the moment. This
> will obviously change in the future, but for now I think it would be
> best to keep to the 0.5 (=trunk) series anyway until we've worked out a
> good way of general building and that has been tested thoroughly.
>> I called it "quick" because I don't want to mess up with all the different
>> SDKs and universal binaries stuff, but this build should fix most Mac users'
>> needs.
> I understand. Nevertheless, I have a few questions/requests - maybe you
> can reply to some of them:
>  * Could you give a brief overview what you did to compile Tw? I'd like
> to start a section on the Wiki so others can reproduce your build. I can
> fill in some gaps (like instructions about download packages, etc.), but
> it would be great if you could provide a list of prerequisites, and the
> non-standard build commands (if any).

The most tricky part is poppler, I will describe the details below.

hunspell is installed with homebrew, a simple "brew install hunspell" works.

Attached a diff of what I changed in TeXworks.pro, just some small changes:

- Use Mac OS X 10.5 SDK and gcc 4.2 instead
- Add /usr/local/include and /usr/X11 so that header files for fontconfig,
  etc. can be found.
- Add /usr/X11/lib to library path so that system provided fontconfig lib
  can be used.

>  * In particular, did you build poppler without fontconfig? If so, how?
> Did you use any Mac-specific patches?

I built poppler with homebrew: brew install poppler --with-qt4 (I tuned
the homebrew formula of poppler a little bit to use my own Qt build, but
the one installed with homebrew should be good enough)

The problem here is GlobalParams header used in TeXworks is no longer
available publicly with poppler anymore (it seems poppler kept it as an
internal header), poppler-config.h is not installed either, so I extract
the poppler archive downloaded by homebrew, did a configure myself,
copy the poppler-config.h and GlobalParams.h to /usr/local/include/poppler,
then it turns out GlobalParams.h also depends on goo/*.h header files,
so I just copied goo/*.h to /usr/local/include/goo as well. Since these
are just header file copying, there is no need to build poppler again.

Another problem is deployment, because TeXworks binaries built
like this will link to libraries in local paths, which is not suitable
for packaging and shipping. Luckily macdeployqt from Qt works almost
perfectly, run it with TeXworks.app as argument, it will recursively
resolve all the dependencies and copy them to Frameworks directory of
TeXworks.app/Contents. A slight turning here is that it seems macdeployqt
also copied some Qt frameworks we never used, like QtMultimedia, I
kept only QtCore, QtGui, QtXml, QtScript and QtScriptTools, should be

>  * As a Mac developer, do you have any pointers to information regarding
> different SDKs and universal builds? As a non-Mac person, I'm still
> having trouble understanding all the technicalities involved.

I decided not to use Mac OS X 10.4u SDK because it doesn't support 64-bit
Cocoa, which is the normal configuration I build Qt with (there is a huge
difference between Qt/Cocoa and Qt/Carbon, the latter is less actively

10.5 SDK turned out to be the best solution, to enable universal binaries
we just need to make sure other libraries we linked also have binary of
the architecture we need. For instance, if we want a TeXworks with x86_64,
x86 and ppc support, it means:

- Qt has to be built in all three architectures
- hunspell must be built in all three architectures (so I need to change
  the CFLAGS/LDFLAGS in hunspell formula if I want to build it with
- poppler must be built in all three architectures
- Other libraries we depend directly or indirectly must have the binary
  for all three architectures (seems to be the case on 10.6 at least,

>  * As a Qt developer, do you have any advice how to do universal builds
> for Qt? I think it would be no problem for people experimenting with
> building, say, hunspell or poppler with different config flags. But for
> Qt (which takes hours to build) this would be really problematic, so any
> hints are very welcome.

Simply configure Qt with -arch x86 ppc x86_64 should do.

> Thanks again for everything you shared so far (and maybe share in the
> future),

You're welcome.

- Jiang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TeXworks.pro.diff
Type: application/octet-stream
Size: 1099 bytes
Desc: not available
URL: <http://tug.org/pipermail/texworks/attachments/20110323/e2b040d0/attachment.obj>

More information about the texworks mailing list