forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmp.mk
85 lines (67 loc) · 2.87 KB
/
gmp.mk
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
## GMP ##
ifeq ($(SANITIZE),1)
GMP_CONFIGURE_OPTS += --disable-assembly
endif
ifeq ($(BUILD_OS),WINNT)
GMP_CONFIGURE_OPTS += --srcdir="$(subst \,/,$(call mingw_to_dos,$(SRCCACHE)/gmp-$(GMP_VER)))"
endif
ifneq ($(USE_BINARYBUILDER_GMP),1)
$(SRCCACHE)/gmp-$(GMP_VER).tar.bz2: | $(SRCCACHE)
$(JLDOWNLOAD) $@ https://gmplib.org/download/gmp/$(notdir $@)
$(SRCCACHE)/gmp-$(GMP_VER)/source-extracted: $(SRCCACHE)/gmp-$(GMP_VER).tar.bz2
$(JLCHECKSUM) $<
cd $(dir $<) && $(TAR) -jxf $<
touch -c $(SRCCACHE)/gmp-$(GMP_VER)/configure # old target
echo 1 > $@
$(SRCCACHE)/gmp-$(GMP_VER)/build-patched: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted
cp $(SRCDIR)/patches/config.sub $(SRCCACHE)/gmp-$(GMP_VER)/configfsf.sub
cd $(dir $@) && patch < $(SRCDIR)/patches/gmp-exception.patch
cd $(dir $@) && patch -p1 < $(SRCDIR)/patches/gmp_alloc_overflow_func.patch
echo 1 > $@
$(SRCCACHE)/gmp-$(GMP_VER)/gmp-config-ldflags.patch-applied: | $(SRCCACHE)/gmp-$(GMP_VER)/build-patched
cd $(dir $@) && patch -p1 < $(SRCDIR)/patches/gmp-config-ldflags.patch
echo 1 > $@
$(BUILDDIR)/gmp-$(GMP_VER)/build-configured: $(SRCCACHE)/gmp-$(GMP_VER)/gmp-config-ldflags.patch-applied
$(BUILDDIR)/gmp-$(GMP_VER)/build-configured: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted
mkdir -p $(dir $@)
cd $(dir $@) && \
$(dir $<)/configure $(CONFIGURE_COMMON) F77= --enable-shared --disable-static $(GMP_CONFIGURE_OPTS)
echo 1 > $@
$(BUILDDIR)/gmp-$(GMP_VER)/build-compiled: $(BUILDDIR)/gmp-$(GMP_VER)/build-configured
$(MAKE) -C $(dir $<) $(LIBTOOL_CCLD)
echo 1 > $@
$(BUILDDIR)/gmp-$(GMP_VER)/build-checked: $(BUILDDIR)/gmp-$(GMP_VER)/build-compiled
ifeq ($(OS),$(BUILD_OS))
$(MAKE) -C $(dir $@) $(LIBTOOL_CCLD) check
endif
echo 1 > $@
define GMP_INSTALL
mkdir -p $2/$(build_shlibdir) $2/$(build_includedir)
ifeq ($(BUILD_OS),WINNT)
-mv $1/.libs/gmp.dll $1/.libs/libgmp.dll
endif
$(INSTALL_M) $1/.libs/libgmp.*$(SHLIB_EXT)* $2/$(build_shlibdir)
$(INSTALL_F) $1/gmp.h $2/$(build_includedir)
endef
$(eval $(call staged-install, \
gmp,gmp-$(GMP_VER), \
GMP_INSTALL,,, \
$$(INSTALL_NAME_CMD)libgmp.$$(SHLIB_EXT) $$(build_shlibdir)/libgmp.$$(SHLIB_EXT)))
clean-gmp:
-rm $(BUILDDIR)/gmp-$(GMP_VER)/build-configured $(BUILDDIR)/gmp-$(GMP_VER)/build-compiled
-$(MAKE) -C $(BUILDDIR)/gmp-$(GMP_VER) clean
distclean-gmp:
-rm -rf $(SRCCACHE)/gmp-$(GMP_VER).tar.bz2 \
$(SRCCACHE)/gmp-$(GMP_VER) \
$(BUILDDIR)/gmp-$(GMP_VER)
get-gmp: $(SRCCACHE)/gmp-$(GMP_VER).tar.bz2
extract-gmp: $(SRCCACHE)/gmp-$(GMP_VER)/source-extracted
configure-gmp: $(BUILDDIR)/gmp-$(GMP_VER)/build-configured
compile-gmp: $(BUILDDIR)/gmp-$(GMP_VER)/build-compiled
fastcheck-gmp: check-gmp
check-gmp: $(BUILDDIR)/gmp-$(GMP_VER)/build-checked
else # USE_BINARYBUILDER_GMP
GMP_BB_URL_BASE := https://github.com/JuliaBinaryWrappers/GMP_jll.jl/releases/download/GMP-v$(GMP_VER)+$(GMP_BB_REL)
GMP_BB_NAME := GMP.v$(GMP_VER)
$(eval $(call bb-install,gmp,GMP,false))
endif