Skip to content

Commit

Permalink
opam fixes for 0.5.0 (#189)
Browse files Browse the repository at this point in the history
* make opam build work with bsd sed

* disable arm32 for opam hacl-star-raw for now

* fix s390x opam build

* fixes for ubuntu 18.04
  - drop some more modern cmake features
  - build opam package with old cmake style

* opam: add explicit dune dependency in hacl-star-raw.opam

Co-authored-by: Victor Dumitrescu <[email protected]>
  • Loading branch information
franziskuskiefer and victor-dumitrescu authored Sep 14, 2022
1 parent 16172fd commit 670facf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ jobs:
# ./mach test -l ocaml -v

packaging:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
Expand All @@ -78,8 +84,12 @@ jobs:
path: ~/.opam
key: ${{ runner.os }}-ocaml-setup

- name: System Setup
- name: Setup Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install ninja-build opam libgmp-dev
- name: Setup macOS
if: matrix.os == 'macos-latest'
run: brew install ninja opam gmp
- name: OCaml Setup
if: steps.cache-ocaml-setup.outputs.cache-hit != 'true'
run: |
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ endif()
project(hacl
VERSION 0.1.0
DESCRIPTION "The High Assurance Crypto Library"
HOMEPAGE_URL "https://www.cryspen.com/hacl"
LANGUAGES C CXX
)

Expand Down Expand Up @@ -355,7 +354,9 @@ endif()
set(CMAKE_INSTALL_LIBDIR lib)
include(GNUInstallDirs)
set(CMAKE_INSTALL_MESSAGE LAZY)
install(TARGETS hacl_static hacl)
install(TARGETS hacl_static hacl
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

# # Copy hacl headers
install(FILES ${PUBLIC_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hacl)
Expand Down
13 changes: 10 additions & 3 deletions ocaml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ C_DYN_LIB?=lib$(DYNAMIC_C_LIB_NAME).$(SO)
# Compiling the C library. This needs to be executed before and independently
# of build-bindings because it will also write Makefile.config, which is needed
# by build-bindings.
#
# Note that cmake 3.10 does not support -B to output build files to a different
# directory. Hence the other way of calling it here.
build-c:
cmake -B build -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
cd build && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../
make -C build
cp build/$(C_LIB) .
cp build/$(C_DYN_LIB) .
Expand Down Expand Up @@ -104,6 +107,10 @@ lib_gen/Lib_RandomBuffer_System_gen.exe: lib/Lib_RandomBuffer_System_bindings.cm

%.exe:

uname_m=$(shell uname -m)
OCAML_CFLAGS.s390x=-m64 -mzarch -mvx -mzvector -march=native -O3
CFLAGS+=$(OCAML_CFLAGS.$(uname_m))

lib_gen/%_gen.exe:
$(OCAMLOPT) $(filter-out %.a,$^) $(C_LIB) -o $@

Expand Down Expand Up @@ -147,8 +154,8 @@ clean:
# Install hacl-star-raw locally.
install: dllocamlevercrypt.$(OCAML_SO)
# We need to remove all comments from config.h because ccpo can't handle them
sed 's/\(\/\/.*\)\|\(\/\*.*\*\/\)//g' build/config.h > build/config-new.h
mv build/config-new.h build/config.h
sed 's/\(\/\/.*\)//g' build/config.h > build/config-new.h
sed 's/\(\/\*.*\*\/\)//g' build/config-new.h > build/config.h
ocamlfind remove hacl-star-raw || true
ocamlfind install hacl-star-raw META
ocamlfind install -add hacl-star-raw $(CTYPES_ML)
Expand Down
3 changes: 2 additions & 1 deletion ocaml/hacl-star-raw.opam
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ homepage: "https://hacl-star.github.io/"
bug-reports: "https://github.com/project-everest/hacl-star/issues"
depends: [
"ocaml" { >= "4.08.0" }
"dune" {>= "1.2"}
"ocamlfind" {build}
"ctypes" { >= "0.18.0" }
"conf-which" {build}
"conf-cmake" {build}
]
available: [
arch != "ppc64" & arch != "ppc32" &
arch != "ppc64" & arch != "ppc32" & arch != "arm32" &
(os = "freebsd" | os-family != "bsd")
]
x-ci-accept-failures: [
Expand Down

0 comments on commit 670facf

Please sign in to comment.