diff --git a/BUILD.bazel b/BUILD.bazel index db5f5693df..c2e6717b04 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -3,7 +3,17 @@ load("//tools/project:build_defs.bzl", "project") project(license = "gpl3-https") -genrule( +filegroup( + name = "legacy_headers", + srcs = [ + "tox/tox.h", + "tox/toxav.h", + "tox/toxencryptsave.h", + ], + visibility = ["//visibility:public"], +) + +filegroup( name = "public_headers", srcs = [ "//c-toxcore/toxav:toxav.h", @@ -11,25 +21,16 @@ genrule( "//c-toxcore/toxcore:tox_private.h", "//c-toxcore/toxencryptsave:toxencryptsave.h", ], - outs = [ - "tox/toxav.h", - "tox/tox.h", - "tox/tox_private.h", - "tox/toxencryptsave.h", - ], - cmd = """ - cp $(location //c-toxcore/toxav:toxav.h) $(GENDIR)/c-toxcore/tox/toxav.h - cp $(location //c-toxcore/toxcore:tox.h) $(GENDIR)/c-toxcore/tox/tox.h - cp $(location //c-toxcore/toxcore:tox_private.h) $(GENDIR)/c-toxcore/tox/tox_private.h - cp $(location //c-toxcore/toxencryptsave:toxencryptsave.h) $(GENDIR)/c-toxcore/tox/toxencryptsave.h - """, visibility = ["//visibility:public"], ) cc_library( name = "c-toxcore", - hdrs = [":public_headers"], - includes = ["."], + hdrs = [ + ":legacy_headers", + ":public_headers", + ], + strip_include_prefix = ".", visibility = ["//visibility:public"], deps = [ "//c-toxcore/toxav", diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aebd17945..eb86110992 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,6 +362,7 @@ else() endif() set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium) set(toxcore_API_HEADERS + ${toxcore_SOURCE_DIR}/tox/tox.h^tox ${toxcore_SOURCE_DIR}/toxcore/tox.h^tox ${toxcore_SOURCE_DIR}/toxcore/tox_events.h^tox ${toxcore_SOURCE_DIR}/toxcore/tox_dispatch.h^tox) @@ -397,6 +398,7 @@ if(BUILD_TOXAV) toxav/video.c toxav/video.h) set(toxcore_API_HEADERS ${toxcore_API_HEADERS} + ${toxcore_SOURCE_DIR}/tox/toxav.h^toxav ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) if(MSVC) @@ -420,6 +422,7 @@ set(toxcore_SOURCES ${toxcore_SOURCES} toxencryptsave/toxencryptsave.c toxencryptsave/toxencryptsave.h) set(toxcore_API_HEADERS ${toxcore_API_HEADERS} + ${toxcore_SOURCE_DIR}/tox/toxencryptsave.h^tox ${toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsave.h^tox) ################################################################################ @@ -501,8 +504,8 @@ endif() make_version_script(toxcore ${toxcore_API_HEADERS}) # Generate pkg-config file, install library to "${CMAKE_INSTALL_LIBDIR}" and install headers to -# "${CMAKE_INSTALL_INCLUDEDIR}/tox". -install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox) +# "${CMAKE_INSTALL_INCLUDEDIR}". +install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ################################################################################ # diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index c20a80a1f7..35ca8b9127 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake @@ -20,6 +20,7 @@ if(FULLY_STATIC) endif() function(install_module lib) + cmake_parse_arguments(INSTALL_MODULE "" "DESTINATION" "" ${ARGN}) if(TARGET ${lib}_shared) set_target_properties(${lib}_shared PROPERTIES VERSION ${SOVERSION} @@ -59,7 +60,10 @@ function(install_module lib) foreach(sublib ${${lib}_API_HEADERS}) string(REPLACE "^" ";" sublib ${sublib}) list(GET sublib 0 header) + string(REPLACE "${${lib}_SOURCE_DIR}/" "" target_header ${header}) + get_filename_component(target_path ${target_header} DIRECTORY) - install(FILES ${header} ${ARGN}) + install(FILES ${header} DESTINATION + "${INSTALL_MODULE_DESTINATION}/${target_path}") endforeach() endfunction() diff --git a/cmake/StrictAbi.cmake b/cmake/StrictAbi.cmake index ec5792199b..265676f78c 100644 --- a/cmake/StrictAbi.cmake +++ b/cmake/StrictAbi.cmake @@ -32,12 +32,14 @@ function(_make_version_script target) COMMAND ${SHELL} -c "egrep '^\\w' ${header} | grep '${ns}_[a-z0-9_]*(' | grep -v '^typedef' | grep -o '${ns}_[a-z0-9_]*(' | egrep -o '[a-z0-9_]+' | sort -u" OUTPUT_VARIABLE sublib_SYMS OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" sublib_SYMS ${sublib_SYMS}) + if(sublib_SYMS) + string(REPLACE "\n" ";" sublib_SYMS ${sublib_SYMS}) - foreach(sym ${sublib_SYMS}) - file(APPEND ${${target}_VERSION_SCRIPT} - "${sym};\n") - endforeach(sym) + foreach(sym ${sublib_SYMS}) + file(APPEND ${${target}_VERSION_SCRIPT} + "${sym};\n") + endforeach(sym) + endif() endforeach(sublib) file(APPEND ${${target}_VERSION_SCRIPT} diff --git a/other/bootstrap_daemon/docker/Dockerfile b/other/bootstrap_daemon/docker/Dockerfile index 3d150e02f6..3cb0e80979 100644 --- a/other/bootstrap_daemon/docker/Dockerfile +++ b/other/bootstrap_daemon/docker/Dockerfile @@ -27,6 +27,7 @@ COPY other/DHT_bootstrap.c other/ COPY other/pkgconfig other/pkgconfig COPY other/rpm other/rpm COPY testing/misc_tools.[ch] testing/ +COPY tox tox COPY toxcore toxcore COPY toxencryptsave toxencryptsave COPY third_party third_party diff --git a/other/rpm/toxcore.spec.in b/other/rpm/toxcore.spec.in index d7064eb61d..1e774aeacb 100644 --- a/other/rpm/toxcore.spec.in +++ b/other/rpm/toxcore.spec.in @@ -105,6 +105,9 @@ getent passwd tox-bootstrapd >/dev/null || \ %files devel %defattr(-, root, root) %{_includedir}/tox/ +%{_includedir}/toxav/ +%{_includedir}/toxcore/ +%{_includedir}/toxencryptsave/ %{_libdir}/pkgconfig/toxcore.pc %files static diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel index 4427347f16..3a8f180b29 100644 --- a/testing/BUILD.bazel +++ b/testing/BUILD.bazel @@ -1,6 +1,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") CIMPLE_FILES = [ + "//c-toxcore:legacy_headers", "//c-toxcore/toxav:cimple_files", "//c-toxcore/toxcore:cimple_files", "//c-toxcore/toxencryptsave:cimple_files", diff --git a/tox/tox.h b/tox/tox.h new file mode 100644 index 0000000000..590329c25f --- /dev/null +++ b/tox/tox.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later + * Copyright © 2024 The TokTok team. + */ +#include "../toxcore/tox.h" diff --git a/tox/toxav.h b/tox/toxav.h new file mode 100644 index 0000000000..7f2c5594ef --- /dev/null +++ b/tox/toxav.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later + * Copyright © 2024 The TokTok team. + */ +#include "../toxav/toxav.h" diff --git a/tox/toxencryptsave.h b/tox/toxencryptsave.h new file mode 100644 index 0000000000..afcb22a8ae --- /dev/null +++ b/tox/toxencryptsave.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later + * Copyright © 2024 The TokTok team. + */ +#include "../toxencryptsave/toxencryptsave.h" diff --git a/toxcore/BUILD.bazel b/toxcore/BUILD.bazel index 916c6221b2..7d15d04ac9 100644 --- a/toxcore/BUILD.bazel +++ b/toxcore/BUILD.bazel @@ -1119,10 +1119,10 @@ cc_library( ], ) -alias( +cc_library( name = "toxcore", - actual = ":tox_dispatch", - visibility = ["//c-toxcore:__subpackages__"], + visibility = ["//c-toxcore:__pkg__"], + deps = [":tox_dispatch"], ) sh_library(