Opened 12 years ago

Closed 5 years ago

#16055 closed submission (fixed)

TeXworks -- TeX previewer for Mac OS X -- uses the Qt4 GUI framework

Reported by: jens.traube@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: raimue (Rainer Müller), mf2k (Frank Schima), mojca (Mojca Miklavec), cooljeanius (Eric Gallager)
Port: TeXworks

Description

TeXworks is a TeX previewer for Mac OS X, Linux, and Windows. It uses the Qt4 GUI framework and the Poppler PDF rendering library (compiled with Qt4 wrapper). The TeXworks project has been founded by Jonathan Kew (www.sil.org), the developer of XeTeX. It is inspired by TeXShop, the only TeX previewer with a relative simple user interface. Jonathan Kew: "TeXworks aims to provide a simple TeX environment based on modern standards (including Unicode encoding and PDF output by default) with an uncluttered interface that does not overwhelm the newcomer. It is built using cross-platform, open-source tools and libraries, so as to be available on all today's major operating systems, with a native look and feel for each." ( --> tug.org/tug2008/abstracts/kew.pdf )

Attachments (8)

Portfile (4.2 KB) - added by jens.traube@… 12 years ago.
Portfile_v2 (4.2 KB) - added by jens.traube@… 12 years ago.
Portfile -- version 2
Portfile_v3 (5.0 KB) - added by jens.traube@… 12 years ago.
Portfile -- version 3
Portfile_v4 (5.8 KB) - added by jens.traube@… 12 years ago.
Portfile -- version 4
Portfile_v5 (6.6 KB) - added by jens.traube@… 12 years ago.
Portfile -- version 5
patch-destdir.diff (352 bytes) - added by mojca (Mojca Miklavec) 7 years ago.
Tiny patch, see http://code.google.com/p/texworks/issues/detail?id=635
Portfile_v6 (1.3 KB) - added by mojca (Mojca Miklavec) 7 years ago.
CMake-based installation of TeXworks
Portfile_v7 (1.3 KB) - added by mojca (Mojca Miklavec) 7 years ago.
the patch from v6 has been fixed upstream, so no need for a patch any longer

Download all attachments as: .zip

Change History (34)

comment:1 Changed 12 years ago by jens.traube@…

Sorry, the last attachment "TeXworks.pro.diff" is not necessary. Please, ignore it.

Changed 12 years ago by jens.traube@…

Attachment: Portfile added

comment:2 Changed 12 years ago by jens.traube@…

see also Ticket #16056 -- enhancements of port poppler

comment:3 Changed 12 years ago by raimue (Rainer Müller)

Do I understand this correctly, does this ticket depend on #16056?

comment:4 Changed 12 years ago by raimue (Rainer Müller)

First of all, thanks for your submission of this Portfile. But here are some additional comments and concerns:

  • Why is the version empty? It should also be tied to a specific svn revision with svn.tag
  • revision should be a positive integer number, default value is 0. The default revision 0 can be left out.
  • The homepage should be only one URL (for port gohome)
  • I don't think svn.pre_args-append and svn.post_args-append are needed
  • What is the purpose of the post-fetch phase?
  • Don't use cd in the Portfile, it is deprecated and will not work in future versions
  • Is this code for determining MACOSX_DEPLOYMENT_TARGET really needed? There is already an [option macosx_deployment_target] which contains the right value for the current system. I think it can be reused here.
  • Wouldn't it be easier to use a patch and a few reinplaces instead of this long post-patch phase?
  • There should be no need to use system to copy the TexWorks.app, you can use file copy
  • Please file a separate ticket for the wrong paths in the pkg-config files for qt4-mac as this needs to be fixed. Would be good to add a ticket number for reference so this workaround can be removed once it is fixed.

Changed 12 years ago by jens.traube@…

Attachment: Portfile_v2 added

Portfile -- version 2

comment:5 Changed 12 years ago by jens.traube@…

Thank you for your interest in reviewing my port file.

To your question about Ticket #16056: You are right, Ticket #16055 depends on Ticket #16056. The current port file of poppler does disable the build of the Qt4 bindings. Also, there are a lot of dependencies unnecessary for TeXworks. I attached a pdf file, which shows you the port dependencies of poppler without any variants and the different variants I propose.

Now to your questions about my portfile of TeXworks (I attached a revised portfile "Portfile_v2")

(1) Why is the version empty?

In the subversion repository there still is no release branch. The "TeXworks" project is still in it's infancy, Jonathan Kew call it a pre-release version. As I know, he first presented it on a conference in Bachotek, Poland, (April 30 to May 4, 2008 -- multimedia recordings of the talks: http://www.river-valley.tv/conferences/bachotex2008/).

I think, it would be to early to select a specific subversion revision number. Therefore, I suggest a "dynamic" version number: It consists of the date of the last commit and the number of that revision (HEAD). If you leave the variable "svn.tag" empty, you get the latest revision out of the subversion repository (revision "HEAD"). For instance, on my computer:

$ port installed TeXworks
The following ports are currently installed:
  TeXworks @20080720_105_0 (active)
$ 

TeXworks @DateOfLastCommit_NumberOfLastSVNRevision_NumberOfPortfileRevision

Perhaps my port should be named "TeXworks-devel" ?

(2) revision (of portfile) should be a positive integer number

I corrected my mistake. See also (5) "What is the purpose of the post-fetch phase?"

(3) The homepage should be only one URL

Unil now, I did not know of an option "gohome", because in the man page of "port" it is not mentioned. I corrected my mistake and put the second web address into the long description.

(4) svn arguments

The synopsis of the svn checkout command is:

svn checkout URL[@REV]... [PATH]

The manual of svn tells that, if "PATH" is omitted, the basename of the URL will be used as the destination. The URL of TeXworks is:

svn.url http://texworks.googlecode.com/svn/trunk/

Therefore, the svn command would create a directory named "trunk". This is ok, and "svn.post_args-append" is really not necessary. But the variable "worksrcdir" must be set to this name: "trunk". The default value of variable "worksrcdir" is ${distname}, which is undefined with a svn fetch, I think.

Also "svn.pre_args-append" is not necessary, but in the debug mode of macports the checkout procedure echoes all transmitted file names to the standard output.

(5) What is the purpose of the post-fetch phase?

The purpose is to make the missing value of variable "version". It is the "dynamic" version number of TeXworks, about what I told you under (1) "Why is the version empty?".

The first line is to get the info about the working copy from the subversion repository, formatted in xml. The second and third line parses this text for subversion revision number and the date of last commit. The fourth line makes the value of variable "version". MacPorts appends the svn revision.

During this writing, I discovered an error: I named the variable for the subversion revision "revision", but this name has already been given for the variable, which takes the revision number of the portfile.

(6) Don't use cd in the Portfile

But it is necessary to change to the directory ${worksrcpath}, what else can I do?

I made the following test in "post-patch":

    puts [pwd]
    cd ${worksrcpath}
    puts [pwd]

The first "puts" command outputs the path to the portfile of port "hunspell", one of the needed ports for TeXworks.

(7) Is this code for determining MACOSX_DEPLOYMENT_TARGET really needed?

Once again, I made a test in "post-patch":

    puts "----------------------------------"
    puts [option {macosx_deployment_target}]
    puts "----------------------------------"

It outputs nothing, is there something wrong with my test?

(8) Wouldn't it be easier to use a patch and a few reinplaces instead of this long post-patch phase?

I am not sure about that. My first attempt was to provide a patch file, but then I have doubts about this approach. The file "TeXworks.pro" is subject to changes. Until now, there is no certain release of TeXworks, and therefore no binding of source release version and corresponding patch files.

(9) There should be no need to use system to copy the TexWorks.app, you can use file copy

You are right, I edited it.

(10) Please file a separate ticket for the wrong paths in the pkg-config files for qt4-mac as this needs to be fixed. Would be good to add a ticket number for reference so this workaround can be removed once it is fixed.

See Ticket #16120

comment:6 Changed 12 years ago by jens.traube@…

Some additional informations to the "post-patch" procedure:

The interesting part of file "TeXworks.pro" is the "macx" block.

Before the "post-patch" procedure:

macx {
    INCLUDEPATH += /usr/local/include/poppler
    INCLUDEPATH += /usr/local/include/poppler/qt4

    LIBS += -L/usr/local/lib
    LIBS += -lpoppler-qt4
    LIBS += -lhunspell-1.2

    QMAKE_INFO_PLIST = TeXworks.plist

    ICON = TeXworks.icns
}

After the "post-patch" procedure:

macx {
    INCLUDEPATH += /opt/local/include/poppler
    INCLUDEPATH += /opt/local/include/poppler/qt4
 
    LIBS += -L/opt/local/lib
    LIBS += -lpoppler-qt4
    LIBS += -lhunspell-1.2

    QMAKE_INFO_PLIST = TeXworks.plist

    ICON = TeXworks.icns
    INCLUDEPATH += /opt/local/include/hunspell
    INCLUDEPATH += /opt/local/include
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
}

comment:7 in reply to:  5 Changed 12 years ago by raimue (Rainer Müller)

Replying to jens.traube@t-online.de:

(1) Why is the version empty? ==

In the subversion repository there still is no release branch. The "TeXworks" project is still in it's infancy, Jonathan Kew call it a pre-release version. As I know, he first presented it on a conference in Bachotek, Poland, (April 30 to May 4, 2008 -- multimedia recordings of the talks: http://www.river-valley.tv/conferences/bachotex2008/).

I think, it would be to early to select a specific subversion revision number. Therefore, I suggest a "dynamic" version number: It consists of the date of the last commit and the number of that revision (HEAD). If you leave the variable "svn.tag" empty, you get the latest revision out of the subversion repository (revision "HEAD"). [...] [...] Perhaps my port should be named "TeXworks-devel" ?

The problem with always using HEAD is that it is untested. So you release a versions for end-users here which was tested by nobody. HEAD may not compile at all, HEAD may have major bugs etc. So I personally would prefer to tie it to one specific svn revision which is known to compile and was tested by the maintainer. Building from HEAD is just not realiable.

(4) svn arguments ==

The synopsis of the svn checkout command is:

svn checkout URL[@REV]... [PATH]

The manual of svn tells that, if "PATH" is omitted, the basename of the URL will be used as the destination. The URL of TeXworks is:

svn.url http://texworks.googlecode.com/svn/trunk/

Therefore, the svn command would create a directory named "trunk". This is ok, and "svn.post_args-append" is really not necessary. But the variable "worksrcdir" must be set to this name: "trunk". The default value of variable "worksrcdir" is ${distname}, which is undefined with a svn fetch, I think.

Ah, I see. ${distname} is ${name}-${version} by default and is independent of fetch.type.

Also "svn.pre_args-append" is not necessary, but in the debug mode of macports the checkout procedure echoes all transmitted file names to the standard output.

Hm, sounds good, I will look into adding something like this as default. Leave this as it is for now.

(5) What is the purpose of the post-fetch phase? ==

The purpose is to make the missing value of variable "version". It is the "dynamic" version number of TeXworks, about what I told you under (1) "Why is the version empty?".

Ah! Now I understand it. Looked like debug output only for me at first.

(6) Don't use cd in the Portfile ==

But it is necessary to change to the directory ${worksrcpath}, what else can I do?

Use absolute path names like ${worksrcpath}/foo. I wrote a little FAQ entry about this.

(7) Is this code for determining MACOSX_DEPLOYMENT_TARGET really needed? ==

Once again, I made a test in "post-patch": [...] It outputs nothing, is there something wrong with my test?

Sorry, unfortunately this default value is only available in trunk, but not in 1.6.0.

MacPorts base uses set macosx_version [expr 10.0 + ($os_major - 4) / 10.0] to determine the version of Mac OS X. May be shorter as what you have now and can be replaced with macosx_deployment_target later anyway.

(10) Please file a separate ticket for the wrong paths in the pkg-config files for qt4-mac as this needs to be fixed. Would be good to add a ticket number for reference so this workaround can be removed once it is fixed. ==

See Ticket #16120

Thanks!

With the only concern being the version thing as noted above, I have no other objections to commit this port after #16056 has been resolved.

You did a good job in putting this Portfile together, are you willing to become the maintainer of this port?

comment:8 Changed 12 years ago by raimue (Rainer Müller)

Cc: raimue@… added

Changed 12 years ago by jens.traube@…

Attachment: Portfile_v3 added

Portfile -- version 3

comment:9 Changed 12 years ago by jens.traube@…

(1) I eliminated all cd commands and put in absolute path names, where it is required.

(2) I set the current version of the port "TeXworks" to 20080720_105, which corresponds until now to the HEAD revision, but compiles and runs on my computer (PPC, OS 10.4.11).

(3) I introduced a variant "HEAD".

(4) The variable "svn.tag" is now set to a value, which is derived from the value of variable "version" (20080720_105 --> 105). This is done in the pre-fetch phase, if variant "HEAD" is NOT selected.

(5) The value of version gets overwritten in the post-fetch phase, if variant "HEAD" is selected.

Do you agree with these changes?

I did not test the port under OS 10.5, but Jonathan Kew wrote: "The current version of TeXworks has been successfully built with Xcode (using gcc 4) on Mac OS X 10.4 and 10.5". I myself have already installed Leopard on a different partition, but to date I prefer to use Tiger.

You asked me, if I would like to become the maintainer of this port. I am not sure about that, I spent a lot of time with the ports "poppler" and "TeXworks", and "poppler" is still unresolved. Let me postpone my answer to your question until poppler is resolved.

Finally, I would like to ask your opinion about my enhancements of port poppler (#16056). I suggested some rather unusual procedures to make possible a minimal installation of poppler.

comment:10 Changed 12 years ago by rhwood@…

This port looks good.

You might want to replace the build dependency on port:subversion with bin:svn:subversion since Leopard (or its XCode--I'm not sure which) includes subversion, and our subversion is a hefty build that may not be required. This should be in line with MacPorts recommended practices since svn is not linked against, but is only used to download the source code.

TeXworks does not look in /opt/local/bin by default. Can this be fixed when building it in MacPorts?

Should this not install a tex version if one is not already installed by the user?

Instead of puts for output use ui_msg, ui_error, ui_debug, or ui_info, since clients of the MacPorts API will not always see what is directly sent to STDOUT.

You basically want to be able to ensure that the port "just works" for the user. This is especially true of apps that wind up in /Applications/MacPorts

Changed 12 years ago by jens.traube@…

Attachment: Portfile_v4 added

Portfile -- version 4

comment:11 in reply to:  10 Changed 12 years ago by jens.traube@…

Replying to rhwood@macports.org: I revised my Portfile (Portfile_v4) and considered all your suggestions.

comment:12 Changed 12 years ago by milosh@…

Port: TeXworks added

Note that texlive_base does not provide latex, pdflatex. To get a real working tex installation, texlive is the port to use.

Side note, caps in port names should be avoided.

Changed 12 years ago by jens.traube@…

Attachment: Portfile_v5 added

Portfile -- version 5

comment:13 in reply to:  12 Changed 12 years ago by jens.traube@…

Replying to milosh@…:

I attached version 5 of my portfile and considered all your suggestions:

(1) Now there is a variant "texlive"

(2) No caps in the portname any more

Additionally, if variant "HEAD" is not selected, the revision 168 of TeXworks (2008-09-26) gets installed. To make that possible, it was necessary for me to edit the portfile in some small details.

comment:14 Changed 12 years ago by mf2k (Frank Schima)

Cc: macsforever2000@… added

Cc Me!

comment:15 Changed 12 years ago by jmroot (Joshua Root)

Type: enhancementsubmission

comment:16 Changed 12 years ago by (none)

Milestone: Port Submissions

Milestone Port Submissions deleted

comment:17 Changed 11 years ago by raimue (Rainer Müller)

Keywords: lack-of-interest added

comment:18 Changed 11 years ago by raimue (Rainer Müller)

Resolution: wontfix
Status: newclosed

This ticket has been open a long time without any progress, closing.

comment:19 Changed 7 years ago by mojca (Mojca Miklavec)

Resolution: wontfix
Status: closedreopened

I'm reopening the ticket because I'm also interested in seeing the port in MacPorts (if nothing else the upstream doesn't provide the binary packages for 10.7 any more).

Developers made a few official source releases, but it might be better to use SVN at least until 0.5.0 gets released.

I didn't know about this ticket when creating the Portfile, so feel free to include anything I left out.

Changed 7 years ago by mojca (Mojca Miklavec)

Attachment: patch-destdir.diff added

comment:20 Changed 7 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

Changed 7 years ago by mojca (Mojca Miklavec)

Attachment: Portfile_v6 added

CMake-based installation of TeXworks

comment:21 Changed 7 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:22 in reply to:  19 Changed 7 years ago by cooljeanius (Eric Gallager)

Replying to mojca@…:

I'm reopening the ticket because I'm also interested in seeing the port in MacPorts

You might want to remove the "lack-of-interest" keyword that raimue added, then.

comment:23 Changed 7 years ago by mf2k (Frank Schima)

Keywords: tex latex editor qt4 lack-of-interest removed
Version: 1.6.0

Changed 7 years ago by mojca (Mojca Miklavec)

Attachment: Portfile_v7 added

the patch from v6 has been fixed upstream, so no need for a patch any longer

comment:24 Changed 7 years ago by mojca (Mojca Miklavec)

Is any original contributor (Jens?) still following this and interested? Are there any particular "feature requests" that I left out? The initial port was relatively complicated and I still didn't analyze it to see whether I forgot something obvious.

The spellchecker might need some testing (I didn't check how to enable it yet).

comment:25 Changed 7 years ago by jmroot (Joshua Root)

Cc: mf2k@… added; macsforever2000@… removed

comment:26 Changed 5 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: reopenedclosed

Committed in r146531.

Support for Qt 5 requires #47025 and some debugging, but I left the (broken) variant there.

Note: See TracTickets for help on using tickets.