Browse Source
This is done by pinning gmp to a fork of `esy-packages/esy-gmp` that uses the `--enable-fat` argument, suggested by @ulrikstrid. Here's the description of the open PR for `esy-packages/esy-gmp` https://github.com/esy-packages/esy-gmp/pull/3: > GMP uses [Intel ADX](https://en.wikipedia.org/wiki/Intel_ADX) to do math stuff when capable for performance reasons. The pick whether to use ADX or not is being chosen on compile time, unless you specify `--enable-fat` which creates a "fat" binary that decides on runtime whether to use these custom instructions: > > > Using --enable-fat selects a “fat binary” build on x86, where optimized low level subroutines are chosen at runtime according to the CPU detected. This means more code, but gives good performance on all x86 chips. (This option might become available for more architectures in the future.) > > Without this flag, users can get "illegal hardware instruction" errors when running their binaries on a machine without Intel ADX. > > So, in other words, this PR enables building gmp into a binary on CI which _has Intel ADX_, and then using it on a machine that does not have it (like AMD or older Intels) > > To me, it sounds like a sane default.remotes/origin/add-simple-redirecting-site
![gal@spitfire.co.il](/assets/img/avatar_default.png)
![GitHub](/assets/img/avatar_default.png)
39 changed files with 1139 additions and 1401 deletions
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
#include <gmp.h> |
||||
#ifndef __GMP_H__ |
||||
#error "No GMP header" |
||||
#endif |
||||
|
||||
void test(void) { |
||||
__gmp_init(); |
||||
} |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
opam-version: "2.0" |
||||
maintainer: "nbraud" |
||||
homepage: "http://gmplib.org/" |
||||
bug-reports: "https://github.com/ocaml/opam-repository/issues" |
||||
license: "GPL-1.0-or-later" |
||||
build: [ |
||||
["sh" "-exc" "cc -c $CFLAGS -I/usr/local/include test.c"] {os != "macos"} |
||||
[ |
||||
"sh" |
||||
"-exc" |
||||
"cc -c $CFLAGS -I/opt/local/include -I/usr/local/include test.c" |
||||
] {os = "macos"} |
||||
] |
||||
depexts: [ |
||||
["libgmp-dev"] {os-family = "debian"} |
||||
["gmp"] {os = "macos" & os-distribution = "homebrew"} |
||||
["gmp" "gmp-devel"] {os-distribution = "centos"} |
||||
["gmp" "gmp-devel"] {os-distribution = "fedora"} |
||||
["gmp"] {os = "openbsd"} |
||||
["gmp"] {os = "freebsd"} |
||||
["gmp-dev"] {os-distribution = "alpine"} |
||||
["gmp-devel"] {os-family = "suse"} |
||||
] |
||||
synopsis: "Virtual package relying on a GMP lib system installation" |
||||
description: |
||||
"This package can only install if the GMP lib is installed on the system." |
||||
authors: "nbraud" |
||||
extra-files: ["test.c" "md5=ec8cc21ab709bdd57103de36e7b0b53f"] |
||||
flags: conf |
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
opam-version: "2.0" |
||||
authors: "Pierre Chambart" |
||||
maintainer: "pierre.chambart@ocamlpro.com" |
||||
homepage: "https://github.com/OCamlPro/ocplib-endian" |
||||
build: [ |
||||
["ocaml" "setup.ml" "-configure" "--disable-debug" "--prefix" prefix] |
||||
["ocaml" "setup.ml" "-build"] |
||||
] |
||||
install: [ |
||||
["ocaml" "setup.ml" "-install"] |
||||
] |
||||
remove: ["ocamlfind" "remove" "ocplib-endian"] |
||||
depends: [ |
||||
"ocaml" |
||||
"base-bytes" |
||||
"ocamlfind" |
||||
"cppo" {>= "1.1.0"} |
||||
"ocamlbuild" {build} |
||||
] |
||||
dev-repo: "git+https://github.com/OCamlPro/ocplib-endian.git" |
||||
bug-reports: "https://github.com/OCamlPro/ocplib-endian/issues" |
||||
synopsis: |
||||
"Optimised functions to read and write int16/32/64 from strings and bigarrays, based on new primitives added in version 4.01." |
||||
description: """ |
||||
The library implements three modules: |
||||
* [EndianString](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianString.cppo.mli) works directly on strings, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts; |
||||
* [EndianBytes](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBytes.cppo.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts; |
||||
* [EndianBigstring](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBigstring.cppo.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;""" |
||||
flags: light-uninstall |
||||
url { |
||||
src: "https://github.com/OCamlPro/ocplib-endian/archive/1.0.tar.gz" |
||||
checksum: "md5=74b45ba33e189283170a748c2a3ed477" |
||||
} |
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
{ |
||||
"build": [ |
||||
[ |
||||
"#{os == 'windows' ? 'x86_64-w64-mingw32-gcc' : 'cc'}", |
||||
"-c", |
||||
"${CFLAGS:--g}", |
||||
"$CPPFLAGS", |
||||
"$LDFLAGS", |
||||
"test.c" |
||||
] |
||||
], |
||||
"dependencies": { |
||||
"esy-gmp": "esy-packages/esy-gmp#a945c56e10e02bde2d2c76f5debd13bcc461abbc" |
||||
} |
||||
} |
@ -1,14 +0,0 @@
@@ -1,14 +0,0 @@
|
||||
{ |
||||
"build": [ |
||||
[ |
||||
"ocaml", |
||||
"bootstrap.ml" |
||||
], |
||||
[ |
||||
"./boot.exe", |
||||
"--release", |
||||
"-j", |
||||
"4" |
||||
] |
||||
] |
||||
} |
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
--- ./setup.ml
|
||||
+++ ./setup.ml
|
||||
@@ -6331,9 +6331,7 @@
|
||||
[
|
||||
"-classic-display";
|
||||
"-no-log";
|
||||
- "-no-links";
|
||||
- "-install-lib-dir";
|
||||
- (Filename.concat (standard_library ()) "ocamlbuild")
|
||||
+ "-no-links"
|
||||
]
|
||||
else
|
||||
[];
|
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
--- ./myocamlbuild.ml
|
||||
+++ ./myocamlbuild.ml
|
||||
@@ -573,6 +573,24 @@
|
||||
Add a dependency after dropping support for 4.01 and earlier. *)
|
||||
let dispatch_cppo = function
|
||||
| After_rules -> begin
|
||||
+ let is_directory s =
|
||||
+ let slen = String.length s in
|
||||
+ let s =
|
||||
+ if Sys.os_type <> "Win32" || slen < 2 then
|
||||
+ s
|
||||
+ else
|
||||
+ match s.[slen-1] with
|
||||
+ | '\\' | '/' ->
|
||||
+ if slen <> 3 || s.[1] <> ':' then
|
||||
+ String.sub s 0 (slen -1)
|
||||
+ else
|
||||
+ (match s.[0] with
|
||||
+ | 'A' .. 'Z' | 'a' .. 'z' -> s
|
||||
+ | _ -> String.sub s 0 (slen -1))
|
||||
+ | _ -> s
|
||||
+ in
|
||||
+ Pathname.is_directory s
|
||||
+ in
|
||||
let cppo_rules ext =
|
||||
let dep = "%(name).cppo"-.-ext
|
||||
and prod1 = "%(name: <*> and not <*.cppo>)"-.-ext
|
||||
@@ -591,11 +609,11 @@
|
||||
pflag ["cppo"] "cppo_D" (fun s -> S [A "-D"; A s]) ;
|
||||
pflag ["cppo"] "cppo_U" (fun s -> S [A "-U"; A s]) ;
|
||||
pflag ["cppo"] "cppo_I" (fun s ->
|
||||
- if Pathname.is_directory s then S [A "-I"; P s]
|
||||
+ if is_directory s then S [A "-I"; P s]
|
||||
else S [A "-I"; P (Pathname.dirname s)]
|
||||
) ;
|
||||
pdep ["cppo"] "cppo_I" (fun s ->
|
||||
- if Pathname.is_directory s then [] else [s]) ;
|
||||
+ if is_directory s then [] else [s]) ;
|
||||
flag ["cppo"; "cppo_q"] (A "-q") ;
|
||||
flag ["cppo"; "cppo_s"] (A "-s") ;
|
||||
flag ["cppo"; "cppo_n"] (A "-n") ;
|
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
{ |
||||
"build": [ |
||||
[ |
||||
"bash", |
||||
"-c", |
||||
"#{os == 'windows' ? 'patch -p1 < ocplib-endian-0.8.patch' : 'true'}" |
||||
], |
||||
[ |
||||
"bash", |
||||
"-c", |
||||
"#{os == 'windows' ? 'patch -p1 < esy-fix.patch' : 'true'}" |
||||
], |
||||
[ |
||||
"ocaml", |
||||
"setup.ml", |
||||
"-configure", |
||||
"--disable-debug", |
||||
"--prefix", |
||||
"#{self.install}" |
||||
], |
||||
[ |
||||
"ocaml", |
||||
"setup.ml", |
||||
"-build" |
||||
] |
||||
], |
||||
"install": [ |
||||
[ |
||||
"ocaml", |
||||
"setup.ml", |
||||
"-install" |
||||
] |
||||
] |
||||
} |
Loading…
Reference in new issue