summaryrefslogtreecommitdiff
path: root/Ports/python3/patches/0004-Tweak-setup.py.patch
blob: 62023a266a9b6290cbd41e095f44953764f63a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Linus Groh <mail@linusgroh.de>
Date: Fri, 14 Jan 2022 23:36:52 +0330
Subject: [PATCH] Tweak `setup.py`

Make some tweaks to Python's `setup.py`:

- Add `/usr/local/lib` and `/usr/local/include` to the system lib and
  include dirs respectively, relative to the sysroot when
  crosscompiling. These are by default only included when not
  crosscompiling for some reason.
- Add `/usr/local/include/ncurses` to the curses include paths so it can
  build the `_curses` module. This is by default included for a bunch of
  extensions, but not `_curses`.
---
 setup.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index e74a275..acd7b05 100644
--- a/setup.py
+++ b/setup.py
@@ -848,8 +848,8 @@ class PyBuildExt(build_ext):
             add_dir_to_list(self.compiler.include_dirs,
                             sysconfig.get_config_var("INCLUDEDIR"))
 
-        system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
-        system_include_dirs = ['/usr/include']
+        system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib', '/usr/local/lib']
+        system_include_dirs = ['/usr/include', '/usr/local/include']
         # lib_dirs and inc_dirs are used to search for files;
         # if a file is found in one of those directories, it can
         # be assumed that no additional -I,-L directives are needed.
@@ -1160,7 +1160,12 @@ class PyBuildExt(build_ext):
         # Curses support, requiring the System V version of curses, often
         # provided by the ncurses library.
         curses_defines = []
-        curses_includes = []
+        if not CROSS_COMPILING:
+            curses_includes = ['/usr/local/include/ncurses']
+        else:
+            curses_includes = sysroot_paths(
+                ('CPPFLAGS', 'CFLAGS', 'CC'), ['/usr/local/include/ncurses']
+            )
         panel_library = 'panel'
         if curses_library == 'ncursesw':
             curses_defines.append(('HAVE_NCURSESW', '1'))