Bug 202901 - games/qqwing configure narrowly searches for gcc or cc and Makefile hard-codes CC CXX CPP plus does not respect CFLAGS
Summary: games/qqwing configure narrowly searches for gcc or cc and Makefile hard-code...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-05 06:00 UTC by Kenneth Salerno
Modified: 2015-09-06 13:05 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (gnome)


Attachments
Don't hardcode CC/CXX/CPP (415 bytes, patch)
2015-09-05 18:34 UTC, Koop Mast
no flags Details | Diff
Don't hardcode CC/CXX/CPP (2.05 KB, patch)
2015-09-05 22:09 UTC, Koop Mast
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Salerno 2015-09-05 06:00:24 UTC
QQWing uses a configure script that narrowly searches for literally "gcc" or cc, but will never find "gcc5" or "gcc48" and "g++5" or "g++48" if that is what the user has set his CC CXX and CPP flags to use for ports. On top of that, the port's Makefile hard-codes CC, CXX and CPP to use clang (or gcc 4.2 on FreeBSD version < 10).

The configure script should be patched to just use "cc" and "c++" if CC CXX and CPP are not set by the user, which would obsolete the need to hard-code CC CXX CPP flags in the port's Makefile while making it flexible to support gcc5/gcc48 without modification.

test -z "$CC" && CC=cc
test -z "$CXX" && CXX=c++

Another patch would be required of the automake files to respect CFLAGS (hard-coded to -O2 -g), CXXFLAGS and LDFLAGS but first thing's first, need to respect compiler chosen.

The reason I happened upon this issue is because my ports are compiled with gcc5/g++5 and when qqwing got compiled with clang I ran into an ABI incompatibility when linking gnome-sudoku (built with gcc5) forcing me to hack the qqwing configure script to find g++5.
Comment 1 Koop Mast freebsd_committer freebsd_triage 2015-09-05 18:34:09 UTC
Created attachment 160748 [details]
Don't hardcode CC/CXX/CPP

Can you check if the attached patch fixes your problem?
Comment 2 Kenneth Salerno 2015-09-05 21:27:02 UTC
Testing I have found the patch has no effect - the configure script in the qqwing distribution itself does not respect any CC/CXX/CPP/CFLAGS/CXXFLAGS/LDFLAGS environment variables at all.

What fixed it for me was just ln gcc /usr/local/bin/gcc5; ln g++ /usr/local/bin/g++5 since their configure script looks for "gcc" and "g++"... Setting CC=cc has no effect.

Thanks for looking into it for me.
Comment 3 Koop Mast freebsd_committer freebsd_triage 2015-09-05 22:09:15 UTC
Created attachment 160750 [details]
Don't hardcode CC/CXX/CPP

New patch that should fix the problem, and cleans up the Makefile.
Comment 4 Kenneth Salerno 2015-09-06 01:16:14 UTC
That worked but can you please change the CONFIGURE_ENV line to the following:

CONFIGURE_ENV+= CC=${CC} CXX=${CXX} CPP=${CPP} CFLAGS="${CFLAGS}" CXXFLAGS="${CX
XFLAGS}" LDFLAGS="${LDFLAGS}"

Thank you.
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-09-06 13:03:29 UTC
A commit references this bug:

Author: kwm
Date: Sun Sep  6 13:03:08 UTC 2015
New revision: 396213
URL: https://svnweb.freebsd.org/changeset/ports/396213

Log:
  qqwing doesn't honor CC/CXX/CPP [1], resolve this by doing a major
  overhaul. Which also simplies the port a bit, and gets rid of using
  scripts the port supplies.

   * Even if the old port defined CC/CXX/CPP, it was not actualy used.
     Due to the reason in the next point.
   * Instead of using the port supplied script, which call ./configure
     and make install targets without any arguments and so. Copy the
     "special" voodoo into pre-configure and pre-build targets. Define
     GNU_CONFIGURE and use standard do-configure, do-build and
     do-install, since this ports uses autotools when it matters.
   * Drag USE_GITHUB macros out the macro mess. Use autoreconf USES
     instead of having manual BUILD_DEPENDS lines.
   * No more post-patch to fix the port supplied scripts, and no
     do-install since we leave that to autotools.
   * Set PATHFIX_MAKEFILEIN to patch the Makefile.am file instead of
     the Makefile.in file due to us running autoreconf which
     overwrites the .in file (if it existed at all).
   * Wrap lines
   * USE_GNOME=glib introspection:build are not needed, so remove them.

  PR:		202901 [1]
  Reported by:	Kenneth Salerno <kennethsalerno@yahoo.com> [1]

Changes:
  head/games/qqwing/Makefile
Comment 6 Koop Mast freebsd_committer freebsd_triage 2015-09-06 13:05:16 UTC
Thanks for reporting, it should be fixed now. I overhauled the port after the last patch, please reopen if there is still a problem with the port.