logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

gen.lua (4736B)


  1. cflags{
  2. '-D NDEBUG',
  3. '-I $dir',
  4. '-I $srcdir/Include',
  5. '-I $srcdir/Include/internal',
  6. '-isystem $builddir/pkg/linux-headers/include',
  7. }
  8. pkg.deps = {'pkg/linux-headers/headers'}
  9. local libs = {}
  10. local modules = load 'modules.lua'
  11. if modules._ctypes then
  12. cflags{'-isystem $builddir/pkg/libffi/include'}
  13. table.insert(pkg.deps, 'pkg/libffi/headers')
  14. table.insert(libs, 'libffi/libffi.a')
  15. end
  16. if modules._hashlib then
  17. cflags{'-isystem $builddir/pkg/bearssl/include'}
  18. table.insert(pkg.deps, 'pkg/bearssl/headers')
  19. table.insert(libs, 'bearssl/libbearssl.a')
  20. end
  21. if modules._ssl then
  22. cflags{'-isystem $builddir/pkg/libressl/include'}
  23. table.insert(pkg.deps, 'pkg/libressl/headers')
  24. table.insert(libs, {
  25. 'libressl/libssl.a',
  26. 'libressl/libcrypto.a',
  27. })
  28. end
  29. if modules.pyexpat then
  30. cflags{'-isystem $builddir/pkg/expat/include'}
  31. table.insert(pkg.deps, 'pkg/expat/headers')
  32. table.insert(libs, 'expat/libexpat.a.d')
  33. end
  34. if modules.zlib then
  35. cflags{'-isystem $builddir/pkg/zlib/include'}
  36. table.insert(pkg.deps, 'pkg/zlib/headers')
  37. table.insert(libs, 'zlib/libz.a')
  38. end
  39. local srcs = {}
  40. sub('modules.ninja', function()
  41. cflags{'-D Py_BUILD_CORE_BUILTIN'}
  42. for _, mod in pairs(modules) do
  43. for _, src in ipairs(mod) do
  44. local obj = src..'.o'
  45. if not srcs[obj] then
  46. cc('Modules/'..src)
  47. srcs[obj] = true
  48. end
  49. end
  50. end
  51. end)
  52. srcs = table.keys(srcs)
  53. cflags{'-D Py_BUILD_CORE'}
  54. rule('makesetup', 'lua $dir/makesetup.lua $dir/modules.lua <$in >$out')
  55. build('makesetup', '$outdir/config.c', {'$srcdir/Modules/config.c.in', '|', '$dir/makesetup.lua', '$dir/modules.lua'})
  56. cc('Modules/getbuildinfo.c', nil, {
  57. cflags=[[$cflags -D 'DATE="Oct 4 2021"' -D 'TIME="18:40:47"']]
  58. })
  59. cc('Modules/getpath.c', nil, {
  60. cflags={
  61. '$cflags',
  62. [[-D 'PYTHONPATH=":plat-linux"']],
  63. [[-D 'PREFIX="/"']],
  64. [[-D 'EXEC_PREFIX="/"']],
  65. [[-D 'VERSION="3.10"']],
  66. [[-D 'VPATH=""']],
  67. },
  68. })
  69. local platform = 'linux'
  70. local abiflags = ''
  71. for line in iterlines('pyconfig.h', 1) do
  72. if line == '#define WITH_PYMALLOC 1' then
  73. abiflags = abiflags..'m'
  74. elseif line == '#define Py_DEBUG 1' then
  75. abiflags = abiflags..'d'
  76. end
  77. end
  78. cc('Python/getplatform.c', nil, {
  79. cflags=string.format([[$cflags -D 'PLATFORM="%s"']], platform),
  80. })
  81. cc('Python/initconfig.c', nil, {
  82. cflags=[[$cflags -D 'PLATLIBDIR="lib"']],
  83. })
  84. cc('Python/sysmodule.c', nil, {
  85. cflags=string.format([[$cflags -D 'ABIFLAGS="%s"']], abiflags),
  86. })
  87. lib('libpython.a', {expand{'Modules/', srcs}, paths[[
  88. Modules/(
  89. getbuildinfo.c.o
  90. getpath.c.o
  91. main.c
  92. gcmodule.c
  93. )
  94. Objects/(
  95. abstract.c
  96. accu.c
  97. boolobject.c
  98. bytes_methods.c
  99. bytearrayobject.c
  100. bytesobject.c
  101. call.c
  102. capsule.c
  103. cellobject.c
  104. classobject.c
  105. codeobject.c
  106. complexobject.c
  107. descrobject.c
  108. enumobject.c
  109. exceptions.c
  110. genericaliasobject.c
  111. genobject.c
  112. fileobject.c
  113. floatobject.c
  114. frameobject.c
  115. funcobject.c
  116. interpreteridobject.c
  117. iterobject.c
  118. listobject.c
  119. longobject.c
  120. dictobject.c
  121. odictobject.c
  122. memoryobject.c
  123. methodobject.c
  124. moduleobject.c
  125. namespaceobject.c
  126. object.c
  127. obmalloc.c
  128. picklebufobject.c
  129. rangeobject.c
  130. setobject.c
  131. sliceobject.c
  132. structseq.c
  133. tupleobject.c
  134. typeobject.c
  135. unicodeobject.c
  136. unicodectype.c
  137. unionobject.c
  138. weakrefobject.c
  139. )
  140. Parser/(
  141. token.c
  142. pegen.c
  143. parser.c
  144. string_parser.c
  145. peg_api.c
  146. myreadline.c
  147. tokenizer.c
  148. )
  149. Python/(
  150. _warnings.c
  151. Python-ast.c
  152. asdl.c
  153. ast.c
  154. ast_opt.c
  155. ast_unparse.c
  156. bltinmodule.c
  157. ceval.c
  158. codecs.c
  159. compile.c
  160. context.c
  161. errors.c
  162. frozenmain.c
  163. future.c
  164. getargs.c
  165. getcompiler.c
  166. getcopyright.c
  167. getplatform.c.o
  168. getversion.c
  169. hamt.c
  170. hashtable.c
  171. import.c
  172. importdl.c
  173. initconfig.c.o
  174. marshal.c
  175. modsupport.c
  176. mysnprintf.c
  177. mystrtoul.c
  178. pathconfig.c
  179. preconfig.c
  180. pyarena.c
  181. pyctype.c
  182. pyfpe.c
  183. pyhash.c
  184. pylifecycle.c
  185. pymath.c
  186. pystate.c
  187. pythonrun.c
  188. pytime.c
  189. bootstrap_hash.c
  190. structmember.c
  191. symtable.c
  192. sysmodule.c.o
  193. thread.c
  194. traceback.c
  195. getopt.c
  196. pystrcmp.c
  197. pystrtod.c
  198. pystrhex.c
  199. dtoa.c
  200. formatter_unicode.c
  201. fileutils.c
  202. suggestions.c
  203. dynload_stub.c
  204. frozen.c
  205. )
  206. $outdir/config.c
  207. ]]})
  208. exe('python', {'Programs/python.c', 'libpython.a', expand{'$builddir/pkg/', libs}})
  209. file('bin/python3', '755', '$outdir/python')
  210. sym('bin/python', 'python3')
  211. build('copy', '$outdir/python3.1', '$srcdir/Misc/python.man')
  212. man{'$outdir/python3.1'}
  213. sym('share/man/man1/python.1.gz', 'python3.1.gz')
  214. for f in iterlines('pylibs.txt') do
  215. file('lib/python3.10/'..f, '644', '$srcdir/Lib/'..f)
  216. end
  217. file('lib/python3.10/_sysconfigdata_'..abiflags..'_'..platform..'_.py', '644', '$dir/lib/_sysconfigdata.py')
  218. file('lib/python3.10/Makefile', '644', '$dir/lib/Makefile')
  219. dir('lib/python3.10/lib-dynload', '755')
  220. fetch 'curl'