mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
feat: convert emp install python script into bash emp (#496)
* feat: convert emp install python script into bash emp * feat: add script
This commit is contained in:
parent
a05d6b38b1
commit
af5097c189
@ -72,20 +72,21 @@ FROM base AS build
|
|||||||
ENV GOEXPERIMENT=arenas
|
ENV GOEXPERIMENT=arenas
|
||||||
ENV QUILIBRIUM_SIGNATURE_CHECK=false
|
ENV QUILIBRIUM_SIGNATURE_CHECK=false
|
||||||
|
|
||||||
# Install grpcurl before building the node and client
|
# Install grpcurl before building the node and client
|
||||||
# as to avoid needing to redo it on rebuilds
|
# as to avoid needing to redo it on rebuilds
|
||||||
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
||||||
|
|
||||||
WORKDIR /opt/ceremonyclient
|
WORKDIR /opt/ceremonyclient
|
||||||
|
|
||||||
# Copy everything except node and client so as to avoid
|
# Copy everything except node and client so as to avoid
|
||||||
# invalidating the cache at this point on client or node rebuilds
|
# invalidating the cache at this point on client or node rebuilds
|
||||||
|
|
||||||
COPY --exclude=client \
|
COPY --exclude=client \
|
||||||
--exclude=conntest \
|
--exclude=conntest \
|
||||||
--exclude=sidecar . .
|
--exclude=sidecar . .
|
||||||
|
|
||||||
RUN python emp-install.py --install --tool --ot
|
RUN bash install-emp.sh
|
||||||
|
|
||||||
|
|
||||||
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
|
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
automake \
|
automake \
|
||||||
libtool \
|
libtool \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
python3 \
|
|
||||||
python-is-python3 \
|
|
||||||
libflint-dev \
|
libflint-dev \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
@ -59,11 +57,11 @@ FROM base AS emp-builder
|
|||||||
|
|
||||||
WORKDIR /opt/ceremonyclient
|
WORKDIR /opt/ceremonyclient
|
||||||
# Copy the necessary script and source directories
|
# Copy the necessary script and source directories
|
||||||
COPY emp-install.py .
|
COPY install_emp.sh .
|
||||||
COPY emp-tool emp-tool
|
COPY emp-tool emp-tool
|
||||||
COPY emp-ot emp-ot
|
COPY emp-ot emp-ot
|
||||||
|
|
||||||
RUN python emp-install.py --install --tool --ot
|
RUN bash install-emp.sh
|
||||||
|
|
||||||
# Fix emp-tool to be static and install
|
# Fix emp-tool to be static and install
|
||||||
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make -j$(nproc) && make install
|
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make -j$(nproc) && make install
|
||||||
|
|||||||
@ -74,20 +74,20 @@ FROM base-avx512 AS build-avx512
|
|||||||
ENV GOEXPERIMENT=arenas
|
ENV GOEXPERIMENT=arenas
|
||||||
ENV QUILIBRIUM_SIGNATURE_CHECK=false
|
ENV QUILIBRIUM_SIGNATURE_CHECK=false
|
||||||
|
|
||||||
# Install grpcurl before building the node and client
|
# Install grpcurl before building the node and client
|
||||||
# as to avoid needing to redo it on rebuilds
|
# as to avoid needing to redo it on rebuilds
|
||||||
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
|
||||||
|
|
||||||
WORKDIR /opt/ceremonyclient
|
WORKDIR /opt/ceremonyclient
|
||||||
|
|
||||||
# Copy everything except node and client so as to avoid
|
# Copy everything except node and client so as to avoid
|
||||||
# invalidating the cache at this point on client or node rebuilds
|
# invalidating the cache at this point on client or node rebuilds
|
||||||
|
|
||||||
COPY --exclude=node \
|
COPY --exclude=node \
|
||||||
--exclude=client \
|
--exclude=client \
|
||||||
--exclude=sidecar . .
|
--exclude=sidecar . .
|
||||||
|
|
||||||
RUN python emp-install.py --install --tool --ot
|
RUN bash install-emp.sh
|
||||||
|
|
||||||
ENV CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
|
ENV CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512"
|
||||||
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
|
RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd ..
|
||||||
@ -98,9 +98,9 @@ RUN cd emp-ot && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr
|
|||||||
WORKDIR /opt/ceremonyclient/channel
|
WORKDIR /opt/ceremonyclient/channel
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
RUN ./generate.sh
|
RUN ./generate.sh
|
||||||
|
|
||||||
|
|
||||||
## Generate Rust bindings for VDF
|
## Generate Rust bindings for VDF
|
||||||
WORKDIR /opt/ceremonyclient/vdf
|
WORKDIR /opt/ceremonyclient/vdf
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
#!/usr/python
|
|
||||||
|
|
||||||
# This script modified from original source: https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/scripts/install.py
|
|
||||||
# EMP Toolkit is licensed under the MIT license, see LICENSE file in emp-tool and emp-ot for more info.
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
install_packages = '''
|
|
||||||
if [ "$(uname)" == "Darwin" ]; then
|
|
||||||
brew list openssl || brew install openssl
|
|
||||||
brew list pkg-config || brew install pkg-config
|
|
||||||
brew list cmake || brew install cmake
|
|
||||||
else
|
|
||||||
if command -v apt-get >/dev/null; then
|
|
||||||
sudo apt-get install -y software-properties-common
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y cmake git build-essential libssl-dev
|
|
||||||
elif command -v yum >/dev/null; then
|
|
||||||
sudo yum install -y python3 gcc make git cmake gcc-c++ openssl-devel
|
|
||||||
else
|
|
||||||
echo "System not supported yet!"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
'''
|
|
||||||
|
|
||||||
install_template = '''
|
|
||||||
cd X
|
|
||||||
cmake .
|
|
||||||
make -j4
|
|
||||||
sudo make install
|
|
||||||
cd ..
|
|
||||||
'''
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('-install', '--install', action='store_true')
|
|
||||||
parser.add_argument('-deps', '--deps', action='store_true')
|
|
||||||
parser.add_argument('--tool', nargs='?', const='master')
|
|
||||||
parser.add_argument('--ot', nargs='?', const='master')
|
|
||||||
parser.add_argument('--sh2pc', nargs='?', const='master')
|
|
||||||
parser.add_argument('--ag2pc', nargs='?', const='master')
|
|
||||||
parser.add_argument('--agmpc', nargs='?', const='master')
|
|
||||||
parser.add_argument('--zk', nargs='?', const='master')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
if vars(args)['install'] or vars(args)['deps']:
|
|
||||||
subprocess.call(["bash", "-c", install_packages])
|
|
||||||
|
|
||||||
for k in ['tool', 'ot', 'zk', 'sh2pc', 'ag2pc', 'agmpc']:
|
|
||||||
if vars(args)[k]:
|
|
||||||
template = install_template.replace("X", "emp-"+k).replace("Y", vars(args)[k])
|
|
||||||
print(template)
|
|
||||||
subprocess.call(["bash", "-c", template])
|
|
||||||
25
install-emp.sh
Normal file
25
install-emp.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TOOLS=("emp-tool" "emp-ot")
|
||||||
|
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
brew install openssl pkg-config cmake
|
||||||
|
else
|
||||||
|
if command -v apt-get >/dev/null; then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y software-properties-common cmake git build-essential libssl-dev
|
||||||
|
elif command -v yum >/dev/null; then
|
||||||
|
sudo yum install -y python3 gcc make git cmake gcc-c++ openssl-devel
|
||||||
|
else
|
||||||
|
echo "System not supported yet!"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tool in ${TOOLS[@]};do
|
||||||
|
cd $tool
|
||||||
|
cmake .
|
||||||
|
make -j4
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
echo "Successfully installed $tool"
|
||||||
|
done
|
||||||
@ -57,7 +57,7 @@ rm -rf "$FLINT_TMP"
|
|||||||
|
|
||||||
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
|
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
|
||||||
|
|
||||||
python emp-install.py --install --tool --ot
|
bash install-emp.sh
|
||||||
|
|
||||||
pushd emp-tool
|
pushd emp-tool
|
||||||
sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt
|
sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user