Bug 207230

Summary: textproc/hs-pandoc: Make TEX an option to avoid installing TeX from ports when not necessary
Product: Ports & Packages Reporter: Jan Martin Mikkelsen <janm>
Component: Individual Port(s)Assignee: Gabor Pali <pgj>
Status: Closed FIXED    
Severity: Affects Only Me CC: pgj
Priority: --- Flags: pgj: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Add "TEX" option to textproc/hs-pandoc port none

Description Jan Martin Mikkelsen 2016-02-15 21:56:12 UTC
Created attachment 167054 [details]
Add "TEX" option to textproc/hs-pandoc port

Many uses of textproc/hs-pandoc don't require PDF generation, or are on systems where TeX is managed separately to the ports system.

This patch adds a "TEX" option to the textproc/hs-pandoc port, defaulting to enabled. This keeps the current default behaviour and allows turning off the TeX dependency.
Comment 1 Gabor Pali freebsd_committer freebsd_triage 2016-02-16 21:43:03 UTC
Comment on attachment 167054 [details]
Add "TEX" option to textproc/hs-pandoc port

As I can see in the proposed patch, it also replaces the USE_TEX line with TEX_USE.  I have not found this make(1) variable anywhere in the ports tree, could you please tell me where it came from?

Anyhow, bsd.tex.mk says that "Ports which depend on TeX should use USE_TEX".  Am I missing something here?
Comment 2 Jan Martin Mikkelsen 2016-02-16 22:20:52 UTC
(In reply to Gabor Pali from comment #1)

It is from bsd.options.mk:

# ${opt}_USE=   FOO=bar         When option is enabled, it will  enable
#                               USE_FOO+= bar
#                               If you need more than one option, you can do
#                               FOO=bar,baz and you'll get USE_FOO=bar baz

See section 5.12.3.2 of the porters handbook:

https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-options.html

So a port with:

OPTIONS_DEFINE=	TEX
OPTIONS_DEFAULT=	TEX
TEX_DESC=	Include TeX for PDF generation
TEX_USE=	TEX=texmf:run

when built with WITH=TEX (or where TEX is a default option as in this case) gives:

USE_TEX=texmf:run

When the port is build with WITHOUT=TEX there is no USE_TEX variable set.

The point here is that the port only depends on TeX when the port is use to build PDFs and TeX has not been installed by non-port means. There are uses of the port where one or both of those are not true, and installing ports TeX gets in the way of the rest of the system.

There is probably a good argument for not calling option TEX but calling it PDFGEN or similar. I don't mind what the option is called; I just want to be able to turn it off.

For example:

OPTIONS_DEFINE=	PDFGEN
OPTIONS_DEFAULT=	PDFGEN
PDFGEN_DESC=	Include TeX for PDF generation
PDFGEN_USE=	TEX=texmf:run
Comment 3 Gabor Pali freebsd_committer freebsd_triage 2016-02-18 13:43:29 UTC
(In reply to janm from comment #2)

Aw, indeed.  Thanks for the detailed explanation, now it completely makes sense.  I already understood the reasoning behind and I also agree with the purpose.  I just did not see how this works, because apparently I misparsed the name of the variable.
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-02-19 20:45:16 UTC
A commit references this bug:

Author: pgj
Date: Fri Feb 19 20:44:46 UTC 2016
New revision: 409203
URL: https://svnweb.freebsd.org/changeset/ports/409203

Log:
  - Make dependency on TeX optional

  PR:		207230
  Submitted by:	janm@transactionware.com
  Obtained from:	FreeBSD Haskell

Changes:
  head/textproc/hs-pandoc/Makefile
Comment 5 Gabor Pali freebsd_committer freebsd_triage 2016-02-19 20:56:06 UTC
The version with the PDFGEN options has been added to the port.  Thank you for your submission!