Commit 733660f8 authored by Chris Toshok's avatar Chris Toshok

build these as extension modules instead of as part of the pyston executable

parent 0ef87733
......@@ -213,7 +213,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/linkdeps_dummy.c COMMAND ${CMAKE_C
add_executable(pyston $<TARGET_OBJECTS:PYSTON_MAIN_OBJECT> $<TARGET_OBJECTS:PYSTON_OBJECTS> $<TARGET_OBJECTS:FROM_CPYTHON> linkdeps_dummy.c)
# Wrap the stdlib in --whole-archive to force all the symbols to be included and eventually exported
target_link_libraries(pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m z readline sqlite3 gmp ssl crypto unwind pypa liblz4 double-conversion bz2 curses ${LLVM_LIBS} ${LIBLZMA_LIBRARIES} ${OPTIONAL_LIBRARIES})
target_link_libraries(pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m z readline sqlite3 gmp ssl crypto unwind pypa liblz4 double-conversion ${LLVM_LIBS} ${LIBLZMA_LIBRARIES} ${OPTIONAL_LIBRARIES})
# copy src/codegen/parse_ast.py to the build directory
add_custom_command(TARGET pyston POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/codegen/parse_ast.py ${CMAKE_BINARY_DIR}/src/codegen/parse_ast.py)
......
......@@ -20,7 +20,6 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
_codecsmodule.c
_collectionsmodule.c
_csv.c
_cursesmodule.c
_functoolsmodule.c
_iomodule.c
_math.c
......@@ -33,7 +32,6 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
binascii.c
bufferedio.c
bytesio.c
bz2module.c
cache.c
connection.c
cStringIO.c
......@@ -43,7 +41,6 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
fcntlmodule.c
fileio.c
getpath.c
grpmodule.c
iobase.c
itertoolsmodule.c
mathmodule.c
......@@ -66,7 +63,6 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
statement.c
stringio.c
stropmodule.c
termios.c
textio.c
threadmodule.c
timemodule.c
......@@ -121,6 +117,10 @@ add_custom_command(OUTPUT
${CMAKE_BINARY_DIR}/lib_pyston/_multiprocessing.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/pyexpat.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/_elementtree.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/bz2.so
${CMAKE_BINARY_DIR}/lib_pyston/grp.so
${CMAKE_BINARY_DIR}/lib_pyston/termios.so
${CMAKE_BINARY_DIR}/lib_pyston/_curses.so
COMMAND ${CMAKE_BINARY_DIR}/pyston setup.py build --build-lib ${CMAKE_BINARY_DIR}/lib_pyston
DEPENDS
pyston
......@@ -136,5 +136,9 @@ add_custom_command(OUTPUT
Modules/expat/xmltok_ns.c
Modules/pyexpat.c
Modules/_elementtree.c
Modules/bz2module.c
Modules/grpmodule.c
Modules/termios.c
Modules/_cursesmodule.c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(sharedmods DEPENDS ${CMAKE_BINARY_DIR}/lib_pyston/_multiprocessing.pyston.so)
......@@ -14,6 +14,26 @@ def multiprocessing_ext():
"Modules/_multiprocessing/semaphore.c",
]))
def bz2_ext():
return Extension("bz2", sources = map(relpath, [
"Modules/bz2module.c",
]), libraries = ['bz2'])
def grp_ext():
return Extension("grp", sources = map(relpath, [
"Modules/grpmodule.c",
]))
def curses_ext():
return Extension("_curses", sources = map(relpath, [
"Modules/_cursesmodule.c",
]), libraries = ['curses'])
def termios_ext():
return Extension("termios", sources = map(relpath, [
"Modules/termios.c",
]))
def pyexpat_ext():
define_macros = [('HAVE_EXPAT_CONFIG_H', '1'),]
expat_sources = map(relpath, ['Modules/expat/xmlparse.c',
......@@ -56,5 +76,5 @@ def elementtree_ext():
setup(name="Pyston",
version="1.0",
description="Pyston shared modules",
ext_modules=[multiprocessing_ext(), pyexpat_ext(), elementtree_ext()]
ext_modules=[multiprocessing_ext(), pyexpat_ext(), elementtree_ext(), bz2_ext(), grp_ext(), curses_ext(), termios_ext()]
)
......@@ -84,10 +84,6 @@ extern "C" void init_ssl();
extern "C" void init_sqlite3();
extern "C" void PyMarshal_Init();
extern "C" void initstrop();
extern "C" void initgrp();
extern "C" void initbz2();
extern "C" void init_curses();
extern "C" void inittermios();
namespace pyston {
......@@ -3386,10 +3382,6 @@ void setupRuntime() {
init_sqlite3();
PyMarshal_Init();
initstrop();
initgrp();
initbz2();
init_curses();
inittermios();
// some additional setup to ensure weakrefs participate in our GC
BoxedClass* weakref_ref_cls = &_PyWeakref_RefType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment