Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/french/aster/files/patch-as_setup.py
16461 views
1
--- as_setup.py.orig 2020-10-26 15:54:27 UTC
2
+++ as_setup.py
3
@@ -45,6 +45,8 @@ import pprint
4
import compileall
5
import imp
6
import pprint
7
+import fileinput
8
+import string
9
import distutils.sysconfig as SC
10
from functools import partial
11
from subprocess import Popen, PIPE
12
@@ -411,6 +413,7 @@ class SETUP:
13
archive filename !),
14
extract_as : rename content.
15
"""
16
+ from as_setup import (SYSTEM)
17
self._print(self._fmt_title % _('Extraction'))
18
if kargs.get('external')!=None:
19
self._call_external(**kargs)
20
@@ -518,6 +521,96 @@ class SETUP:
21
os.chdir(prev)
22
if iextr_as:
23
self.Clean(to_delete=path)
24
+
25
+ # Insert FreeBSD patches here
26
+ file2patch = os.path.join(self.workdir, self.content, 'bibc/wscript')
27
+ self._print('FreeBSD patch: no libdl => modify ' + file2patch)
28
+ for ligne in fileinput.input(file2patch, inplace=1):
29
+ nl = 0
30
+ nl = ligne.find("uselib_store='SYS', lib='dl'")
31
+ if nl > 0:
32
+ ligne =ligne.replace("self.check_cc", "# self.check_cc")
33
+ sys.stdout.write(ligne)
34
+ file2patch = os.path.join(self.workdir, self.content, 'waftools/med.py')
35
+ self._print('FreeBSD patch: use hdf5-110 ' + file2patch)
36
+ for ligne in fileinput.input(file2patch, inplace=1):
37
+ nl = 0
38
+ nl = ligne.find("self.env.INCLUDEDIR, 'hdf5'")
39
+ if nl > 0:
40
+ ligne =ligne.replace("'hdf5'", "'hdf5-110'")
41
+ sys.stdout.write(ligne)
42
+ # file2patch = os.path.join(self.workdir, self.content, 'bibcxx/wscript')
43
+ # self._print('FreeBSD patch: explicit link with libc++ required since Gcc 4.9 => modify ' + file2patch)
44
+ # for ligne in fileinput.input(file2patch, inplace=1):
45
+ # nl = 0
46
+ # nl = ligne.find("uselib_store='CXX', lib='stdc++'")
47
+ # if nl > 0:
48
+ # ligne =ligne.replace("lib='stdc++'", "lib='c++ stdc++'")
49
+ # sys.stdout.write(ligne)
50
+ file2patch = os.path.join(self.workdir, self.content, 'waftools/scotch.py')
51
+ self._print('FreeBSD patch: int64_t missing => modify ' + file2patch)
52
+ for ligne in fileinput.input(file2patch, inplace=1):
53
+ nl = 0
54
+ nl = ligne.find('include "scotch.h"')
55
+ if nl > 0:
56
+ sys.stdout.write("#include <sys/types.h>\n")
57
+ nl = 0
58
+ nl = ligne.find("stdio.h stdlib.h scotch.h")
59
+ if nl > 0:
60
+ ligne =ligne.replace("stdlib.h", "stdlib.h sys/types.h")
61
+ sys.stdout.write(ligne)
62
+ file2patch = os.path.join(self.workdir, self.content, 'bibc/utilitai/hpalloc.c')
63
+ self._print('FreeBSD patch: stdlib + no mallopt => modify ' + file2patch)
64
+ for ligne in fileinput.input(file2patch, inplace=1):
65
+ nl = 0
66
+ nl = ligne.find('ir=mallopt')
67
+ if nl > 0:
68
+ ligne =ligne.replace('ir=mallopt', '/* ir=mallopt')
69
+ ligne =ligne.replace(');', '); */')
70
+ else:
71
+ nl = ligne.find("malloc.h")
72
+ if nl > 0:
73
+ ligne =ligne.replace("malloc.h", "stdlib.h")
74
+ sys.stdout.write(ligne)
75
+ system=SYSTEM({ 'verbose' : True, 'debug' : False },
76
+ **{'maxcmdlen' : 2**31, 'log' : self})
77
+ file2patch = os.path.join(self.workdir, self.content, 'waf.main')
78
+ self._print('FreeBSD patch: remove extraneous escape => modify waf.main')
79
+ for ligne in fileinput.input(file2patch, inplace=1):
80
+ nl = ligne.find("\main$")
81
+ if nl > 0:
82
+ ligne =ligne.replace("\main$", "main$")
83
+ sys.stdout.write(ligne)
84
+ for f2p in ('waf', 'waf.main', 'waf_variant', 'waf_std', 'waf_mpi', 'bibpyt/Macro/macr_ecre_calc_ops.py'):
85
+ file2patch = os.path.join(self.workdir, self.content, f2p)
86
+ self._print('FreeBSD patch: /bin/bash + GNU getopt => modify ' + file2patch)
87
+ for ligne in fileinput.input(file2patch, inplace=1):
88
+ nl = 0
89
+ nl = ligne.find("/bin/bash")
90
+ if nl > 0:
91
+ ligne =ligne.replace("/bin/bash", " %%LOCALBASE%%/bin/bash")
92
+ sys.stdout.write(ligne)
93
+ for ligne in fileinput.input(file2patch, inplace=1):
94
+ nl = 0
95
+ nl = ligne.find("getopt ")
96
+ if nl > 0:
97
+ ligne =ligne.replace("getopt ", "%%LOCALBASE%%/bin/getopt ")
98
+ sys.stdout.write(ligne)
99
+ self._print('FreeBSD patches: waf.engine and data/post_install in %s' % os.path.join(self.workdir, self.content))
100
+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-waf.engine')
101
+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-data__post_install')
102
+ self._print('FreeBSD patches: memory detection in bibc/utilitai/mempid.c in %s' % os.path.join(self.workdir, self.content))
103
+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__utilitai__mempid.c')
104
+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__supervis__aster_utils.c')
105
+ file2patch = os.path.join(self.workdir, self.content, 'waftools/mathematics.py')
106
+ self._print('FreeBSD patch: nproc => gnproc ' + file2patch)
107
+ for ligne in fileinput.input(file2patch, inplace=1):
108
+ nl = 0
109
+ nl = ligne.find("'nproc'")
110
+ if nl > 0:
111
+ ligne =ligne.replace("'nproc'", "'gnproc'")
112
+ sys.stdout.write(ligne)
113
+ # End of FreeBSD patches
114
115
#-------------------------------------------------------------------------------
116
def Configure(self, **kargs):
117
118