This is a potential security issue.
The problem is that config.h and config.mk are populated with
all variables prefixed with 'HAVE_' from the user's environment.
Example:
$ HAVE_FOO=yes ./configure
$ grep FOO config.mk
HAVE_FOO = 1
$ grep FOO config.h
#define HAVE_FOO 1
After this commit these files will only use variables set by
qb configure process and not from the user's environment. This
issue could result in hard to diagnose undefined behavior or
maybe worse?
The user should experience no change in behavior, but
developers should be more careful about setting 'HAVE_'
variables manually.
Unless the FOO variable is used by check_enabled ($2 only),
check_platform, check_lib, check_pkgconf, check_header,
check_macro or check_switch functions it should be set at
least once by the new add_opt function. The first argument
should be 'FOO' which matches the HAVE_FOO variable and the
second argument should contain 'auto', 'no' or 'yes'.
Example:
add_opt FOO yes
When in doubt its safe to use add_opt. This will also fix a
few potential issues where configure arguments used by the
user are ignored.
When the second argument is not set the FOO variable will only
be used to populate config.h and config.mk with its current
value. This should only be done in qb/qb.libs.sh in functions
that set 'HAVE_' variables.
This allows enabling and disabling features for platforms
more robustly.
Fixes https://github.com/libretro/RetroArch/issues/8777
v2: Fix D3D configure checks.
v3: Cleanup.
v4: Update Makefile.msvc and Makefile.win
This fixes issues where if both check_header and check_lib are used
it would set HAVE_FOO=yes and then result in a configure failure
when check_lib failed. This was also implemented for the other functions
to avoid similar issues.
By default 'make install' will now install the following 2-3 files
to $(DESTDIR)$(SHARE_DIR)/doc/retroarch which by default is
/usr/local/share/doc/retroarch.
COPYING
README.md
and if media/assets exists it will install:
media/assets/COPYING to COPYING.assets
Users will be able to configure this install path with.
./configure --docdir=PATH
For example:
./configure --docdir=/usr/doc/RetroArch-1.7.0
This allows a user to use --datarootdir=PATH to configure the
share directory used for pixmaps, desktop files, man pages and assets.
By default this will be '/usr/local/share'. Assets and man page install
paths can still be configured with:
--with-man_dir=PATH
and
--with-assets_dir=PATH
Some operating systems like Haiku use unconventional install paths
and this should allow them to configure their build correctly.