Source: montage
Version: 6.0+dfsg-2
Tags: patch upstream
User: [email protected]
Usertags: rebootstrap
montage fails to cross build from source, because its build system is
insane. Part of that is already reported as #915163, but there are two
other aspects that stick:
* It tends to stuff compiler flags into the CC variable. When
dh_auto_build supplies CC, those flags get lost. It is much better to
store them in CFLAGS.
* While it uses $(CC) most of the time, it hard codes gcc in a few
places, so dh_auto_build has now way of substituting the compiler.
The attached patch fixes these aspects while still leaving the failure
propagation (#915163) as is. The patch makes montage cross build
successfully. In the presence of #915163, I cannot quite tell whether
that's enough. Please consider applying it.
Helmut
--- montage-6.0+dfsg.orig/lib/src/svc/Makefile
+++ montage-6.0+dfsg/lib/src/svc/Makefile
@@ -1,4 +1,4 @@
-CC = gcc -g -I. -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -g -I. -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
libsvc.a: svclib.o structlib.o
ar rv libsvc.a svclib.o structlib.o
--- montage-6.0+dfsg.orig/lib/src/json/Makefile
+++ montage-6.0+dfsg/lib/src/json/Makefile
@@ -1,4 +1,4 @@
-CC = gcc -g -fPIC -I. -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -g -fPIC -I. -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
libjson.a: jsonlib.o
ar rv libjson.a jsonlib.o
--- montage-6.0+dfsg.orig/MontageLib/Viewer/Makefile.LINUX
+++ montage-6.0+dfsg/MontageLib/Viewer/Makefile.LINUX
@@ -9,9 +9,9 @@
DATA_DIR = $(shell cd ../../data; pwd)
-CC = gcc -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -fPIC \
- -DFONT_DIR='"$(DATA_DIR)/fonts/"'
-CFLAGS += -I. -I.. -I../../lib/include -I../../lib/freetype/include \
+CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c99 -fPIC \
+ -DFONT_DIR='"$(DATA_DIR)/fonts/"' \
+ -I. -I.. -I../../lib/include -I../../lib/freetype/include \
-I../../lib/freetype/include/freetype2 -I../../Montage
LIBS = -L../../lib -lwcstools -lcoord -lcfitsio -ljpeg -llodepng -lmtbl -ljson -lcmd \
-L../../lib/freetype/lib -lfreetype -lm
@@ -20,7 +20,7 @@
$(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c
mViewer: mViewer.o montageViewer.o mViewer_graphics.o mViewer_grid.o
- $(CC) -o mViewer mViewer.o montageViewer.o mViewer_graphics.o mViewer_grid.o \
+ $(CC) $(CFLAGS) -o mViewer mViewer.o montageViewer.o mViewer_graphics.o mViewer_grid.o \
../util/checkHdr.o \
../util/checkWCS.o \
$(LIBS)
--- montage-6.0+dfsg.orig/MontageLib/Makefile
+++ montage-6.0+dfsg/MontageLib/Makefile
@@ -93,7 +93,7 @@
FitExec/montageFitExec.o \
DiffFitExec/montageDiffFitExec.o \
ProjExec/montageProjExec.o
- -gcc -shared $(SO_FLAG) -o libmontage.so \
+ -$(CC) -shared $(SO_FLAG) -o libmontage.so \
util/checkFile.o util/checkHdr.o util/checkWCS.o \
util/debugCheck.o util/filePath.o \
Add/montageAdd.o \
--- montage-6.0+dfsg.orig/ancillary/Makefile
+++ montage-6.0+dfsg/ancillary/Makefile
@@ -1,8 +1,8 @@
HPXcvt: HPXcvt.o
- gcc -std=gnu99 -o HPXcvt HPXcvt.o -L../lib -lcfitsio -lm
+ $(CC) -std=gnu99 -o HPXcvt HPXcvt.o -L../lib -lcfitsio -lm
HPXcvt.o: HPXcvt.c
- gcc -std=gnu99 -g -O2 -I../lib/include -c -o HPXcvt.o HPXcvt.c
+ $(CC) -std=gnu99 -g -O2 -I../lib/include -c -o HPXcvt.o HPXcvt.c
install:
cp HPXcvt ../bin