Entware / Entware-ng

Entware-ng
GNU General Public License v2.0
1.21k stars 153 forks source link

Enhancement: Default gcc parameters to appropriate values #785

Closed mcandre closed 7 years ago

mcandre commented 7 years ago

Currently, in order to produce and run working binaries, entware gcc requires that $CFLAGS and $LDFLAGS be populated by the user, by sourcing /opt/bin/gcc_env.sh. Basically, this script configures:

export LDFLAGS "-Wl,-rpath=/opt/lib -Wl,--dynamic-linker=/opt/lib/ld-linux-x86-64.so.2 -L/opt/lib"
export CFLAGS "-O2 -pipe -fomit-frame-pointer -fno-caller-saves "

By using a shell script to override these values, the entware configuration requires that gcc be run in a login shell in order to have the shell automatically source the script from /etc/profile. Or, that . /opt/bin/gcc_env.sh is executed just before the gcc invocation in a non-login shell. Neither of these workflows is particularly CI-friendly, for anyone interested in using entware gcc for build bot purposes. But I wonder if entware gcc could simply feature these values as the hardcoded default, so that the user is no longer required to explicitly pass these values around to gcc?

zyxmon commented 7 years ago

Please provide us a PR for it.