Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 720354 - net-misc/suite3270-3.* does not honor $CFLAGS
Summary: net-misc/suite3270-3.* does not honor $CFLAGS
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL: https://sourceforge.net/p/x3270/code/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-02 00:42 UTC by Adrien Dessemond
Modified: 2021-01-14 23:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for suite3270-3.6_p8.ebuild (suite3270-3.6_p8.ebuild.patch,435 bytes, patch)
2020-05-02 01:40 UTC, Adrien Dessemond
Details | Diff
Fix for 'CFILES=' statements in Makefiles (00_suite3270.3.x-bug-720354.patch,5.14 KB, patch)
2020-05-02 02:05 UTC, Adrien Dessemond
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien Dessemond 2020-05-02 00:42:27 UTC
When compiled with its vailla Makefiles, suite 3270 does not take into account the  currently defined CFLAGS.

$ emerge --info | grep CFLAGS
emerge --info | grep CFLAGS
CFLAGS="-O3 -pipe -march=native -fomit-frame-pointer -fopt-info-vec -mindirect-branch=thunk -mindirect-branch-register"

Sample coming from the build of c3270 (other parts of Suite 3270 exhibits this):
$ make c3270
(...)
cc -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I../../../lib/32xx -I../../../lib/32xx/../include/unix -I../../../lib/32xx/../include -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\" -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE   -c -o asprintf.o ../../../Common/asprintf.c
gcc -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I../../../lib/32xx -I../../../lib/32xx/../include/unix -I../../../lib/32xx/../include -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\" -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE   -c -o indent_s.o ../../../Common/indent_s.c
gcc -Wall -Wsign-compare -std=c99 -pedantic -Wno-variadic-macros -MMD -MP  -I../../../lib/32xx -I../../../lib/32xx/../include/unix -I../../../lib/32xx/../include -I../../../include -DLIBX3270DIR=\"/usr/local/etc/x3270\" -D_POSIX_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE   -c -o lazya.o ../../../Common/lazya.c
(...)

In that case the problem comes from c3270/Makefile.obj.in and lies in the line 55:
CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)

that line should be like this:
CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS) @CFLAGS@


Once corrected we do have the correct GCC options set we see the correct value in the generated Makefile.obj:
CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS) -O3 -pipe -march=native -fomit-frame-pointer -fopt-info-vec -mindirect-branch=thunk -mindirect-branch-register


True for c3270, true for the others "UN*X" components of Suite 3270. Grep'ing from Suite 3270 source directory gives:
$ grep -ri 'CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)' *
c3270/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
lib/3270/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
lib/3270stubs/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
lib/32xx/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
lib/3270i/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
pr3287/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS) \
s3270/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
tcl3270/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)
x3270/Makefile.obj.in:CFLAGS = $(CCOPTIONS) $(CDEBUGFLAGS) $(XCPPFLAGS)

The solution is simple: add @CFLAGS@ at the end of the above lines.

Issue seen with net-misc/suite3270-3.3.5_p12 and net-misc/suite3270-3.3.6_p8
Comment 1 Adrien Dessemond 2020-05-02 01:40:47 UTC
Created attachment 635568 [details, diff]
Patch for suite3270-3.6_p8.ebuild

This patch makes the ebuild eapply a serie of patches.
Comment 2 Adrien Dessemond 2020-05-02 02:05:12 UTC
Created attachment 635574 [details, diff]
Fix for 'CFILES=' statements in Makefiles

This patch implements the solution given in the bug description as a first approach. It simply changes how the CFLAGS is initialized in several Makefiles.

Place this patch in the subdirectory "files/patches" instead of "patches" as the ebuild (see separate patch) calls eapply.
Comment 3 SpanKY gentoo-dev 2021-01-14 21:25:52 UTC
this is fixed in the 4.0 series

if you're able to write patches for the source, could you send them to the upstream project ?  the developers there are quite friendly.
Comment 4 Adrien Dessemond 2021-01-14 21:41:52 UTC
Yes sure, in that case I had exchanges with the author some months ago notably for the issue of having libtinfo wrongly referenced (see bug #713618), he is very friendly and open to enhancements however on my side I had no time to make a proposal on an updated ebuild for 4.x as a follow up.
Comment 5 SpanKY gentoo-dev 2021-01-14 23:34:17 UTC
(In reply to Adrien Dessemond from comment #4)

that's fine.  if you want to focus on getting upstream into a good state, you can just drop us a note afterwards (file a FYI bug).  if you don't have the time to update Gentoo stuff, someone else can.