-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gmp: enable building static libraries on MSVC
- Loading branch information
Showing
6 changed files
with
192 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
sources: | ||
"6.2.1": | ||
url: "https://gmplib.org/download/gmp/gmp-6.2.1.tar.bz2" | ||
sha256: "eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c" | ||
"6.2.0": | ||
url: "https://gmplib.org/download/gmp/gmp-6.2.0.tar.bz2" | ||
sha256: "f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea" | ||
"6.1.2": | ||
url: "https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2" | ||
sha256: "5275bb04f4863a13516b2f39392ac5e272f5e1bb8057b18aec1c9b79d73d8fb2" | ||
patches: | ||
"6.2.1": | ||
- patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" | ||
base_path: "" | ||
- patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" | ||
base_path: "source_subfolder" | ||
"6.2.0": | ||
url: "https://gmplib.org/download/gmp/gmp-6.2.0.tar.bz2" | ||
sha256: "f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea" | ||
- patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" | ||
base_path: "" | ||
- patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" | ||
base_path: "source_subfolder" | ||
"6.1.2": | ||
- patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" | ||
base_path: "" | ||
- patch_file: "patches/6.1.x-0001-fix-MSVC-next-prime-error.patch" | ||
base_path: "source_subfolder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
recipes/gmp/all/patches/0001-msvc-dumpbin-yasm-wrapper.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- /dev/null | ||
+++ dumpbin_nm.py | ||
@@ -0,0 +1,27 @@ | ||
+#!/usr/bin/env python3 | ||
+ | ||
+import re | ||
+import subprocess | ||
+import sys | ||
+#print(open(sys.argv[1], "rb").read()) | ||
+#output = subprocess.check_output(["dumpbin", "-nologo", "-symbols"] + sys.argv[1:], stderr=subprocess.STDOUT, text=True, shell=True) | ||
+output = subprocess.check_output("dumpbin -nologo -symbols {}".format(sys.argv[1]), stderr=subprocess.STDOUT, text=True, shell=True) | ||
+for line in output.splitlines(): | ||
+ d = re.split("[ |]+", line.strip()) | ||
+ if len(d) == 6: | ||
+ try: | ||
+ int(d[0]) | ||
+ except ValueError: | ||
+ continue | ||
+ | ||
+ section = d[-1] | ||
+ if section == ".file": | ||
+ continue | ||
+ elif section == ".data": | ||
+ stype = "d" | ||
+ elif section == ".text": | ||
+ stype = "t" | ||
+ else: | ||
+ stype = "D" | ||
+ offset = d[1] | ||
+ print("{} {} {}".format(offset, stype, section)) | ||
--- /dev/null | ||
+++ yasm_wrapper.sh | ||
@@ -0,0 +1,38 @@ | ||
+#!/bin/sh | ||
+asmopts=() | ||
+setoutput= | ||
+calculated_output= | ||
+source= | ||
+while test $# -gt 0; do | ||
+ case "$1" in | ||
+ *.s | *.S | *.asm | *.ASM) | ||
+ calculated_output=$(echo -n "$1" | sed -e 's/\.asm$/.obj/g' | sed -e 's/\.ASM/.obj/g' | sed -e 's/\.s/.obj/g' | sed -e 's/\.S/.obj/g') | ||
+ source="$1" | ||
+ ;; | ||
+ -o) | ||
+ asmopts+=("$1") | ||
+ shift | ||
+ setoutput="$1" | ||
+ asmopts+=("$1") | ||
+ ;; | ||
+ -O*) | ||
+ ;; | ||
+ -MT | -MD | -MTd | -MDd) | ||
+ ;; | ||
+ -D*) | ||
+ asmopts+=("$1") | ||
+ ;; | ||
+ *) | ||
+ asmopts+=("$1") | ||
+ ;; | ||
+ esac | ||
+ shift | ||
+done | ||
+ | ||
+if [ "$setoutput" == "" ] && [ "$calculated_output" != "" ]; then | ||
+ asmopts+=("-o") | ||
+ asmopts+=("$calculated_output") | ||
+fi | ||
+ | ||
+echo "Executing yasm ${asmopts[@]} $source" | ||
+exec yasm ${asmopts[@]} "$source" |
14 changes: 14 additions & 0 deletions
14
recipes/gmp/all/patches/6.1.x-0001-fix-MSVC-next-prime-error.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- nextprime.c | ||
+++ nextprime.c | ||
@@ -54,9 +54,9 @@ | ||
|
||
#include "gmp.h" | ||
#include "gmp-impl.h" | ||
+#ifndef _MSC_VER | ||
#include <string.h> /* for memset */ | ||
+#endif | ||
- | ||
- | ||
unsigned long int | ||
gmp_nextprime (gmp_primesieve_t *ps) | ||
{ |
14 changes: 14 additions & 0 deletions
14
recipes/gmp/all/patches/6.2.x-0001-fix-MSVC-next-prime-error.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- nextprime.c | ||
+++ nextprime.c | ||
@@ -53,9 +53,9 @@ | ||
*/ | ||
|
||
#include "gmp-impl.h" | ||
+#ifndef _MSC_VER | ||
#include <string.h> /* for memset */ | ||
+#endif | ||
- | ||
- | ||
unsigned long int | ||
gmp_nextprime (gmp_primesieve_t *ps) | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
versions: | ||
"6.1.2": | ||
folder: all | ||
"6.2.0": | ||
folder: all | ||
"6.2.1": | ||
folder: all | ||
"6.1.2": | ||
folder: all |