Skip to content

Instantly share code, notes, and snippets.

@stintel
Created March 15, 2022 12:17
Show Gist options
  • Save stintel/4f03f589b85f5af08001c0df28b97aa7 to your computer and use it in GitHub Desktop.
Save stintel/4f03f589b85f5af08001c0df28b97aa7 to your computer and use it in GitHub Desktop.
sys-libs/libubox/files/libubox-lib64.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1b7d5..270dd8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,16 @@ IF(JSONC_FOUND)
INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
ENDIF()
+GET_PROPERTY(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+
+IF(LIB64)
+ set(LIB_SUFFIX 64)
+ELSE()
+ set(LIB_SUFFIX "")
+ENDIF()
+
+SET(LIB_DIR "lib${LIB_SUFFIX}" CACHE PATH "Library installation directory")
+
SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c base64.c)
ADD_LIBRARY(ubox SHARED ${SOURCES})
@@ -41,8 +51,8 @@ INSTALL(FILES ${headers}
DESTINATION include/libubox
)
INSTALL(TARGETS ubox ubox-static
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION "${LIB_DIR}"
+ LIBRARY DESTINATION "${LIB_DIR}"
)
ADD_SUBDIRECTORY(lua)
@@ -81,8 +91,8 @@ IF(EXISTS ${json})
TARGET_LINK_LIBRARIES(json_script ubox)
INSTALL(TARGETS blobmsg_json blobmsg_json-static jshn json_script
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION "${LIB_DIR}"
+ LIBRARY DESTINATION "${LIB_DIR}"
RUNTIME DESTINATION bin
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment