Skip to content

Commit

Permalink
try build mpfr
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Feb 6, 2025
1 parent 61b1711 commit a1e3cba
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/build-all-gmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build All GMP
on:
push:
branches:
- master
- add-mpfr
paths:
- .github/workflows/build-all-gmp.yml
- .github/workflows/build-gmp.yml
Expand All @@ -15,6 +15,11 @@ on:
type: string
required: false
default: '6.3.0'
mpfr-version:
description: 'MPFR Version'
type: string
required: false
default: '4.2.1'
build-type:
description: 'Build type (shared or static)'
required: true
Expand All @@ -26,21 +31,21 @@ jobs:
matrix:
include:
- { os: linux, arch: x64 }
- { os: linux, arch: x86 }
- { os: linux, arch: arm64 }
- { os: linux, arch: arm }
- { os: linux-musl, arch: x64 }
- { os: linux-musl, arch: arm64 }
- { os: win, arch: x64 }
- { os: win, arch: x86 }
- { os: android, arch: x64 }
- { os: android, arch: arm64 }
- { os: android, arch: x86 }
- { os: android, arch: arm }
- { os: osx, arch: arm64 }
- { os: osx, arch: x64 }
- { os: ios, arch: arm64 }
- { os: browser, arch: wasm }
# - { os: linux, arch: x86 }
# - { os: linux, arch: arm64 }
# - { os: linux, arch: arm }
# - { os: linux-musl, arch: x64 }
# - { os: linux-musl, arch: arm64 }
# - { os: win, arch: x64 }
# - { os: win, arch: x86 }
# - { os: android, arch: x64 }
# - { os: android, arch: arm64 }
# - { os: android, arch: x86 }
# - { os: android, arch: arm }
# - { os: osx, arch: arm64 }
# - { os: osx, arch: x64 }
# - { os: ios, arch: arm64 }
# - { os: browser, arch: wasm }

uses: ./.github/workflows/build-gmp.yml
with:
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/build-gmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'GMP version'
required: true
type: string
mpfr-version:
description: 'MPFR version'
required: true
type: string
build-type:
description: 'Build type (shared or static)'
required: true
Expand All @@ -35,6 +39,10 @@ on:
description: 'GMP version'
required: true
default: 6.3.0
mpfr-version:
description: 'MPFR version'
required: true
default: 4.2.1
build-type:
description: 'Build type (shared or static)'
required: true
Expand Down Expand Up @@ -198,10 +206,12 @@ jobs:
esac
case "$BUILD_TYPE" in
"shared")
echo "GMP_CONFIGURE_ARGS=--enable-shared --disable-static ${GMP_CONFIGURE_ARGS}" >> $GITHUB_ENV
echo "GMP_CONFIGURE_ARGS=${GMP_CONFIGURE_ARGS}" >> $GITHUB_ENV
echo "BUILD_TYPE_ARGS=--enable-shared --disable-static" >> $GITHUB_ENV
;;
"static")
echo "GMP_CONFIGURE_ARGS=--enable-static --disable-shared ${GMP_CONFIGURE_ARGS}" >> $GITHUB_ENV
echo "GMP_CONFIGURE_ARGS=${GMP_CONFIGURE_ARGS}" >> $GITHUB_ENV
echo "BUILD_TYPE_ARGS=--enable-static --disable-shared" >> $GITHUB_ENV
echo "GMP_SO=libgmp.a" >> $GITHUB_ENV
echo "GMP_CPP_SO=libgmpxx.a" >> $GITHUB_ENV
;;
Expand Down Expand Up @@ -279,19 +289,37 @@ jobs:
- name: Configure GMP
run: |
cd gmp-${{ inputs.gmp-version }}
${{ env.GMP_CONFIGURE }} ${{ env.GMP_CONFIGURE_ARGS }} --host=${{ env.HOST }}
${{ env.GMP_CONFIGURE }} ${{ env.BUILD_TYPE_ARGS }} ${{ env.GMP_CONFIGURE_ARGS }} --host=${{ env.HOST }}
- name: Build GMP
run: |
cd gmp-${{ inputs.gmp-version }}
make -j4
- name: Download MPFR Source
run: |
wget -nv https://mirrors.nju.edu.cn/gnu/mpfr/mpfr-${{ inputs.mpfr-version }}.tar.xz
tar -xf mpfr-${{ inputs.mpfr-version }}.tar.xz
- name: Configure MPFR
run: |
cd mpfr-${{ inputs.mpfr-version }}
./configure --with-gmp-include=${{ github.workspace }}/gmp-${{ inputs.gmp-version }} --with-gmp-lib=${{ github.workspace }}/gmp-${{ inputs.gmp-version }}/.libs ${{ env.BUILD_TYPE_ARGS }} --host=${{ env.HOST }}
- name: Build MPFR
run: |
cd mpfr-${{ inputs.mpfr-version }}
make -j4
- name: Check .libs
run: |
cd gmp-${{ inputs.gmp-version }}/.libs
ls -l
file ${{ env.GMP_SO }}
cd gmp-${{ inputs.mpfr-version }}/.libs
ls -l
- name: Generate .lib files (Windows shared only)
if: ${{ inputs.os == 'win' && env.BUILD_TYPE == 'shared' }}
run: |
Expand Down

0 comments on commit a1e3cba

Please sign in to comment.