FS#23906 - [openjpeg] have a way to set custom CFLAGS, LDFLAGS

Attached to Project: Arch Linux
Opened by Kristoffer Tidemann (ktide) - Saturday, 23 April 2011, 20:26 GMT
Last edited by Jan de Groot (JGC) - Monday, 16 April 2012, 14:12 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The Makefile doesn't make use of LDFLAGS and defines it's own CFLAGS. The only and kinda shitty way to get *both* included during compile and link is to do something like this in the PKGBUILD:

make CC="gcc ${CFLAGS} ${LDFLAGS}"

The patch from Debian that "fixes" the Makefile is pretty stupid and could be adjusted instead of doing it this way.
This task depends upon

Closed by  Jan de Groot (JGC)
Monday, 16 April 2012, 14:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  openjpeg 1.5.0 takes LDFLAGS and CFLAGS into account.
Comment by Rémy Oudompheng (remyoudompheng) - Wednesday, 27 April 2011, 06:13 GMT
Your "fix" would make LDFLAGS appear at the beginning of the command line, which is plain wrong, and make custom CFLAGS overridden by CFLAGS in the Makefile.
You'd better use cmake if you want a proper, more complete build system.
Comment by Kristoffer Tidemann (ktide) - Wednesday, 27 April 2011, 13:28 GMT
You are wrong, this builds fine and maintains choices by upstream in regards to CFLAGS by including them at the end while still allowing user-specified CFLAGS/LDFLAGS.
Comment by Rémy Oudompheng (remyoudompheng) - Wednesday, 27 April 2011, 18:32 GMT
I didn't say it wouldn't build. I said putting LDFLAGS violates a many-dozens-of-year-old Unix tradition (I don't care if it works or not, it's just not how it's supposed to be done), and that allowing custom CFLAGS is pointless if you allow upstream CFLAGS to override them. What if I want to disable optimization for a debugging build?
Comment by Kristoffer Tidemann (ktide) - Wednesday, 27 April 2011, 20:33 GMT
Adjusting the patch then:

+COMPILERFLAGS = $(EXTRA_CFLAGS) -ffast-math -std=c99 -fPIC
and
+ $(CC) -shared -Wl,-soname,$(LIBNAME) $(LDFLAGS) -o $@ $(MODULES) -lm

PKGBUILD:
make EXTRA_CFLAGS="${CFLAGS/-O2/-O3}"

or something similar

Loading...