Skip to content

Commit

Permalink
Rename jscore4 to jscore and jscore6 to jsc.
Browse files Browse the repository at this point in the history
Appears Apple might be using an older version of the JavaScriptCore API.
  • Loading branch information
nmoinvaz committed Dec 25, 2024
1 parent 8681af3 commit 7957f0d
Show file tree
Hide file tree
Showing 10 changed files with 888 additions and 914 deletions.
41 changes: 12 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ elseif(APPLE)
threadpool_pthread.c)
if(PROXYRES_EXECUTE)
list(APPEND PROXYRES_SRCS
execute_jscore4.c
execute_jscore4.h
execute_jscore.c
execute_jscore.h
net_adapter_mac.c
wpad_dhcp_mac.c
wpad_dhcp_mac.h)
Expand All @@ -129,30 +129,15 @@ elseif(UNIX)
config_kde.c
config_kde.h
event_pthread.c
execute_jsc.c
execute_jsc.h
mutex_pthread.c
net_adapter_linux.c
resolver_gnome3.c
resolver_gnome3.h
threadpool_pthread.c
util_linux.c
util_linux.h)

pkg_search_module(JSCore4GTK javascriptcoregtk-4.1 javascriptcoregtk-4.0 javascriptcoregtk-3.0 javascriptcoregtk-1.0)
if(JSCore4GTK_FOUND)
list(APPEND PROXYRES_SRCS
execute_jscore4.c
execute_jscore4.h)
endif()
pkg_search_module(JSCore6GTK javascriptcoregtk-6.0)
if(JSCore6GTK_FOUND)
pkg_check_modules(GObject REQUIRED gobject-2.0)
list(APPEND PROXYRES_SRCS
execute_jscore6.c
execute_jscore6.h)
endif()
if(NOT JSCore4GTK_FOUND AND NOT JSCore6GTK_FOUND)
message(FATAL_ERROR "JavaScriptCoreGTK not found")
endif()
endif()

if(WIN32)
Expand Down Expand Up @@ -301,7 +286,7 @@ elseif(APPLE)

set_target_properties(proxyres PROPERTIES LINK_FLAGS -Wl,-F/Library/Frameworks)

target_compile_definitions(proxyres PRIVATE HAVE_JSCORE4)
target_compile_definitions(proxyres PRIVATE HAVE_JSCORE)
elseif(UNIX)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET glib-2.0)
target_link_libraries(proxyres PkgConfig::deps)
Expand All @@ -312,21 +297,19 @@ elseif(UNIX)
target_compile_definitions(proxyres PRIVATE HAVE_GCONF)
endif()

if(JSCore4GTK_FOUND)
# Don't link libraries at compile time since we dynamically load them at runtime
target_include_directories(proxyres PRIVATE ${JSCore4GTK_INCLUDE_DIRS})
target_compile_definitions(proxyres PRIVATE HAVE_JSCORE4)
endif()

if(JSCore6GTK_FOUND)
pkg_search_module(JSCoreGTK javascriptcoregtk-6.0 javascriptcoregtk-4.1 javascriptcoregtk-4.0)
if(JSCoreGTK_FOUND)
# Don't link libraries at compile time since we dynamically load them at runtime
target_include_directories(proxyres PRIVATE ${JSCore6GTK_INCLUDE_DIRS})
target_compile_definitions(proxyres PRIVATE HAVE_JSCORE6)
target_include_directories(proxyres PRIVATE ${JSCoreGTK_INCLUDE_DIRS})
target_compile_definitions(proxyres PRIVATE HAVE_JSC)

pkg_check_modules(GObject REQUIRED gobject-2.0)
if(GObject_FOUND)
target_include_directories(proxyres PRIVATE ${GObject_INCLUDE_DIRS})
target_link_libraries(proxyres ${GObject_LIBRARIES})
endif()
else()
message(FATAL_ERROR "JSCoreGTK not found")
endif()

find_package(Threads REQUIRED)
Expand Down
20 changes: 10 additions & 10 deletions execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# include "execute_wsh.h"
# endif
#else
# ifdef HAVE_JSCORE6
# include "execute_jscore6.h"
# ifdef HAVE_JSC
# include "execute_jsc.h"
# endif
# ifdef HAVE_JSCORE4
# include "execute_jscore4.h"
# ifdef HAVE_JSCORE
# include "execute_jscore.h"
# endif
#endif

Expand Down Expand Up @@ -69,13 +69,13 @@ bool proxy_execute_global_init(void) {
g_proxy_execute.proxy_execute_i = proxy_execute_wsh_get_interface();
# endif
#else
# ifdef HAVE_JSCORE6
if (proxy_execute_jscore6_global_init())
g_proxy_execute.proxy_execute_i = proxy_execute_jscore6_get_interface();
# ifdef HAVE_JSC
if (proxy_execute_jsc_global_init())
g_proxy_execute.proxy_execute_i = proxy_execute_jsc_get_interface();
# endif
# ifdef HAVE_JSCORE4
if (!g_proxy_execute.proxy_execute_i && proxy_execute_jscore4_global_init())
g_proxy_execute.proxy_execute_i = proxy_execute_jscore4_get_interface();
# ifdef HAVE_JSCORE
if (!g_proxy_execute.proxy_execute_i && proxy_execute_jscore_global_init())
g_proxy_execute.proxy_execute_i = proxy_execute_jscore_get_interface();
# endif
#endif
if (!g_proxy_execute.proxy_execute_i)
Expand Down
Loading

0 comments on commit 7957f0d

Please sign in to comment.