CFLAGS/CPPFLAGS cleanup

Move -I and -D into CPPFLAGS, and for others use ${CFLAGS:--O2 -g} to
prevent from building "non-optimized" binary.


git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@24334 af4574ff-66df-0310-9fd7-8a98e5e911e0
This commit is contained in:
Xi Ruoyao 2021-03-04 09:56:47 +00:00
parent 5d2965c7ff
commit f4302700b1
15 changed files with 18 additions and 62 deletions

View File

@ -112,7 +112,7 @@
</para>
<screen><userinput remap="pre">case $(uname -m) in
i?86) export CFLAGS+=-falign-functions=4 ;;
i?86) export CFLAGS="${CFLAGS:--O2 -g} -falign-functions=4" ;;
esac</userinput></screen>
<para>

View File

@ -128,8 +128,7 @@
This has no effect on systems without TeXLive installed.
</para>
<screen><userinput remap="pre">export CFLAGS="$CFLAGS -I/opt/texlive/&texlive-year;/include" &amp;&amp;
export CXXFLAGS="$CXXFLAGS -I/opt/texlive/&texlive-year;/include" &amp;&amp;
<screen><userinput remap="pre">export CPPFLAGS="-I/opt/texlive/&texlive-year;/include" &amp;&amp;
export LDFLAGS="$LDFLAGS -L/opt/texlive/&texlive-year;/lib"</userinput></screen>
<para>
@ -174,11 +173,8 @@ ninja</userinput></screen>
</para>
-->
<!-- When moving to Meson, I installed the whole texlive suite from source.
I was able to verify that this is no longer required. I'm assuming it was
one of evince-3.36.3 or texlive-2020 that fixed this.
<para>
<parameter>CFLAGS="$CFLAGS ..." CXXFLAGS="$CXXFLAGS ..." LDFLAGS="$LDFLAGS ..."</parameter>: If
<parameter>CPPFLAGS="..." LDFLAGS="$LDFLAGS ..."</parameter>: If
<application>TeXLive</application> has been installed in
<filename class="directory">/opt/texlive-&texlive-year;</filename> the
configure script will find <filename class='libraryfile'>libkpathsea.so</filename>
@ -187,7 +183,7 @@ ninja</userinput></screen>
<application>TeXLive</application> has not been installed does not break the
build.
</para>
-->
<para>
<parameter>-Dgtk_doc=false</parameter>: This switch disables generating
the gtk-doc API reference documentation. If you have

View File

@ -102,7 +102,7 @@
commands:
</para>
<screen><userinput>CXXFLAGS=-std=c++98 \
<screen><userinput>CXXFLAGS="${CXXFLAGS:--O2 -g} -std=c++98" \
./configure --prefix=/usr --disable-static &amp;&amp;
make</userinput></screen>

View File

@ -93,7 +93,7 @@
--mandir=/usr/share/man \
--enable-shared \
--disable-static \
CFLAGS="-g -O2 $([ $(uname -m) = x86_64 ] &amp;&amp; echo -fPIC)" &amp;&amp;
CFLAGS="${CFLAGS:--g -O2} $([ $(uname -m) = x86_64 ] &amp;&amp; echo -fPIC)" &amp;&amp;
make</userinput></screen>
<para>

View File

@ -113,7 +113,7 @@
<screen><userinput>patch -Np1 -i ../libmusicbrainz-&libmusicbrainz-version;-missing-includes-1.patch &amp;&amp;
CXXFLAGS=-std=c++98 \
CXXFLAGS="${CXXFLAGS:--O2 -g} -std=c++98" \
./configure --prefix=/usr --disable-static &amp;&amp;
make</userinput></screen>

View File

@ -232,7 +232,7 @@
<screen><userinput>sed -i '/vlc_demux.h/a #define LUA_COMPAT_APIINTCASTS' modules/lua/vlc.h &amp;&amp;-->
<screen><userinput>export LUAC=/usr/bin/luac5.2 &amp;&amp;
export LUA_LIBS="$(pkg-config --libs lua52)" &amp;&amp;
export CFLAGS="$(pkg-config --cflags lua52)" &amp;&amp;
export CPPFLAGS="$(pkg-config --cflags lua52)" &amp;&amp;
BUILDCC=gcc ./configure --prefix=/usr \
--disable-opencv \

View File

@ -135,7 +135,7 @@ useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 \
Note: Check if -fcommon is still required on versions gtr 4.2.8p14
Its a "hack" for gcc-10
-->
<screen><userinput>./configure CFLAGS="-O2 -g -fPIC -fcommon $CFLAGS" \
<screen><userinput>./configure CFLAGS="${CFLAGS:--O2 -g} -fPIC -fcommon" \
--prefix=/usr \
--bindir=/usr/sbin \
--sysconfdir=/etc \

View File

@ -185,7 +185,7 @@
commands:
</para>
<screen revision="sysv"><userinput>CFLAGS="-I/usr/include/tirpc" \
<screen revision="sysv"><userinput>CPPFLAGS="-I/usr/include/tirpc" \
LDFLAGS="-ltirpc" \
./configure \
--prefix=/usr \
@ -199,7 +199,7 @@ LDFLAGS="-ltirpc" \
--enable-selftest &amp;&amp;
make</userinput></screen>
<screen revision="systemd"><userinput>CFLAGS="-I/usr/include/tirpc" \
<screen revision="systemd"><userinput>CPPFLAGS="-I/usr/include/tirpc" \
LDFLAGS="-ltirpc" \
./configure \
--prefix=/usr \

View File

@ -95,17 +95,6 @@
<sect2 role="installation">
<title>Installation of Sshfs</title>
<!--
<para>
If you are building on i686, <application>sshfs</application> needs
an extra CFLAGS setting to be defined. This prevents an integer
overflow. To do this, run the following command:
</para>
<screen><userinput>if [ $(uname -m) = "i686" ]; then
export CFLAGS+="-D_FILE_OFFSET_BITS=64";
fi</userinput></screen>
-->
<para>
Install <application>Sshfs</application> by running the following

View File

@ -114,7 +114,7 @@
commands:
</para>
<screen><userinput>export CXXFLAGS="$CXXFLAGS -fno-lifetime-dse" &amp;&amp;
<screen><userinput>export CXXFLAGS="${CXXFLAGS:--O2 -g} -fno-lifetime-dse" &amp;&amp;
./configure --prefix=/usr \
--mandir=/usr/share/man \
--enable-http \

View File

@ -134,7 +134,7 @@ useradd -c "Dovecot login user" -d /dev/null -u 43 \
commands:
</para>
<screen revision="sysv"><userinput>CFLAGS+=" -I/usr/include/tirpc" \
<screen revision="sysv"><userinput>CPPFLAGS="-I/usr/include/tirpc" \
LDFLAGS+=" -ltirpc" \
./configure --prefix=/usr \
--sysconfdir=/etc \
@ -144,7 +144,7 @@ LDFLAGS+=" -ltirpc" \
--disable-static &amp;&amp;
make</userinput></screen>
<screen revision="systemd"><userinput>CFLAGS+=" -I/usr/include/tirpc" \
<screen revision="systemd"><userinput>CPPFLAGS="-I/usr/include/tirpc" \
LDFLAGS+=" -ltirpc" \
./configure --prefix=/usr \
--sysconfdir=/etc \
@ -173,7 +173,7 @@ make</userinput></screen>
<title>Command Explanations</title>
<para>
<command>CFLAGS+=...LDFLAGS+=...</command>: build with libtirpc
<command>CPPFLAGS=... LDFLAGS+=...</command>: build with libtirpc
instead of the recently removed RPC code provided by GlibC.
</para>

View File

@ -263,11 +263,6 @@ make</userinput></screen>
system. This parameter prevents the error.
</para>
<para>
<parameter>CFLAGS=...</parameter>: those two switches ensures some
warnings are not treated as errors.
</para>
<para>
<parameter>HAVE_EXO_CSOURCE=yes</parameter>: although
<command>exo-csource</command> is not needed in a normal build,

View File

@ -115,21 +115,6 @@ make</userinput></screen>
<screen role="root"><userinput>make install</userinput></screen>
</sect2>
<!-- as of 2.24.5, this is no longer needed. -renodr
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<command>CXXFLAGS="-g -O2 -std=c++11" ./configure...</command>: while
Gtkmm-&gtkmm2-version; has not yet been ported to the 2011 ISO C++
standard, all its dependencies have. <command>-std=c++11</command> has
to be used as an option to <command>g++</command>. We pass it into
<envar>CXXFLAGS</envar> together with the default options.
</para>
</sect2>
-->
<sect2 role="content">
<title>Contents</title>

View File

@ -185,15 +185,6 @@ ac_add_options --with-system-libevent
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
<!--Not with libvpx-1.8.0 or later
ac_add_options - -with-system-libvpx
====
These do not seem to be needed any more
# Set CFLAGS and CXXFLAGS to prevent segfaults due to aggressive
# optimizations in GCC-6:
export CFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
export CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
-->
# The elf-hack causes failed installs on some machines.
# It is supposed to improve startup time and it shrinks libxul.so
# by a few MB - comment this if you know your machine is not affected.

View File

@ -178,7 +178,7 @@ make &amp;&amp;
pushd unix/xserver &amp;&amp;
autoreconf -fiv &amp;&amp;
CFLAGS="$CFLAGS -I/usr/include/drm" \
CPPFLAGS="-I/usr/include/drm" \
./configure $XORG_CONFIG \
--disable-xwayland --disable-dri --disable-dmx \
--disable-xorg --disable-xnest --disable-xvfb \