Compare commits

...

2 Commits

Author SHA1 Message Date
Sofia Rodrigues
db27667ce5 feat: changed the names of set 2025-06-18 14:24:48 -03:00
Sofia Rodrigues
3a40ff06d9 feat: add libidn2 2025-06-18 14:24:48 -03:00
9 changed files with 45 additions and 9 deletions

View File

@@ -62,11 +62,11 @@ jobs:
with:
msystem: clang64
# `:` means do not prefix with msystem
pacboy: "make: python: cmake clang ccache gmp libuv git: zip: unzip: diffutils: binutils: tree: zstd tar:"
pacboy: "make: python: cmake clang ccache gmp libuv libidn2 git: zip: unzip: diffutils: binutils: tree: zstd tar:"
if: runner.os == 'Windows'
- name: Install Brew Packages
run: |
brew install ccache tree zstd coreutils gmp libuv
brew install ccache tree zstd coreutils gmp libuv libidn2
if: runner.os == 'macOS'
- name: Checkout
uses: actions/checkout@v4
@@ -95,7 +95,7 @@ jobs:
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib ccache libuv1-dev:i386 pkgconf:i386
sudo apt-get install -y gcc-multilib g++-multilib ccache libidn2-0-dev libuv1-dev:i386 pkgconf:i386
if: matrix.cmultilib
- name: Cache
id: restore-cache

View File

@@ -9,6 +9,7 @@ Requirements
- [CMake](http://www.cmake.org)
- [GMP (GNU multiprecision library)](http://gmplib.org/)
- [LibUV](https://libuv.org/)
- [Libidn2](https://www.gnu.org/software/libidn/#libidn2)
Platform-Specific Setup
-----------------------

View File

@@ -32,7 +32,7 @@ MSYS2 has a package management system, [pacman][pacman].
Here are the commands to install all dependencies needed to compile Lean on your machine.
```bash
pacman -S make python mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-ccache mingw-w64-clang-x86_64-libuv mingw-w64-clang-x86_64-gmp git unzip diffutils binutils
pacman -S make python mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-ccache mingw-w64-clang-x86_64-libuv mingw-w64-x86_64-libidn2 mingw-w64-clang-x86_64-gmp git unzip diffutils binutils
```
You should now be able to run these commands:

View File

@@ -38,6 +38,7 @@ cmake -DCMAKE_CXX_COMPILER=g++ ...
brew install cmake
brew install gmp
brew install libuv
brew install libidn2
brew install pkgconf
```

View File

@@ -8,5 +8,5 @@ follow the [generic build instructions](index.md).
## Basic packages
```bash
sudo apt-get install git libgmp-dev libuv1-dev cmake ccache clang pkgconf
sudo apt-get install git libgmp-dev libuv1-dev cmake ccache clang pkgconf libidn2-dev
```

View File

@@ -24,7 +24,7 @@
stdenv = pkgs.overrideCC pkgs.stdenv lean-packages.llvmPackages.clang;
} ({
buildInputs = with pkgs; [
cmake gmp libuv ccache pkg-config
cmake gmp libuv ccache libidn2 pkg-config
lean-packages.llvmPackages.llvm # llvm-symbolizer for asan/lsan
gdb
tree # for CI

View File

@@ -1,5 +1,5 @@
{ src, debug ? false, stage0debug ? false, extraCMakeFlags ? [],
stdenv, lib, cmake, pkg-config, gmp, libuv, cadical, git, gnumake, bash, buildLeanPackage, writeShellScriptBin, runCommand, symlinkJoin, lndir, perl, gnused, darwin, llvmPackages, linkFarmFromDrvs,
stdenv, lib, cmake, pkg-config, gmp, libuv, cadical, git, gnumake, bash, libidn2, buildLeanPackage, writeShellScriptBin, runCommand, symlinkJoin, lndir, perl, gnused, darwin, llvmPackages, linkFarmFromDrvs,
... } @ args:
with builtins;
lib.warn "The Nix-based build is deprecated" rec {
@@ -7,7 +7,7 @@ lib.warn "The Nix-based build is deprecated" rec {
sourceByRegex = p: rs: lib.sourceByRegex p (map (r: "(/src/)?${r}") rs);
buildCMake = args: stdenv.mkDerivation ({
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ gmp libuv llvmPackages.llvm ];
buildInputs = [ gmp libuv libidn2 llvmPackages.llvm ];
# https://github.com/NixOS/nixpkgs/issues/60919
hardeningDisable = [ "all" ];
dontStrip = (args.debug or debug);
@@ -159,7 +159,7 @@ lib.warn "The Nix-based build is deprecated" rec {
test = buildCMake {
name = "lean-test-${desc}";
realSrc = lib.sourceByRegex src [ "src.*" "tests.*" ];
buildInputs = [ gmp libuv perl git cadical ];
buildInputs = [ gmp libuv perl libidn2 git cadical ];
preConfigure = ''
cd src
'';

View File

@@ -311,15 +311,38 @@ index 5e8e0166..f3b29134 100644
PATCH_COMMAND git reset --hard HEAD && printf "${LIBUV_PATCH}" > patch.diff && git apply patch.diff
BUILD_IN_SOURCE ON
INSTALL_COMMAND "")
set(LIBUV_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/libuv/src/libuv/include")
set(LIBUV_LDFLAGS "${CMAKE_BINARY_DIR}/libuv/src/libuv/libuv.a")
ExternalProject_add(libidn2
PREFIX libidn2
GIT_REPOSITORY https://gitlab.com/libidn/libidn2.git
# Use a stable release tag
GIT_TAG v2.3.4
CONFIGURE_COMMAND <SOURCE_DIR>/configure --host=wasm32-unknown-emscripten --prefix=<INSTALL_DIR> --disable-shared --enable-static --disable-doc --disable-nls --with-pic CFLAGS=${LIBIDN2_EMSCRIPTEN_FLAGS}
PATCH_COMMAND git reset --hard HEAD && printf "${LIBIDN2_PATCH}" > patch.diff && git apply patch.diff || true
BUILD_COMMAND make -j${CMAKE_BUILD_PARALLEL_LEVEL}
BUILD_IN_SOURCE ON
INSTALL_COMMAND make install)
set(LIBIDN2_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/libidn2/include")
set(LIBIDN2_LDFLAGS "${CMAKE_BINARY_DIR}/libidn2/lib/libidn2.a")
else()
find_package(LibUV 1.0.0 REQUIRED)
find_package(LibIDN2 1.0.0 REQUIRED)
endif()
include_directories(${LIBUV_INCLUDE_DIRS})
include_directories(${LIBIDN2_INCLUDE_DIRS})
if(NOT LEAN_STANDALONE)
string(JOIN " " LIBUV_LDFLAGS ${LIBUV_LDFLAGS})
string(APPEND LEAN_EXTRA_LINKER_FLAGS " ${LIBUV_LDFLAGS}")
string(JOIN " " LIBIDN2_LDFLAGS ${LIBIDN2_LDFLAGS})
string(APPEND LEAN_EXTRA_LINKER_FLAGS " ${LIBIDN2_LDFLAGS}")
endif()
# Windows SDK (for ICU)

View File

@@ -0,0 +1,11 @@
if (LIBIDN2_INCLUDE_DIRS AND LIBIDN2_LDFLAGS)
set(LIBIDN2_FIND_QUIETLY TRUE)
endif (LIBIDN2_INCLUDE_DIRS AND LIBIDN2_LDFLAGS)
find_path(LIBIDN2_INCLUDE_DIRS NAMES idn2.h)
find_library(LIBIDN2_LDFLAGS NAMES idn2 REQUIRED)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibIDN2 DEFAULT_MSG LIBIDN2_INCLUDE_DIRS LIBIDN2_LDFLAGS)
mark_as_advanced(LIBIDN2_INCLUDE_DIRS LIBIDN2_LDFLAGS)