Le Sat, Oct 30, 2021 at 11:05:51AM +0200, Landry Breuil a écrit :
> Le Sat, Oct 30, 2021 at 10:27:46AM +0200, Landry Breuil a écrit :
> > Le Sat, Oct 30, 2021 at 10:20:18AM +0200, Landry Breuil a écrit :
> > > Le Sat, Oct 30, 2021 at 09:51:34AM +0200, Landry Breuil a écrit :
> > > > Hi,
> > > > 
> > > > i dunno if something should be fixed in the python build system (is it
> > > > *necessary* to point at /usr/local/lib for libpython3.8.so ?), but i
> > > > think there's something definitely wrong somewhere. That probably
> > > > accounts for many failures i remember seeing building python updates
> > > > when the previous version was installed systemwide, and taking 
> > > > precedence
> > > > over the just-newly-built lib/extension.
> > > 
> > > looking a bit more at our python port and reading
> > > https://docs.python.org/3/using/configure.html#linker-flags, the
> > > paths seem to come from MAKE_FLAGS += LDFLAGS='-L${WRKSRC}
> > > -L${LOCALBASE}/lib/' in /usr/ports/lang/python/Makefile.inc. Dunno if
> > > that's right or wrong for them to end up in LDSHARED, so i wonder if
> > > PY_LDFLAGS or PY_CORE_LDFLAGS or LDSHARED should be overriden.
> > 
> > Hah !! https://bugs.python.org/issue35257 and
> > https://bugs.python.org/issue21121 looks definitely related ! so
> > i think we should use PY_LDFLAGS_NODIST / CFLAGS_NODIST in the python
> > port to build python itself, so that those paths dont 'leak' to
> > extensions built later on..
> 
> So, more findings... in freebsd-land for python 3.2 in 2013, they added
> a patch
> (https://svnweb.freebsd.org/ports/head/lang/python38/files/patch-Makefile.pre.in?revision=516854&view=markup)
> to 'Remove CONFIGURE_* variables from Makefile.pre.in' in
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181721 /
> http://svnweb.freebsd.org/changeset/ports/326729 to fix libintl
> detection. that patch has been cargoculted since then in all python
> versions.

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.

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        30 Oct 2021 12:01:00 -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        30 Oct 2021 12:01:00 -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/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   30 Oct 2021 12:01:00 -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.8/patches/patch-configure_ac
===================================================================
RCS file: /cvs/ports/lang/python/3.8/patches/patch-configure_ac,v
retrieving revision 1.4
diff -u -r1.4 patch-configure_ac
--- 3.8/patches/patch-configure_ac      26 Oct 2021 23:30:08 -0000      1.4
+++ 3.8/patches/patch-configure_ac      30 Oct 2021 12:01:00 -0000
@@ -36,12 +36,13 @@
  #elif defined(__linux__)
  # if defined(__x86_64__) && defined(__LP64__)
          x86_64-linux-gnu
-@@ -2811,18 +2811,7 @@ AC_CHECK_LIB(dl, dlopen)        # Dynamic linking for 
SunOS/S
+@@ -2811,19 +2811,8 @@ AC_CHECK_LIB(dl, dlopen)        # Dynamic linking for 
SunOS/S
  AC_CHECK_LIB(dld, shl_load)   # Dynamic linking for HP-UX
  
  # checks for uuid.h location
 -AC_CHECK_HEADERS([uuid/uuid.h uuid.h])
--
++AC_CHECK_HEADERS([uuid.h])
+ 
 -AC_MSG_CHECKING(for uuid_generate_time_safe)
 -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid/uuid.h>]], [[
 -#ifndef uuid_generate_time_safe
@@ -52,7 +53,7 @@
 -   AC_MSG_RESULT(yes)],
 -  [AC_MSG_RESULT(no)]
 -)
-+AC_CHECK_HEADERS([uuid.h])
- 
+-
  # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 
(anno 2007)
  # FreeBSD and OpenBSD provides support as well
+ AC_MSG_CHECKING(for uuid_create)

Reply via email to