[packages/dmd] - disable dynamic linking with libphobos by default (causes symbol clashes between shared libphobos

qboosh qboosh at pld-linux.org
Sat Mar 22 14:38:49 CET 2014


commit fbcc5afc3891d3cb2628e746aa613a5a74531917
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Mar 22 14:42:10 2014 +0100

    - disable dynamic linking with libphobos by default (causes symbol clashes between shared libphobos and included modules)
    - added tools (rdmd and ddemangle for now)

 dmd-system-zlib.patch | 11 +++++++++++
 dmd.spec              | 45 ++++++++++++++++++++++++++++++++++++---------
 2 files changed, 47 insertions(+), 9 deletions(-)
---
diff --git a/dmd.spec b/dmd.spec
index e604b77..2e8f6da 100644
--- a/dmd.spec
+++ b/dmd.spec
@@ -1,13 +1,19 @@
+#
+# Conditional build:
+%bcond_with	dynamic	# dynamic linking with libphobos (doesn't work properly as of 2.065.0)
+#
 Summary:	Digital Mars D compiler
 Summary(pl.UTF-8):	Digital Mars D - kompilator języka D
 Name:		dmd
 Version:	2.065.0
 Release:	1
 # Digital Mars is proprietary license (not redistributable)
-License:	Boost v1.0 (D runtime, Phobos), GPL v1+ or Artistic (compiler frontend), Digital Mars (the rest)
+License:	Boost v1.0 (D runtime, Phobos, tools), GPL v1+ or Artistic (compiler frontend), Digital Mars (the rest)
 Group:		Development/Languages
 Source0:	http://downloads.dlang.org/releases/2014/%{name}.%{version}.zip
 # NoSource0-md5:	a17a699a7e4715658393819e9dc1814a
+Source1:	https://github.com/D-Programming-Language/tools/archive/v%{version}/d-tools-%{version}.tar.gz
+# Source1-md5:	d6b0b7a2a6b90a1374202c7582fc38e7
 Patch0:		%{name}-system-zlib.patch
 Patch1:		%{name}-shared.patch
 NoSource:	0
@@ -15,7 +21,11 @@ URL:		http://dlang.org/dmd-linux.html
 BuildRequires:	curl-devel
 BuildRequires:	libstdc++-devel
 BuildRequires:	zlib-devel
+%if %{with dynamic}
 Requires:	%{name}-libs = %{version}-%{release}
+%endif
+# used as linker
+Requires:	gcc
 ExclusiveArch:	%{ix86} %{x8664}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -55,9 +65,11 @@ Phobos and D-runtime static libraries for D language.
 Biblioteki statyczne Phobos oraz D-runtime dla języka D.
 
 %prep
-%setup -q -n dmd2
+%setup -q -n dmd2 -a1
+%{__mv} tools-%{version} tools
+
 %patch0 -p1
-%patch1 -p1
+%{?with_dynamic:%patch1 -p1}
 
 echo "%{version}" > src/dmd/VERSION
 
@@ -94,9 +106,16 @@ done
 	LIBCURL_STUB= \
 	PIC="-fPIC"
 
+%{__make} -C tools -f posix.mak \
+	OS=linux \
+	MODEL=%{model} \
+	CC="%{__cc}" \
+	CFLAGS="%{rpmcflags} -m%{model} -fPIC" \
+	DMD="$DMD -I$(pwd)/src/phobos -I$(pwd)/src/druntime -L-L$(pwd)/src/phobos/generated/linux/release/%{model}"
+
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_includedir}/d/dmd/phobos,%{_libdir},%{_sysconfdir},%{_docdir}/dmd}
+install -d $RPM_BUILD_ROOT{%{_includedir}/d/dmd/phobos/etc/c,%{_libdir},%{_sysconfdir},%{_docdir}/dmd}
 
 install -Dp src/dmd/dmd $RPM_BUILD_ROOT%{_bindir}/dmd
 cp -p src/druntime/lib/libdruntime-linux%{model}* $RPM_BUILD_ROOT%{_libdir}
@@ -104,7 +123,9 @@ cp -a src/phobos/generated/linux/release/%{model}/libphobos2.so* $RPM_BUILD_ROOT
 cp -p src/phobos/generated/linux/release/%{model}/libphobos2.a $RPM_BUILD_ROOT%{_libdir}
 cp -pr src/druntime/import $RPM_BUILD_ROOT%{_includedir}/d/dmd/druntime
 cp -pr src/phobos/{std,*.d} $RPM_BUILD_ROOT%{_includedir}/d/dmd/phobos
+cp -p src/phobos/etc/c/*.d $RPM_BUILD_ROOT%{_includedir}/d/dmd/phobos/etc/c
 cp -pr src/druntime/doc $RPM_BUILD_ROOT%{_docdir}/dmd/druntime
+install tools/generated/linux/%{model}/{ddemangle,rdmd} $RPM_BUILD_ROOT%{_bindir}
 install -Dp man/man1/dmd.1 $RPM_BUILD_ROOT%{_mandir}/man1/dmd.1
 install -Dp man/man5/dmd.conf.5 $RPM_BUILD_ROOT%{_mandir}/man5/dmd.conf.5
 
@@ -119,12 +140,21 @@ rm -rf $RPM_BUILD_ROOT
 %post	libs -p /sbin/ldconfig
 %postun	libs -p /sbin/ldconfig
 
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libphobos2.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libphobos2.so.0.65
+
 %files
 %defattr(644,root,root,755)
 %doc README.TXT license.txt dmd-*.txt druntime-*
+%attr(755,root,root) %{_bindir}/ddemangle
 %attr(755,root,root) %{_bindir}/dmd
+%attr(755,root,root) %{_bindir}/rdmd
+%if %{with dynamic}
 %attr(755,root,root) %{_libdir}/libphobos2.so
 %attr(755,root,root) %{_libdir}/libdruntime-linux%{model}.so
+%endif
 %{_libdir}/libdruntime-linux%{model}so.a
 %{_libdir}/libdruntime-linux%{model}so.o
 %{_sysconfdir}/dmd.conf
@@ -134,13 +164,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man5/dmd.conf.5*
 %{_docdir}/dmd
 
-%files libs
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libphobos2.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libphobos2.so.0.65
-
+%if %{with dynamic}
 %files static
 %defattr(644,root,root,755)
+%endif
 %{_libdir}/libdruntime-linux%{model}.a
 %{_libdir}/libdruntime-linux%{model}.o
 %{_libdir}/libphobos2.a
diff --git a/dmd-system-zlib.patch b/dmd-system-zlib.patch
index 273d69d..a0aca4f 100644
--- a/dmd-system-zlib.patch
+++ b/dmd-system-zlib.patch
@@ -29,3 +29,14 @@
  
  dll : $(ROOT)/libphobos2.so
  
+--- dmd2/tools/posix.mak.orig	2014-02-13 16:09:46.000000000 +0100
++++ dmd2/tools/posix.mak	2014-03-22 10:01:55.092212006 +0100
+@@ -102,7 +102,7 @@
+ #dreadful custom step because of libcurl dmd linking problem (Bugzilla 7044)
+ $(CURL_TOOLS): $(ROOT)/%: %.d
+ 	$(DMD) -c -of$(@).o $(<)
+-	($(DMD) -v -of$(@) $(@).o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo -lcurl  ) | xargs $(CC)
++	($(DMD) -v -of$(@) $(@).o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo -lcurl -lz) | xargs $(CC)
+ 
+ $(TOOLS) $(DOC_TOOLS): $(ROOT)/%: %.d
+ 	$(DMD) $(MODEL_FLAG) $(DFLAGS) -of$(@) $(<)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dmd.git/commitdiff/fbcc5afc3891d3cb2628e746aa613a5a74531917



More information about the pld-cvs-commit mailing list