aboutsummaryrefslogtreecommitdiffstats
path: root/lang/rust
diff options
context:
space:
mode:
authorjgh <jgh@FreeBSD.org>2012-02-03 02:17:31 +0800
committerjgh <jgh@FreeBSD.org>2012-02-03 02:17:31 +0800
commit1eb0e251fdf29ede2f03bed3629b68feb101aad5 (patch)
tree8cb20020b6cd6725f95987609e874cdef0a4bde5 /lang/rust
parent4269048b8cf0c8f7e2cb1d246a163941e0b88e1d (diff)
downloadfreebsd-ports-gnome-1eb0e251fdf29ede2f03bed3629b68feb101aad5.tar.gz
freebsd-ports-gnome-1eb0e251fdf29ede2f03bed3629b68feb101aad5.tar.zst
freebsd-ports-gnome-1eb0e251fdf29ede2f03bed3629b68feb101aad5.zip
- fix linker errors for systems that have installed llvm
- let clang build llvm - fix build on ${OSVERSION} < 800107 PR: ports/164467 Submitted by: maintainer, jyyou at cs.nctu.edu.tw Approved by: crees (mentor)
Diffstat (limited to 'lang/rust')
-rw-r--r--lang/rust/Makefile15
-rw-r--r--lang/rust/distinfo8
-rw-r--r--lang/rust/files/patch-configure42
-rw-r--r--lang/rust/files/patch-mk__rustllvm.mk11
-rw-r--r--lang/rust/files/patch-src_libcore_cmath.rs10
-rw-r--r--lang/rust/files/patch-src_libcore_f32.rs22
6 files changed, 90 insertions, 18 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index c2b6b5d2a8ac..9aadb929d29d 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -7,6 +7,7 @@
PORTNAME= rust
PORTVERSION= 0.1
+PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= http://dl.rust-lang.org/dist/:source \
http://people.cs.nctu.edu.tw/~jyyou/rust/:boot
@@ -20,7 +21,7 @@ COMMENT= A language with a focus on memory safety and concurrency
OPTIONS= CARGO "Build with package manager" off
RUST_SOURCE= ${DISTNAME}${EXTRACT_SUFX}
-RUST_BOOT= rust-${PORTVERSION}-boot.tar.bz2
+RUST_BOOT= rust-${PORTVERSION}-boot-${CC}.tar.bz2
RUST_TARGET= x86_64-unknown-freebsd
ONLY_FOR_ARCHS= amd64
@@ -43,10 +44,6 @@ CONFIGURE_ARGS+= --enable-clang
USE_GCC= 4.4+
.endif
-.if ${OSVERSION} < 800107
-IGNORE= needs tgammaf(3)
-.endif
-
.if !defined(WITHOUT_CARGO)
RUN_DEPENDS+= curl:${PORTSDIR}/ftp/curl \
git:${PORTSDIR}/devel/git \
@@ -66,10 +63,18 @@ post-extract:
post-patch:
${REINPLACE_CMD} \
+ -e '/probe_need CFG_CURL/d' \
+ ${WRKSRC}/configure
+ ${REINPLACE_CMD} \
-e '/src\/etc\/get-snapshot.py $$(CFG_HOST_TRIPLE)/d' \
${WRKSRC}/mk/stage0.mk
${REINPLACE_CMD} \
-e 's|\$$(PREFIX_ROOT)/share/man|${MANPREFIX}/man|g' \
${WRKSRC}/mk/install.mk
+.if ${OSVERSION} >= 900044
+ ${REINPLACE_CMD} \
+ -e 's|prog: str = "gcc"|prog: str = "clang"|' \
+ ${WRKSRC}/src/comp/back/link.rs
+.endif
.include <bsd.port.post.mk>
diff --git a/lang/rust/distinfo b/lang/rust/distinfo
index 5322898a4910..73db14e14694 100644
--- a/lang/rust/distinfo
+++ b/lang/rust/distinfo
@@ -1,4 +1,8 @@
SHA256 (rust-0.1.tar.gz) = a1a234592168443b3bd6dce03378ee410393b07f8075c6a56e339638fdda8263
SIZE (rust-0.1.tar.gz) = 10601377
-SHA256 (rust-0.1-boot.tar.bz2) = 682a8f4c735940e1f2e115adfbffde4838989e820a4f551576c0c9b4be1a0d2e
-SIZE (rust-0.1-boot.tar.bz2) = 9759370
+SHA256 (rust-0.1-boot-clang.tar.bz2) = cb920a23c04a1530ba0d74efd6464b1b42b55fdb7fbb22763ea9bd94675de6ee
+SIZE (rust-0.1-boot-clang.tar.bz2) = 7818448
+SHA256 (rust-0.1-boot-gcc44.tar.bz2) = 682a8f4c735940e1f2e115adfbffde4838989e820a4f551576c0c9b4be1a0d2e
+SIZE (rust-0.1-boot-gcc44.tar.bz2) = 9759370
+SHA256 (rust-0.1-boot-gcc46.tar.bz2) = 682a8f4c735940e1f2e115adfbffde4838989e820a4f551576c0c9b4be1a0d2e
+SIZE (rust-0.1-boot-gcc46.tar.bz2) = 9759370
diff --git a/lang/rust/files/patch-configure b/lang/rust/files/patch-configure
index f12475d8b42e..6dfa1b14c2cd 100644
--- a/lang/rust/files/patch-configure
+++ b/lang/rust/files/patch-configure
@@ -1,14 +1,6 @@
---- configure.orig 2012-01-22 04:29:36.401802685 +0800
-+++ configure 2012-01-22 11:40:28.231803897 +0800
-@@ -281,7 +281,6 @@
-
- probe_need CFG_PERL perl
- probe_need CFG_PYTHON python python2.6 python2 python3
--probe_need CFG_CURL curl
-
- probe CFG_GIT git
- probe CFG_CLANG clang++
-@@ -340,7 +339,8 @@
+--- ./configure.orig 2012-01-26 10:47:57.178803535 +0800
++++ ./configure 2012-01-26 10:48:24.324805426 +0800
+@@ -340,7 +340,8 @@
CFG_CLANG_VERSION=$("$CFG_CLANG" \
--version \
| grep version \
@@ -18,3 +10,31 @@
case $CFG_CLANG_VERSION in
(3.0svn | 3.0 | 3.1)
+@@ -534,14 +535,23 @@
+ # Disable unused LLVM features
+ LLVM_OPTS="$LLVM_DBG_OPTS --disable-docs --disable-jit --enable-bindings=none --disable-threads --disable-pthreads"
+
+- LLVM_CXX_32="g++ -m32"
+- LLVM_CC_32="gcc -m32"
++ if [ "$CFG_C_COMPILER" = "clang" ]
++ then
++ LLVM_CXX_32="clang++ -m32"
++ LLVM_CC_32="clang -m32"
++ LLVM_CXX_64="clang++"
++ LLVM_CC_64="clang"
++ else
++ LLVM_CXX_32="g++ -m32"
++ LLVM_CC_32="gcc -m32"
++ LLVM_CXX_64="g++"
++ LLVM_CC_64="gcc"
++ fi
++
+ LLVM_CFLAGS_32="-m32"
+ LLVM_CXXFLAGS_32="-m32"
+ LLVM_LDFLAGS_32="-m32"
+
+- LLVM_CXX_64="g++"
+- LLVM_CC_64="gcc"
+ LLVM_CFLAGS_64=""
+ LLVM_CXXFLAGS_64=""
+ LLVM_LDFLAGS_64=""
diff --git a/lang/rust/files/patch-mk__rustllvm.mk b/lang/rust/files/patch-mk__rustllvm.mk
new file mode 100644
index 000000000000..8a83256a55ad
--- /dev/null
+++ b/lang/rust/files/patch-mk__rustllvm.mk
@@ -0,0 +1,11 @@
+--- ./mk/rustllvm.mk.orig 2012-01-21 05:09:09.000000000 +0800
++++ ./mk/rustllvm.mk 2012-01-26 10:41:49.661804374 +0800
+@@ -37,7 +37,7 @@
+
+ rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
+ @$$(call E, compile: $$@)
+- $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(LLVM_CXXFLAGS_$(1)) $$(RUSTLLVM_INCS_$(1))) $$<
++ $$(Q)$$(call CFG_COMPILE_C_$(1), $$@, $$(subst -I, -iquote , $$(LLVM_CXXFLAGS_$(1))) $$(RUSTLLVM_INCS_$(1))) $$<
+ endef
+
+ # Instantiate template for all stages
diff --git a/lang/rust/files/patch-src_libcore_cmath.rs b/lang/rust/files/patch-src_libcore_cmath.rs
new file mode 100644
index 000000000000..1756e7679774
--- /dev/null
+++ b/lang/rust/files/patch-src_libcore_cmath.rs
@@ -0,0 +1,10 @@
+--- src/libcore/cmath.rs.orig 2012-02-02 09:08:04.690802969 +0800
++++ src/libcore/cmath.rs 2012-02-02 09:12:37.705978161 +0800
+@@ -161,7 +161,6 @@
+ #[link_name="sqrtf"] pure fn sqrt(n: c_float) -> c_float;
+ #[link_name="tanf"] pure fn tan(n: c_float) -> c_float;
+ #[link_name="tanhf"] pure fn tanh(n: c_float) -> c_float;
+- #[link_name="tgammaf"] pure fn tgamma(n: c_float) -> c_float;
+ #[link_name="truncf"] pure fn trunc(n: c_float) -> c_float;
+ }
+
diff --git a/lang/rust/files/patch-src_libcore_f32.rs b/lang/rust/files/patch-src_libcore_f32.rs
new file mode 100644
index 000000000000..8be7ef7cc9fa
--- /dev/null
+++ b/lang/rust/files/patch-src_libcore_f32.rs
@@ -0,0 +1,22 @@
+--- src/libcore/f32.rs.orig 2012-02-02 09:20:38.079803515 +0800
++++ src/libcore/f32.rs 2012-02-02 09:20:53.241930085 +0800
+@@ -9,6 +9,8 @@
+ import cmath::c_float::*;
+ import cmath::c_float_targ_consts::*;
+
++import cmath::c_double;
++
+ type t = f32;
+
+ // These are not defined inside consts:: for consistency with
+@@ -247,6 +249,10 @@
+ ret ln(n) / consts::ln_2;
+ }
+
++pure fn tgamma(n: f32) -> f32 {
++ ret c_double::tgamma(n as f64) as f32;
++}
++
+ //
+ // Local Variables:
+ // mode: rust