Subject: pkg/5255: teTeX package ignores `CFLAGS'
To: None <gnats-bugs@gnats.netbsd.org>
From: None <fredb@fb.sa.enteract.com>
List: netbsd-bugs
Date: 04/05/1998 06:03:59
>Number:         5255
>Category:       pkg
>Synopsis:       patched Makefile callously overrides the CFLAGS environment|global variable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr  5 04:20:00 1998
>Last-Modified:
>Originator:     Frederick Bruckman
>Organization:
>Release:        04/04/98
>Environment:
System: NetBSD fb.sa.enteract.com 1.3E NetBSD 1.3E (FB) #15: Sat Apr 4 11:40:30 CST 1998 fredb@fb.sa.enteract.com:/usr/src/sys/arch/mac68k/compile/FB mac68k


>Description:
	The file pkgsrc/print/teTeX/work/teTeX-src-0.4/Makefile, which is produced by applying
	patch-aa to Makefile.orig, fails to do the right thing with the CFLAGS variable. 
	From reading the INSTALL document, it can be inferred that the authors of the distribution 
	intended for the user to edit the Makefile directly. I prefer to set CFLAGS in my 
	environment. An increasing number of packages are OK with that.
>How-To-Repeat:
        Set the CFLAGS variable in your environment, or in /etc/mk.conf,

                cd /usr/pkgsrc/print/teTeX ; make

        now observe that gmake completely ignores the value you set.
>Fix:
	You only need to change one line in the makefile. gmake doesn't understand the ?= construction,
	so you have to use

		CFLAGS := -O2 $(CFLAGS) -pipe -DHAVE_EXTERN_SYS_ERRLIST

	instead. I've reproduced the entire, reconstructed, patch-aa file below, for convenience.

--- Makefile.orig       Fri Feb 14 04:58:11 1997
+++ Makefile    Sun Apr  5 05:01:29 1998
@@ -8,10 +8,10 @@
 #=========================================================================
 VERSION = 0.4
 PATCHLEVEL = 7
-TETEXDIR=/usr/local/teTeX
+TETEXDIR=$(PREFIX)
 # the following should be best for a pentium
 # -O2 -s -m486 -malign-jumps=2 -malign-loops=2 -malign-functions=2
-CFLAGS = -O2
+CFLAGS := -O2 $(CFLAGS) -pipe -DHAVE_EXTERN_SYS_ERRLIST

 # For "real" 64bit OS, e.g. Digital Unix 4.0. Irix6?, use:
 # CFLAGS += -DPOINTER_IS_NOT_INT
@@ -21,7 +21,7 @@

 # -s makes problems on some platforms. We run strip after "make install",
 # so we really do not need -s here.
-LDFLAGS        =
+LDFLAGS        = -s

 # The shared libXmu from OpenWindows is buggy on some SunOS 4.1.3 systems.
 # If you run into this problem (when linking xdvi), set BROKEN_SUNOS_LIBXMU
@@ -70,24 +70,24 @@
 # set USE_DIALOG=false if compiling dialog causes trouble on your system
 # texconfig will still run in command-mode
 #=========================================================================
-override USE_DIALOG=true
+USE_DIALOG=false

 #=========================================================================
 # set USE_NCURSES=false if you want to use your system curses instead of
 # the ncurses library.
 #=========================================================================
-override USE_NCURSES=true
+USE_NCURSES=false

 #=========================================================================
 # set HAVE_NCURSES=true if you want to use an already installed version of
 # the ncurses library.
 #=========================================================================
-override HAVE_NCURSES=false
+HAVE_NCURSES=true

 #=========================================================================
 # X stuff
>Audit-Trail:
>Unformatted: