Skip to content

Commit

Permalink
GMP/MPIR bindings fixups.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineKhaldi committed Nov 20, 2021
1 parent d011ca6 commit bf9a764
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ jobs:
python -m pip install maturin
rustup target add x86_64-unknown-linux-musl
- name: Install GMP
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install lzip -y
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
- name: Build Windows
if: startsWith(matrix.os, 'windows')
run: |
Expand Down Expand Up @@ -114,11 +122,12 @@ jobs:

- name: Install dependencies
run: |
sudo apt-get install lzip -y
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
python -m pip install maturin
rustup target add x86_64-unknown-linux-musl
sudo apt install libgmp3-dev
ls -la /usr/lib64
ls -la /usr/lib
- name: Build
env:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-arm64-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ jobs:
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y install openssl-devel && \
yum -y install gmp && \
ls -la /usr/lib64/ && \
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && /usr/bin/sudo make install && cd .. && rm -rf gmp-6.2.1 && \
source $HOME/.cargo/env && \
rustup target add aarch64-unknown-linux-musl && \
rm -rf venv && \
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-crate-and-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ jobs:
with:
fetch-depth: 0

- name: Install GMP
run: |
sudo apt-get install lzip -y
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
- name: Set up rusts
uses: actions-rs/toolchain@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-m1-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
. ./venv/bin/activate
export PATH=~/.cargo/bin:$PATH
arch -arm64 pip install maturin
arch -arm64 maturin build --no-sdist -i python --release --strip --cargo-extra-args="--features=openssl"
arch -arm64 maturin build --no-sdist -i python3 --release --strip --cargo-extra-args="--features=openssl"
- name: Install clvm_rs wheel
run: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ jobs:
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y install openssl-devel && \
yum -y install gmp && \
ls -la /usr/lib64 && \
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2 | tar -xj && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && /usr/bin/sudo make install && cd .. && rm -rf gmp-6.2.1 && \
source $HOME/.cargo/env && \
rustup target add x86_64-unknown-linux-musl && \
rm -rf venv && \
Expand Down Expand Up @@ -245,6 +246,12 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install GMP
run: |
sudo apt-get install lzip -y
curl -L https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz | lzip -dc | tar x && \
cd gmp-6.2.1 && ./configure --enable-fat --with-pic && \
make -j 6 && sudo make install && cd .. && rm -rf gmp-6.2.1
- name: Install rust
uses: actions-rs/toolchain@v1
with:
Expand Down
14 changes: 3 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
fn main() {
#[cfg(target_os = "windows")]
{
if cfg!(windows) {
println!("cargo:rustc-link-lib=mpir");
println!("cargo:rustc-link-search=mpir_gc_x64");
}
#[cfg(target_os = "linux")]
{
println!("cargo:rustc-link-lib=gmp");
println!("cargo:rustc-link-search=/usr/lib64");
println!("cargo:rustc-link-search=/usr/lib");
}
#[cfg(target_os = "macos")]
{
} else {
println!("cargo:rustc-link-lib=gmp");
println!("cargo:rustc-link-search=/usr/local/lib");
println!("cargo:rustc-link-search=/opt/homebrew/lib");
}
}

0 comments on commit bf9a764

Please sign in to comment.