python3*: protect against issues with long CFLAGS

Prevent line wrapping in _sysconfigdata.py so that '-arch foo' can't be
split across multiple lines, preventing the reinplace from removing it
correctly. In practice this only seems to have happened with universal
builds.

All variables being on a single line also means that awk is no longer
needed to edit LINKFORSHARED.

Also fix implicit declaration errors in python35's configure script.

Closes: https://trac.macports.org/ticket/61282
This commit is contained in:
Joshua Root
2021-03-16 01:27:58 +11:00
parent 0d5e767708
commit 9fd97292e6
13 changed files with 171 additions and 38 deletions
+7 -6
View File
@@ -9,6 +9,7 @@ name python35
epoch 20170810
# Remember to keep py35-tkinter and py35-gdbm's versions sync'd with this
version 3.5.10
revision 1
deprecated.eol_version yes
@@ -42,7 +43,9 @@ patchfiles patch-setup.py.diff \
Modules_posixmodule.c.diff \
uuid-64bit.patch \
patch-_osx_support.py.diff \
darwin20.diff
darwin20.diff \
implicit.patch \
sysconfig.py.diff
depends_build port:pkgconfig
depends_lib port:bzip2 \
@@ -136,11 +139,9 @@ platform darwin {
# work for dependents that incorrectly use this variable to find out
# how to link against python (see ticket #15099); instead we mirror
# the behavior of `python-config --ldflags` here.
system -W ${buildlibdir} "awk -F : \
\"/'LINKFORSHARED'/ {printf \\\"%s: '-L${framewdir}/lib/python${branch}/${confdir}\
-lpython${branch}m -ldl -framework CoreFoundation',\\n\\\", \\\$1; getline; next} {print}\"\
_sysconfigdata.py > _sysconfigdata.py.new"
file rename -force ${buildlibdir}/_sysconfigdata.py.new \
set lfs_pattern {^([[:space:]]*'LINKFORSHARED':).*}
set lfs_replacement "\\1 '-L${framewdir}/lib/python${branch}/${confdir} -lpython${branch}m -ldl -framework CoreFoundation',"
reinplace -E s|${lfs_pattern}|${lfs_replacement}| \
${buildlibdir}/_sysconfigdata.py
# remove -arch flags from the config
+68
View File
@@ -0,0 +1,68 @@
--- configure.orig 2021-03-16 00:55:15.000000000 +1100
+++ configure 2021-03-16 01:09:57.000000000 +1100
@@ -10716,13 +10716,13 @@
void *foo(void *parm) {
return NULL;
}
- main() {
+ int main() {
pthread_attr_t attr;
pthread_t id;
- if (pthread_attr_init(&attr)) exit(-1);
- if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
- if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
- exit(0);
+ if (pthread_attr_init(&attr)) return (-1);
+ if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
+ if (pthread_create(&id, &attr, foo, NULL)) return (-1);
+ return (0);
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
@@ -14473,7 +14473,7 @@
int main()
{
/* Success: exit code 0 */
- exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
+ return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
}
_ACEOF
@@ -14791,7 +14791,7 @@
int main()
{
- exit(((-1)>>3 == -1) ? 0 : 1);
+ return (((-1)>>3 == -1) ? 0 : 1);
}
_ACEOF
@@ -15262,12 +15262,16 @@
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
int main()
{
int val1 = nice(1);
if (val1 != -1 && val1 == nice(2))
- exit(0);
- exit(1);
+ return (0);
+ return (1);
}
_ACEOF
@@ -15303,6 +15307,9 @@
/* end confdefs.h. */
#include <poll.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
int main()
{
+11
View File
@@ -0,0 +1,11 @@
--- Lib/sysconfig.py.orig 2020-09-05 17:22:07.000000000 +1000
+++ Lib/sysconfig.py 2021-03-16 00:54:25.000000000 +1100
@@ -396,7 +396,7 @@
f.write('# system configuration generated and used by'
' the sysconfig module\n')
f.write('build_time_vars = ')
- pprint.pprint(vars, stream=f)
+ pprint.pprint(vars, stream=f, width=4000)
# Create file used for sys.path fixup -- see Modules/getpath.c
with open('pybuilddir.txt', 'w', encoding='ascii') as f: