Skip to content

Commit eb3b6ce

Browse files
committed
Build libposix with Ninja
1 parent 904ccca commit eb3b6ce

File tree

6 files changed

+42
-26
lines changed

6 files changed

+42
-26
lines changed

graalpython/com.oracle.graal.python.cext/setup.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -562,29 +562,6 @@ def build_nativelibsupport(capi_home, subdir, libname, deps=[], **kwargs):
562562
ext_modules=[module],
563563
)
564564

565-
def build_libposix(capi_home):
566-
src_dir = os.path.join(__dir__, "posix")
567-
files = [os.path.abspath(os.path.join(src_dir, f)) for f in os.listdir(src_dir) if f.endswith(".c")]
568-
no_gnu_source = get_config_var("USE_GNU_SOURCE")
569-
if no_gnu_source:
570-
get_config_vars()["CFLAGS"] = get_config_var("CFLAGS_DEFAULT")
571-
module = Extension(libposix_name,
572-
sources=files,
573-
libraries=['crypt'] if not darwin_native else [],
574-
extra_compile_args=cflags_warnings + ['-Wall', '-Werror'])
575-
args = [verbosity, 'build', 'install_lib', '-f', '--install-dir=%s' % capi_home, "clean", "--all"]
576-
setup(
577-
script_name='setup' + libposix_name,
578-
script_args=args,
579-
name=libposix_name,
580-
version='1.0',
581-
description="Graal Python's Native support for the POSIX library",
582-
ext_modules=[module],
583-
)
584-
if no_gnu_source:
585-
get_config_vars()["CFLAGS"] = get_config_var("CFLAGS_DEFAULT") + " " + get_config_var("USE_GNU_SOURCE")
586-
587-
588565
def build_builtin_exts(capi_home):
589566
args = [verbosity, 'build', 'install_lib', '-f', '--install-dir=%s/modules' % capi_home, "clean", "--all"]
590567
distutil_exts = [(ext, ext()) for ext in builtin_exts]
@@ -628,7 +605,6 @@ def stripped_object_filenames(*args, **kwargs):
628605
build_libhpy(capi_home)
629606
if WIN32:
630607
return # TODO: ...
631-
build_libposix(capi_home)
632608
build_nativelibsupport(capi_home,
633609
subdir="bz2",
634610
libname="libbz2support",

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/NFIPosixSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public byte callByte(NFIPosixSupport posix, PosixNativeFunction function, Object
335335
// Temporary - will be replaced with something else when we move this to Truffle
336336
private static String getLibPath(PythonContext context) {
337337
CompilerAsserts.neverPartOfCompilation();
338-
String libPythonName = NFIPosixSupport.SUPPORTING_NATIVE_LIB_NAME + context.getSoAbi().toJavaStringUncached();
338+
String libPythonName = NFIPosixSupport.SUPPORTING_NATIVE_LIB_NAME + PythonContext.getSupportExt();
339339
TruffleFile homePath = context.getEnv().getInternalTruffleFile(context.getCAPIHome().toJavaStringUncached());
340340
TruffleFile file = homePath.resolve(libPythonName);
341341
return file.getPath();

graalpython/com.oracle.graal.python.cext/posix/posix.c renamed to graalpython/python-libposix/src/posix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ int32_t set_sockaddr_un_members(int8_t *addr, int8_t *path, int32_t pathLen) {
908908
int64_t call_crypt(const char *word, const char *salt, int32_t *len) {
909909
const char *result = crypt(word, salt);
910910
if (result == NULL) {
911-
return NULL;
911+
return 0;
912912
}
913913
*len = strlen(result);
914914
return (int64_t)(uintptr_t)result;

mx.graalpython/suite.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,35 @@
543543
},
544544
},
545545

546+
"python-libposix": {
547+
"subDir": "graalpython",
548+
"native": "shared_lib",
549+
"deliverable": "posix",
550+
"buildDependencies": [],
551+
"cflags": [
552+
"-DNDEBUG", "-g", "-O3", "-Wall", "-Werror",
553+
],
554+
"os_arch": {
555+
"windows": {
556+
"<others>": {
557+
# "/Z7", "/O2", "/WX", # cflags to replace -g -O3 -Werror
558+
"defaultBuild": False,
559+
},
560+
},
561+
"darwin": {
562+
"<others>": {
563+
"defaultBuild": True,
564+
},
565+
},
566+
"<others>": {
567+
"<others>": {
568+
"ldlibs": ["-lcrypt"],
569+
"defaultBuild" : True,
570+
},
571+
},
572+
},
573+
},
574+
546575
"python-lib": {
547576
"class": "ArchiveProject",
548577
"outputDir": "graalpython/lib-python/3",
@@ -739,6 +768,7 @@
739768
"dependencies": [
740769
"com.oracle.graal.python.cext",
741770
"python-libzsupport",
771+
"python-libposix",
742772
],
743773
"os_arch": {
744774
"windows": {
@@ -763,6 +793,11 @@
763793
"dependency": "graalpython:python-libzsupport",
764794
"path": "*",
765795
},
796+
{
797+
"source_type": "dependency",
798+
"dependency": "graalpython:python-libposix",
799+
"path": "*",
800+
},
766801
],
767802
"./lib-graalpython/modules/graalpy_virtualenv": [
768803
"file:graalpy_virtualenv/graalpy_virtualenv",
@@ -796,6 +831,11 @@
796831
"dependency": "graalpython:python-libzsupport",
797832
"path": "*",
798833
},
834+
{
835+
"source_type": "dependency",
836+
"dependency": "graalpython:python-libposix",
837+
"path": "*",
838+
},
799839
],
800840
"./lib/graalpy<graal_ver:major_minor_nodot>/modules/graalpy_virtualenv": [
801841
"file:graalpy_virtualenv/graalpy_virtualenv",

0 commit comments

Comments
 (0)