Le Sat, Oct 30, 2021 at 10:57:50PM +0100, Stuart Henderson a écrit :
> On 2021/10/30 14:09, Landry Breuil wrote:
> > I've tried various things in our Makefile.inc, but using LDFLAGS_NODIST
> > / CFLAGS_NODIST generally ends up with a broken libintl/textdomain
> > detection, so i went with a patch that is similar to the freebsd one so
> > that LDFLAGS/paths dont leak to _sysconfigdata__openbsd7_py.
> > 
> > $grep LDSH /usr/local/lib/python3.8/_sysconfigdata__openbsd7_.pyi
> >  'BLDSHARED': 'cc -pthread -shared -fPIC',
> >  'LDSHARED': 'cc -pthread -shared -fPIC',
> > 
> > CFLAGS_NODIST in MAKE_FLAGS is needed, otherwise python build itself
> > fails because it cant find libintl.h.
> > 
> > im not sure this is the right patch at all. This might go in a bulk
> > soon to check for fallout...if testing the diff, make sure to diff
> > _sysconfigdata__openbsd7_.py before and after.
> 
> I think this makes sense if there are no problems in bulk. (Enough of
> python is run during a build to exercise things that I don't think
> it would need separate runtime tests).
> 
> I'm unsure if changes to the build makefiles count as changes to python
> for the license requirement (*/files/CHANGES.OpenBSD), but it might need
> a line in there before commit

The below diff for 3.8 & 3.9 goes in a bulk; i havent patched 2.7 but
i've tested that it built fine itself.

Landry
Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/lang/python/Makefile.inc,v
retrieving revision 1.139
diff -u -r1.139 Makefile.inc
--- Makefile.inc        1 Sep 2021 17:41:47 -0000       1.139
+++ Makefile.inc        31 Oct 2021 07:28:37 -0000
@@ -121,7 +121,7 @@
                LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
 MAKE_ENV +=    LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
 MAKE_FLAGS +=  LD_LIBRARY_PATH=${WRKSRC} PATH="${WRKDIST}:${PORTPATH}"
-MAKE_FLAGS +=  LDFLAGS='-L${WRKSRC} -L${LOCALBASE}/lib/'
+MAKE_FLAGS +=  CFLAGS_NODIST='-I${LOCALBASE}/include' 
LDFLAGS_NODIST='-L${WRKSRC} -L${LOCALBASE}/lib/'
 FAKE_FLAGS +=  RANLIB=:
 
 PY_PLATFORM =  openbsd${OSMAJOR}
Index: 3.8/Makefile
===================================================================
RCS file: /cvs/ports/lang/python/3.8/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- 3.8/Makefile        26 Oct 2021 23:30:08 -0000      1.19
+++ 3.8/Makefile        31 Oct 2021 07:28:37 -0000
@@ -10,7 +10,7 @@
 SHARED_LIBS =          python3.8 0.0
 VERSION_SPEC =         >=3.8,<3.9
 
-REVISION-main =                0
+REVISION-main =                1
 
 CONFIGURE_ARGS +=      --with-ensurepip=no
 CONFIGURE_ARGS +=      --enable-loadable-sqlite-extensions
Index: 3.8/files/CHANGES.OpenBSD
===================================================================
RCS file: /cvs/ports/lang/python/3.8/files/CHANGES.OpenBSD,v
retrieving revision 1.5
diff -u -r1.5 CHANGES.OpenBSD
--- 3.8/files/CHANGES.OpenBSD   26 Oct 2021 23:30:08 -0000      1.5
+++ 3.8/files/CHANGES.OpenBSD   31 Oct 2021 07:28:37 -0000
@@ -14,5 +14,8 @@
 4.  Disable MULTIARCH check in configure.ac since OpenBSD is not a
 multi-arch platform and it causes build problems.
 
+5.  Make sure CPPFLAGS/LDFLAGS passed to ./configure don't end up
+in PY_CPPFLAGS/PY_LDFLAGS and thus leaking to python extensions.
+
 These changes are available in the OpenBSD CVS repository
 <http://www.openbsd.org/anoncvs.html> in ports/lang/python/3.8.
Index: 3.8/patches/patch-Makefile_pre_in
===================================================================
RCS file: /cvs/ports/lang/python/3.8/patches/patch-Makefile_pre_in,v
retrieving revision 1.2
diff -u -r1.2 patch-Makefile_pre_in
--- 3.8/patches/patch-Makefile_pre_in   12 Jun 2021 04:03:23 -0000      1.2
+++ 3.8/patches/patch-Makefile_pre_in   31 Oct 2021 07:28:37 -0000
@@ -1,8 +1,21 @@
 $OpenBSD: patch-Makefile_pre_in,v 1.2 2021/06/12 04:03:23 kmos Exp $
 
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181721
+
 Index: Makefile.pre.in
 --- Makefile.pre.in.orig
 +++ Makefile.pre.in
+@@ -99,8 +99,8 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_N
+ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+-PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) 
$(CPPFLAGS)
+-PY_LDFLAGS=   $(CONFIGURE_LDFLAGS) $(LDFLAGS)
++PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CPPFLAGS)
++PY_LDFLAGS=   $(LDFLAGS)
+ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
+ NO_AS_NEEDED= @NO_AS_NEEDED@
+ SGI_ABI=      @SGI_ABI@
 @@ -646,7 +646,7 @@ gdbhooks: $(BUILDPYTHON)-gdb.py
  
  SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py
Index: 3.9/Makefile
===================================================================
RCS file: /cvs/ports/lang/python/3.9/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- 3.9/Makefile        30 Oct 2021 00:24:16 -0000      1.10
+++ 3.9/Makefile        31 Oct 2021 07:28:37 -0000
@@ -11,7 +11,7 @@
 VERSION_SPEC =         >=3.9,<3.10
 #PSUBDIR =             python/3.9.0
 
-REVISION-main =                0
+REVISION-main =                1
 
 
 CONFIGURE_ARGS +=      --with-ensurepip=no
Index: 3.9/files/CHANGES.OpenBSD
===================================================================
RCS file: /cvs/ports/lang/python/3.9/files/CHANGES.OpenBSD,v
retrieving revision 1.5
diff -u -r1.5 CHANGES.OpenBSD
--- 3.9/files/CHANGES.OpenBSD   30 Oct 2021 00:24:16 -0000      1.5
+++ 3.9/files/CHANGES.OpenBSD   31 Oct 2021 07:28:37 -0000
@@ -14,5 +14,8 @@
 4.  Disable MULTIARCH check in configure.ac since OpenBSD is not a
 multi-arch platform and it causes build problems.
 
+5.  Make sure CPPFLAGS/LDFLAGS passed to ./configure don't end up
+in PY_CPPFLAGS/PY_LDFLAGS and thus leaking to python extensions.
+
 These changes are available in the OpenBSD CVS repository
 <http://www.openbsd.org/anoncvs.html> in ports/lang/python/3.9.
Index: 3.9/patches/patch-Makefile_pre_in
===================================================================
RCS file: /cvs/ports/lang/python/3.9/patches/patch-Makefile_pre_in,v
retrieving revision 1.2
diff -u -r1.2 patch-Makefile_pre_in
--- 3.9/patches/patch-Makefile_pre_in   12 Jun 2021 04:00:22 -0000      1.2
+++ 3.9/patches/patch-Makefile_pre_in   31 Oct 2021 07:28:37 -0000
@@ -3,6 +3,17 @@
 Index: Makefile.pre.in
 --- Makefile.pre.in.orig
 +++ Makefile.pre.in
+@@ -99,8 +99,8 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_N
+ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+-PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) 
$(CPPFLAGS)
+-PY_LDFLAGS=   $(CONFIGURE_LDFLAGS) $(LDFLAGS)
++PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CPPFLAGS)
++PY_LDFLAGS=   $(LDFLAGS)
+ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
+ NO_AS_NEEDED= @NO_AS_NEEDED@
+ SGI_ABI=      @SGI_ABI@
 @@ -674,7 +674,7 @@ gdbhooks: $(BUILDPYTHON)-gdb.py
  
  SRC_GDB_HOOKS=$(srcdir)/Tools/gdb/libpython.py

Reply via email to