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:
Hamza Hamud 2025-12-19 14:07:47 +00:00 committed by GitHub
parent a05d6b38b1
commit af5097c189
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 37 additions and 65 deletions

View File

@ -85,7 +85,8 @@ 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 ..

View File

@ -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

View File

@ -87,7 +87,7 @@ 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 ..

View File

@ -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
View 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

View File

@ -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