diff options
author | Ionen Wolkens <sudinave@gmail.com> | 2021-04-13 17:51:11 -0400 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2021-04-15 09:38:48 +0300 |
commit | b94256f4e995223066f750b65166e6a261fbeed4 (patch) | |
tree | 5c7b1b4ef29625b95c1b69cc5ae1ce91948c83dc /x11-misc | |
parent | dev-python/gsd: Remove old (diff) | |
download | gentoo-b94256f4e995223066f750b65166e6a261fbeed4.tar.gz gentoo-b94256f4e995223066f750b65166e6a261fbeed4.tar.bz2 gentoo-b94256f4e995223066f750b65166e6a261fbeed4.zip |
x11-misc/imake: ease usage with toolchain's -native-symlinks
This is to provide a more-sane way for ebuilds to fix their bugs,
without really altering how imake behaves.
There's four notable known runtime issues with -native-symlinks:
- checks if /usr/bin/cc exists (without executing), if missing it
skips setting some defines and notably causes generated Makefiles
to use makedepend over gccmakedep resulting in some build failures.
- `ld -v` inoring LD, no failure but gives a QA warning (bug #729630),
also prevents a define from being set and given previous issue
rather ensure they're conserved (slightly used in xorg-cf-files).
- `gcc -E` ignoring CC/CPP, causes build failure if missing. imake has
IMAKECPP to change this but can't take arguments leading to build
failure if setting to $(tc-getCPP) which often has -E.
- `xmkmf -a` sometimes calls imake again in an imake-generated Makefile
leading to the environment's CC/LD being ignored again.
Added patches to fix each. xmkmf-using ebuilds wanting to take
advantage of this need something along the lines of:
BDEPEND=">=x11-misc/imake-1.0.8-r1"
CC="$(tc-getBUILD_CC)" LD="$(tc-getLD)" \
IMAKECPP=${IMAKECPP:-$(tc-getCPP)} xmkmf ... || die
emake CC="$(tc-getCC)" ...
+test with -native-symlinks to ensure don't need more emake vars.
(only CC should be BUILD_* here, LD not used to link)
IMAKECPP is used this way to allow users to override without changing
normal CPP. imake uses traditional CPP and clang notably doesn't
play that well with that.
Closes: https://bugs.gentoo.org/729630
Signed-off-by: Ionen Wolkens <sudinave@gmail.com>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'x11-misc')
-rw-r--r-- | x11-misc/imake/files/imake-1.0.8-cpp-args.patch | 18 | ||||
-rw-r--r-- | x11-misc/imake/files/imake-1.0.8-no-get-gcc.patch | 37 | ||||
-rw-r--r-- | x11-misc/imake/files/imake-1.0.8-respect-LD.patch | 15 | ||||
-rw-r--r-- | x11-misc/imake/files/imake-1.0.8-xmkmf-pass-cc-ld.patch | 15 | ||||
-rw-r--r-- | x11-misc/imake/imake-1.0.8-r1.ebuild | 25 |
5 files changed, 110 insertions, 0 deletions
diff --git a/x11-misc/imake/files/imake-1.0.8-cpp-args.patch b/x11-misc/imake/files/imake-1.0.8-cpp-args.patch new file mode 100644 index 000000000000..4fb382b0a19c --- /dev/null +++ b/x11-misc/imake/files/imake-1.0.8-cpp-args.patch @@ -0,0 +1,18 @@ +Copy code from IMAKEINCLUDE to IMAKECPP to handle arguments +such as -E. Lets IMAKECPP=$(tc-getCPP) be usable. +--- a/imake.c ++++ b/imake.c +@@ -532,6 +532,12 @@ + } + } +- if ((p = getenv("IMAKECPP"))) ++ if ((p = getenv("IMAKECPP"))) { + cpp = p; ++ for (; *p; p++) ++ if (*p == ' ') { ++ *p++ = '\0'; ++ AddCppArg(p); ++ } ++ } + if ((p = getenv("IMAKEMAKE"))) + make_argv[0] = p; diff --git a/x11-misc/imake/files/imake-1.0.8-no-get-gcc.patch b/x11-misc/imake/files/imake-1.0.8-no-get-gcc.patch new file mode 100644 index 000000000000..155200461157 --- /dev/null +++ b/x11-misc/imake/files/imake-1.0.8-no-get-gcc.patch @@ -0,0 +1,37 @@ +If /usr/bin/cc exists then get_gcc() is always true on Linux (and many +others), but will fail in the event it's missing (-native-symlinks). + +get_gcc_version does not execute gcc and merely sets defines, so +call it without using get_gcc(). Validity of using NULL should be +verified if there's ever a new version. +--- a/imake.c ++++ b/imake.c +@@ -1341,4 +1341,5 @@ + #endif + ++#if defined CROSSCOMPILE + static boolean + get_gcc(char *cmd) +@@ -1394,5 +1395,4 @@ + } + +-#ifdef CROSSCOMPILE + static void + get_gcc_incdir(FILE *inFile, char* name) +@@ -1640,12 +1640,14 @@ + # endif + { ++# if defined CROSSCOMPILE + char name[PATH_MAX]; + if (get_gcc(name)) { + get_gcc_version (inFile,name); +-# if defined CROSSCOMPILE + if (sys != emx) + get_gcc_incdir(inFile,name); +-# endif + } ++# else ++ get_gcc_version(inFile,NULL); ++# endif + } + # endif diff --git a/x11-misc/imake/files/imake-1.0.8-respect-LD.patch b/x11-misc/imake/files/imake-1.0.8-respect-LD.patch new file mode 100644 index 000000000000..a53808625c95 --- /dev/null +++ b/x11-misc/imake/files/imake-1.0.8-respect-LD.patch @@ -0,0 +1,15 @@ +Use LD env if available, other tests already do similar for CC. +https://bugs.gentoo.org/729630 +--- a/imake.c ++++ b/imake.c +@@ -1110,5 +1110,9 @@ + signed char c; + int ldmajor, ldminor; +- const char *ld = "ld -v"; ++ char ld[PATH_MAX]; ++ const char *ldenv; ++ if (!(ldenv = getenv("LD"))) ++ ldenv = "ld"; ++ snprintf(ld, PATH_MAX, "%s -v", ldenv); + + # ifdef CROSSCOMPILE diff --git a/x11-misc/imake/files/imake-1.0.8-xmkmf-pass-cc-ld.patch b/x11-misc/imake/files/imake-1.0.8-xmkmf-pass-cc-ld.patch new file mode 100644 index 000000000000..a27c1ac04ba0 --- /dev/null +++ b/x11-misc/imake/files/imake-1.0.8-xmkmf-pass-cc-ld.patch @@ -0,0 +1,15 @@ +Makefile calls imake again but with ignored CC/LD. +Passing only if set rather than use defaults. +--- a/xmkmf.cpp ++++ b/xmkmf.cpp +@@ -56,7 +56,7 @@ + echo "make Makefiles" && +- make Makefiles && ++ make ${CC:+CC="$CC"} ${LD:+LD="$LD"} Makefiles && + echo "make includes" && +- make includes && ++ make ${CC:+CC="$CC"} ${LD:+LD="$LD"} includes && + echo "make depend" && +- make depend ++ make ${CC:+CC="$CC"} ${LD:+LD="$LD"} depend + ;; diff --git a/x11-misc/imake/imake-1.0.8-r1.ebuild b/x11-misc/imake/imake-1.0.8-r1.ebuild new file mode 100644 index 000000000000..4aa1016dd0ca --- /dev/null +++ b/x11-misc/imake/imake-1.0.8-r1.ebuild @@ -0,0 +1,25 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit toolchain-funcs xorg-3 + +DESCRIPTION="C preprocessor interface to the make utility" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +RDEPEND="x11-misc/xorg-cf-files" +DEPEND="${RDEPEND} + x11-base/xorg-proto" + +PATCHES=( + "${FILESDIR}"/${P}-cpp-args.patch + "${FILESDIR}"/${P}-no-get-gcc.patch + "${FILESDIR}"/${P}-respect-LD.patch + "${FILESDIR}"/${P}-xmkmf-pass-cc-ld.patch +) + +src_configure() { + econf CPP="$(tc-getPROG CPP cpp)" +} |