From fb0fc08efd97abd89b0e2a8e3b9d76643e038a32 Mon Sep 17 00:00:00 2001 From: neodiX Date: Sun, 22 Dec 2024 21:30:51 +0400 Subject: [PATCH] remove gsl for portable artifacts; add -f key to generate-random-id in order to read addr_list from file; --- .../workflows/build-ton-linux-x86-64-portable.yml | 5 +++-- assembly/native/build-ubuntu-portable.sh | 4 ++-- utils/generate-random-id.cpp | 13 +++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-ton-linux-x86-64-portable.yml b/.github/workflows/build-ton-linux-x86-64-portable.yml index e33c8d68d..dd2741e95 100644 --- a/.github/workflows/build-ton-linux-x86-64-portable.yml +++ b/.github/workflows/build-ton-linux-x86-64-portable.yml @@ -18,8 +18,9 @@ jobs: - name: Install system libraries run: | - sudo apt-get update - sudo apt-get install -y build-essential git cmake ninja-build libc++-dev libc++abi-dev + sudo apt update + sudo apt install -y build-essential git cmake ninja-build libc++-dev libc++abi-dev + sudo apt remove libgsl-dev - if: matrix.os != 'ubuntu-24.04' run: | diff --git a/assembly/native/build-ubuntu-portable.sh b/assembly/native/build-ubuntu-portable.sh index d41f5d8b4..e8597e88e 100644 --- a/assembly/native/build-ubuntu-portable.sh +++ b/assembly/native/build-ubuntu-portable.sh @@ -33,7 +33,7 @@ git clone https://github.com/lz4/lz4.git cd lz4 lz4Path=`pwd` git checkout v1.9.4 -make -j12 +CFLAGS="-fPIC" make -j12 test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } cd .. # ./lib/liblz4.a @@ -102,7 +102,7 @@ fi cmake -GNinja .. \ -DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/usr/lib/llvm-16/include/c++/v1" \ --DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -I/usr/lib/llvm-16/include/c++/v1" \ +-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -static-libgcc -static-libstdc++ /usr/lib/llvm-14/lib/libc++abi.a -I/usr/lib/llvm-16/include/c++/v1" \ -DPORTABLE=1 \ -DCMAKE_BUILD_TYPE=Release \ -DOPENSSL_FOUND=1 \ diff --git a/utils/generate-random-id.cpp b/utils/generate-random-id.cpp index f606f3581..2afc6982d 100644 --- a/utils/generate-random-id.cpp +++ b/utils/generate-random-id.cpp @@ -84,6 +84,19 @@ int main(int argc, char *argv[]) { TRY_RESULT_PREFIX_ASSIGN(addr_list, ton::adnl::AdnlAddressList::create(addr_list_tl), "bad addr list: "); return td::Status::OK(); }); + p.add_checked_option('f', "path to file with addr-list", "addr list to sign", [&](td::Slice key) { + if (addr_list) { + return td::Status::Error("duplicate '-f' option"); + } + + td::BufferSlice bs(key); + TRY_RESULT_PREFIX(data, td::read_file(key.str()), "failed to read addr-list: "); + TRY_RESULT_PREFIX(as_json_value, data), "bad addr list JSON: "); + ton::tl_object_ptr addr_list_tl; + TRY_STATUS_PREFIX(td::from_json(addr_list_tl, std::move(as_json_value)), "bad addr list TL: "); + TRY_RESULT_PREFIX_ASSIGN(addr_list, ton::adnl::AdnlAddressList::create(addr_list_tl), "bad addr list: "); + return td::Status::OK(); + }); p.add_checked_option('i', "network-id", "dht network id (default: -1)", [&](td::Slice key) { if (network_id_opt) { return td::Status::Error("duplicate '-i' option");