[packages/dmd] - build shared libs - added system-zlib to use system zlib in libphobos - fix linking with curl (avo
qboosh
qboosh at pld-linux.org
Sat Mar 22 02:35:12 CET 2014
commit bcce314de704085a81b3b6bb2da58144723917ff
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Mar 22 02:38:27 2014 +0100
- build shared libs
- added system-zlib to use system zlib in libphobos
- fix linking with curl (avoid using curlstub to get function symbol types set)
- added shared patch (default to shared libphobos when linking binaries)
dmd-shared.patch | 13 ++++++++++++
dmd-system-zlib.patch | 31 ++++++++++++++++++++++++++++
dmd.spec | 56 +++++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 96 insertions(+), 4 deletions(-)
---
diff --git a/dmd.spec b/dmd.spec
index fdd5255..e604b77 100644
--- a/dmd.spec
+++ b/dmd.spec
@@ -8,9 +8,14 @@ License: Boost v1.0 (D runtime, Phobos), GPL v1+ or Artistic (compiler frontend)
Group: Development/Languages
Source0: http://downloads.dlang.org/releases/2014/%{name}.%{version}.zip
# NoSource0-md5: a17a699a7e4715658393819e9dc1814a
+Patch0: %{name}-system-zlib.patch
+Patch1: %{name}-shared.patch
NoSource: 0
URL: http://dlang.org/dmd-linux.html
+BuildRequires: curl-devel
BuildRequires: libstdc++-devel
+BuildRequires: zlib-devel
+Requires: %{name}-libs = %{version}-%{release}
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -26,10 +31,35 @@ Digital Mars D compiler.
%description -l pl.UTF-8
Digital Mars D - kompilator języka D.
+%package libs
+Summary: Phobos runtime library for D language
+Summary(pl.UTF-8): Biblioteka uruchomieniowa Phobos dla języka D
+Group: Libraries
+
+%description libs
+Phobos runtime library for D language.
+
+%description libs -l pl.UTF-8
+Biblioteka uruchomieniowa Phobos dla języka D.
+
+%package static
+Summary: Phobos and D-runtime static libraries for D language
+Summary(pl.UTF-8): Biblioteki statyczne Phobos oraz D-runtime dla języka D
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description static
+Phobos and D-runtime static libraries for D language.
+
+%description static -l pl.UTF-8
+Biblioteki statyczne Phobos oraz D-runtime dla języka D.
+
%prep
%setup -q -n dmd2
+%patch0 -p1
+%patch1 -p1
-echo "%{version}" > src/VERSION
+echo "%{version}" > src/dmd/VERSION
cp -p src/dmd/backendlicense.txt dmd-backendlicense.txt
cp -p src/dmd/readme.txt dmd-readme.txt
@@ -45,13 +75,15 @@ cp -p src/druntime/README.md druntime-README.md
GFLAGS='%{rpmcxxflags} $(WARNINGS) -D__pascal= -fno-exceptions'
DMD=$(pwd)/src/dmd/dmd
-%{__make} -C src/druntime -f posix.mak \
+for t in target lib/libdruntime-linux%{model}.so ; do
+%{__make} -C src/druntime -f posix.mak $t \
OS=linux \
MODEL=%{model} \
CC="%{__cc}" \
CFLAGS="%{rpmcflags} -m%{model} -fPIC" \
DMD="$DMD" \
PIC="-fPIC"
+done
%{__make} -C src/phobos -f posix.mak \
OS=linux \
@@ -59,6 +91,7 @@ DMD=$(pwd)/src/dmd/dmd
CC="%{__cc}" \
CFLAGS="%{rpmcflags} -m%{model} -fPIC" \
DMD="$DMD" \
+ LIBCURL_STUB= \
PIC="-fPIC"
%install
@@ -67,6 +100,7 @@ install -d $RPM_BUILD_ROOT{%{_includedir}/d/dmd/phobos,%{_libdir},%{_sysconfdir}
install -Dp src/dmd/dmd $RPM_BUILD_ROOT%{_bindir}/dmd
cp -p src/druntime/lib/libdruntime-linux%{model}* $RPM_BUILD_ROOT%{_libdir}
+cp -a src/phobos/generated/linux/release/%{model}/libphobos2.so* $RPM_BUILD_ROOT%{_libdir}
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
@@ -82,17 +116,31 @@ EOF
%clean
rm -rf $RPM_BUILD_ROOT
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
+
%files
%defattr(644,root,root,755)
%doc README.TXT license.txt dmd-*.txt druntime-*
%attr(755,root,root) %{_bindir}/dmd
-%{_libdir}/libdruntime-linux%{model}.a
+%attr(755,root,root) %{_libdir}/libphobos2.so
+%attr(755,root,root) %{_libdir}/libdruntime-linux%{model}.so
%{_libdir}/libdruntime-linux%{model}so.a
%{_libdir}/libdruntime-linux%{model}so.o
-%{_libdir}/libphobos2.a
%{_sysconfdir}/dmd.conf
%dir %{_includedir}/d
%{_includedir}/d/dmd
%{_mandir}/man1/dmd.1*
%{_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
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libdruntime-linux%{model}.a
+%{_libdir}/libdruntime-linux%{model}.o
+%{_libdir}/libphobos2.a
diff --git a/dmd-shared.patch b/dmd-shared.patch
new file mode 100644
index 0000000..66ab61b
--- /dev/null
+++ b/dmd-shared.patch
@@ -0,0 +1,13 @@
+--- dmd2/src/dmd/mars.c.orig 2014-02-24 05:23:02.000000000 +0100
++++ dmd2/src/dmd/mars.c 2014-03-21 22:34:04.073943985 +0100
+@@ -568,9 +568,7 @@
+ #if TARGET_WINDOS
+ global.params.is64bit = false;
+ global.params.defaultlibname = "phobos";
+-#elif TARGET_LINUX
+- global.params.defaultlibname = "libphobos2.a";
+-#elif TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
++#elif TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_LINUX
+ global.params.defaultlibname = "phobos2";
+ #else
+ #error "fix this"
diff --git a/dmd-system-zlib.patch b/dmd-system-zlib.patch
new file mode 100644
index 0000000..273d69d
--- /dev/null
+++ b/dmd-system-zlib.patch
@@ -0,0 +1,31 @@
+--- dmd2/src/phobos/posix.mak.orig 2014-02-24 05:23:10.000000000 +0100
++++ dmd2/src/phobos/posix.mak 2014-03-21 19:46:59.187698023 +0100
+@@ -147,7 +147,7 @@
+ PATHSEP:=$(shell echo "\\")
+ endif
+
+-LINKDL:=$(if $(findstring $(OS),linux),-L-ldl,)
++LINKDL:=$(if $(findstring $(OS),linux),-L-ldl -L-lz,)
+
+ # Set VERSION, where the file is that contains the version string
+ VERSION=../dmd/VERSION
+@@ -236,8 +236,6 @@
+ # Aggregate all C files over all OSs (this is for the zip file)
+ ALL_C_FILES = $(C_FILES) $(C_EXTRAS)
+
+-OBJS = $(addsuffix $(DOTOBJ),$(addprefix $(ROOT)/,$(C_MODULES)))
+-
+ MAKEFILE = $(firstword $(MAKEFILE_LIST))
+
+ SUBMAKE = $(MAKE) --no-print-directory OS=$(OS) -f $(MAKEFILE)
+@@ -274,8 +272,8 @@
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@) || [ -d $(dir $@) ]
+ $(CC) -c $(CFLAGS) $< -o$@
+
+-$(LIB) : $(OBJS) $(ALL_D_FILES) druntime_libs
+- $(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(OBJS)
++$(LIB) : $(ALL_D_FILES) druntime_libs
++ $(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES)
+
+ dll : $(ROOT)/libphobos2.so
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/dmd.git/commitdiff/bcce314de704085a81b3b6bb2da58144723917ff
More information about the pld-cvs-commit
mailing list