Skip to content

Commit

Permalink
Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-s committed Sep 13, 2024
1 parent b6acc49 commit 2bf181e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ include(GNUInstallDirs)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_library(sbcl_librarian SHARED libsbcl_librarian.c libsbcl_librarian.h libsbcl_librarian_err.h entry_point.c)
add_library(sbcl_librarian SHARED sbcl_librarian.c sbcl_librarian.h sbcl_librarian_err.h entry_point.c)
target_link_directories(sbcl_librarian PRIVATE $ENV{BUILD_PREFIX}/lib)
target_link_libraries(sbcl_librarian sbcl)

add_custom_command(
OUTPUT libsbcl_librarian.c libsbcl_librarian.h
OUTPUT sbcl_librarian.c sbcl_librarian.h
COMMAND ${CMAKE_COMMAND} -E env CL_SOURCE_REGISTRY=${CMAKE_CURRENT_SOURCE_DIR}/..// sbcl --script ${CMAKE_CURRENT_SOURCE_DIR}/generate-bindings.lisp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
Expand All @@ -20,6 +20,6 @@ install(TARGETS sbcl_librarian
LIBRARY
RUNTIME
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsbcl_librarian.core TYPE LIB)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsbcl_librarian.h TYPE INCLUDE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libsbcl_librarian_err.h TYPE INCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sbcl_librarian.core TYPE LIB)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sbcl_librarian.h TYPE INCLUDE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sbcl_librarian_err.h TYPE INCLUDE)
2 changes: 1 addition & 1 deletion lib/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.8
6 changes: 3 additions & 3 deletions lib/entry_point.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>

#include "libsbcl_librarian.h"
#include "sbcl_librarian.h"

#define BUF_SIZE 1024

Expand All @@ -28,10 +28,10 @@ static void do_initialize_lisp(const char *libsbcl_path)
{
char *libsbcl_dir = dir_name(libsbcl_path);
int libsbcl_dir_len = strlen(libsbcl_dir);
int core_path_size = libsbcl_dir_len + sizeof("libsbcl_librarian.core") + 1;
int core_path_size = libsbcl_dir_len + sizeof("sbcl_librarian.core") + 1;
char *core_path = malloc(core_path_size);

snprintf(core_path, core_path_size, "%slibsbcl_librarian.core", libsbcl_dir);
snprintf(core_path, core_path_size, "%ssbcl_librarian.core", libsbcl_dir);

const char *init_args[] = {"", "--dynamic-space-size", "8192", "--core", core_path, "--noinform", "--no-userinit"};

Expand Down
8 changes: 4 additions & 4 deletions lib/generate-bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

(in-package #:sbcl-librarian/lib)

(define-aggregate-library libsbcl-librarian (:function-linkage "LIBSBCL_LIBRARIAN_API")
(define-aggregate-library sbcl-librarian (:function-linkage "LIBSBCL_LIBRARIAN_API")
diagnostics
environment
errors
Expand Down Expand Up @@ -83,6 +83,6 @@
(format stream "signal.signal(signal.SIGTERM, _term_handler)~%~%")
(format stream "signal.signal(signal.SIGINT, _int_handler)~%~%")))

(build-bindings libsbcl-librarian "." :omit-init-function t)
(build-python-bindings libsbcl-librarian "." :omit-init-call t)
(build-core-and-die libsbcl-librarian ".")
(build-bindings sbcl-librarian "." :omit-init-function t)
(build-python-bindings sbcl-librarian "." :omit-init-call t :write-python-header-fn #'write-python-header)
(build-core-and-die sbcl-librarian ".")
File renamed without changes.
2 changes: 1 addition & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ cmake --install . --prefix=$PREFIX
popd

# Package Python library
cp lib/build/libsbcl_librarian.py lib/python/src/sbcl_librarian/raw.py
cp lib/build/sbcl_librarian.py lib/python/src/sbcl_librarian/raw.py
$PYTHON -m pip install lib/python/ --no-deps --ignore-installed -vv
2 changes: 1 addition & 1 deletion src/bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
(let ((guard (format nil "_~A_h" c-name)))
(format stream "#ifndef ~A~%" guard)
(format stream "#define ~A~%~%" guard))
(format stream "#include <libsbcl_librarian_err.h>~%~%")
(format stream "#include <sbcl_librarian_err.h>~%~%")
(when linkage
(write-linkage-macro linkage build-flag stream))
(dolist (api (library-apis library))
Expand Down
4 changes: 2 additions & 2 deletions src/python-bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:function-prefix function-prefix
:error-map error-map)
(format nil
"~a = ~a.~a
"~a = ~a_dll.~a
~a.restype = ~a
~a.argtypes = [~{~a~^, ~}]
~:[~;~a = sbcl_librarian.wrapper.lift_fn(\"~:*~a\", ~:*~a)~%~]"
Expand Down Expand Up @@ -50,7 +50,7 @@
(format stream "except TypeError as e:~%")
(format stream " raise Exception('Unable to locate ~a') from e~%~%" name)))

(format stream "~a = CDLL(str(libpath), mode=RTLD_GLOBAL)~%~%" name)
(format stream "~a_dll = CDLL(str(libpath), mode=RTLD_GLOBAL)~%~%" name)
(unless omit-init-call
(format stream "~a.init(str(libpath.parent / '~a.core').encode('utf-8'))~%~%"
name name))))
Expand Down

0 comments on commit 2bf181e

Please sign in to comment.