gmpmee_sys/lib.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
// Copyright © 2024 Denis Morel
// This program is free software: you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option) any
// later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License and
// a copy of the GNU General Public License along with this program. If not, see
// <https://www.gnu.org/licenses/>.
//! The gmpmee-sys crate provides Rust FFI bindings to the
//! [GMP Modular Exponentiation Extension (GMPMEE)](https://github.com/verificatum/verificatum-gmpmee),
//! which is a minor extension of [GMP](https://gmplib.org/).
//! It adds simultaneous modular exponentiation and fixed base modular exponentiation functionality to the set of
//! integer functions (the mpz-functions), as well as special purpose primality testing routines.
//!
//! The crate is strongly inspired from [gmp-mpfr-sys](https://crates.io/crates/gmp-mpfr-sys).
//! In particular the file `build.rs` is copied from this crate, and adapted to the needs of the gmpmee-sys crate.
//! No cache is implemented, since the compilation is quick.
//!
//! # Types
//!
//! Unlike in the C libraries, the types (e.g. `gmpmee_spowm_tab`, `gmpmee_fpowm_tab`) are defined directly as structs,
//! not as single-element arrays.
//!
//! # Using gmpmee-sys
//!
//! The gmpmee-sys crate is available on crates.io.
//! To use gmpmee-sys in your crate, add it as a dependency inside [*Cargo.toml*]:
//!
//! ```toml
//! [dependencies]
//! gmpmee-sys = "0.1"
//! ```
//!
//! # Building on GNU/Linux
//!
//! To build on GNU/Linux, simply make sure you have `diffutils`, `gcc`,
//! `make` and `m4` installed on your system. For example on Fedora:
//!
//! ```sh
//! sudo dnf install diffutils gcc make m4
//! ```
//!
//! # Building on macOS
//!
//! To build on macOS, you need the command-line developer tools. To
//! install them, run the following command in a terminal:
//!
//! ```sh
//! xcode-select --install
//! ```
//!
//! # Building on Windows
//!
//! You can build on Windows with the Rust GNU toolchain and an up-to-date
//! MSYS2 installation. Some steps for a 64-bit environment are listed
//! below. (32-bit: Changes for a 32-bit environment are written in
//! brackets like this comment.)
//!
//! To install MSYS2:
//! 1. Install MSYS2 using the [installer][msys].
//! 2. Launch the MSYS2 MinGW 64-bit terminal from the start
//! menu. (32-bit: Launch the MSYS2 MinGW 32-bit terminal instead.)
//! 3. Install the required tools.
//! ```sh
//! pacman -S pacman-mirrors
//! pacman -S diffutils make mingw-w64-x86_64-gcc
//! ```
//!
//! (32-bit: Install `mingw-w64-i686-gcc` instead of
//! `mingw-w64-x86_64-gcc`.)
//!
//! Then, to build a crate with a dependency on this crate:
//! 1. Launch the MSYS MinGW 64-bit terminal from the start menu.
//! (32-bit: Launch the MSYS2 MinGW 32-bit terminal instead.)
//! 2. Change to the crate directory.
//! 3. Build the crate using `cargo`.
//!
//! # Licence
//!
//! The gmpee-sys crate is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. See the full text of the [LICENSE](LICENSE.md) for details.
mod gmpmee;
pub use gmpmee::*;