diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 0dda998a3..cd7281ede 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -50,6 +50,20 @@ endfunction() set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) +# build libjsoncpp and libsecret for flutter_secure_storage +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/build/pkg-config") +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/pc") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/include) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret/_build) + +add_library(jsoncpp SHARED IMPORTED) +set_target_properties(jsoncpp PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/build/lib/libjsoncpp.so") +add_library(secret-1 SHARED IMPORTED) +set_target_properties(secret-1 PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret/_build/libsecret/libsecret-1.so") + # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) @@ -71,8 +85,12 @@ add_executable(${BINARY_NAME} apply_standard_settings(${BINARY_NAME}) # Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE -static-libgcc -static-libstdc++) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +target_link_libraries(${BINARY_NAME} PRIVATE jsoncpp) +target_link_libraries(${BINARY_NAME} PRIVATE secret-1) + # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) @@ -125,6 +143,20 @@ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../crypto_plugins/flutter_libepiccash install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../crypto_plugins/flutter_liblelantus/scripts/linux/build/libmobileliblelantus.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/build/lib/libjsoncpp.so.1.9.5" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/build/lib/libjsoncpp.so.25" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/jsoncpp/build/lib/libjsoncpp.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret/_build/libsecret/libsecret-1.so.0.0.0" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret/_build/libsecret/libsecret-1.so.0" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../scripts/linux/build/libsecret/_build/libsecret/libsecret-1.so" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" diff --git a/scripts/linux/build_all.sh b/scripts/linux/build_all.sh index e199e3043..acc10ed99 100755 --- a/scripts/linux/build_all.sh +++ b/scripts/linux/build_all.sh @@ -1,5 +1,7 @@ #!/bin/bash +mkdir build +./build_secure_storage_deps.sh & (cd ../../crypto_plugins/flutter_liblelantus/scripts/linux && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libepiccash/scripts/linux && ./build_all.sh ) & (cd ../../crypto_plugins/flutter_libmonero/scripts/linux && ./build_monero_all.sh && ./build_sharedfile.sh ) & diff --git a/scripts/linux/build_secure_storage_deps.sh b/scripts/linux/build_secure_storage_deps.sh new file mode 100755 index 000000000..292c5f5e3 --- /dev/null +++ b/scripts/linux/build_secure_storage_deps.sh @@ -0,0 +1,23 @@ +#!/bin/bash +LINUX_DIRECTORY=$(pwd) +mkdir build + +# Build JsonCPP +cd build +git clone https://github.com/open-source-parsers/jsoncpp.git +git checkout 8190e061bc2d95da37479a638aa2c9e483e58ec6 +cd jsoncpp +mkdir build +cd build +cmake .. +make -j$(nproc) + +cd $LINUX_DIRECTORY +# Build libSecret +# sudo apt install libgirepository1.0-dev valac xsltproc gi-docgen docbook-xsl +# pip3 install --user gi-docgen +cd build +git clone https://gitlab.gnome.org/GNOME/libsecret.git +cd libsecret +meson _build +ninja -C _build diff --git a/scripts/linux/pc/libsecret-1.pc b/scripts/linux/pc/libsecret-1.pc new file mode 100644 index 000000000..7da2e13f5 --- /dev/null +++ b/scripts/linux/pc/libsecret-1.pc @@ -0,0 +1,15 @@ +prefix=/usr/local +libdir=${prefix}/lib/x86_64-linux-gnu +includedir=${prefix}/include + +exec_prefix=${prefix} +datarootdir=${prefix}/share +datadir=${datarootdir} +sysconfdir=${prefix}/etc + +Name: libsecret-1 +Description: GObject bindings for Secret Service API +Version: 0.20.5 +Requires: glib-2.0 >= 2.44, gio-2.0 >= 2.44, gio-unix-2.0 >= 2.44 +Requires.private: libgcrypt >= 1.2.2 +Libs: -L${libdir} -lsecret-1