[packages/dmd] - updated to 2.109.1 (now whole under Boost license, so distributable)
qboosh
qboosh at pld-linux.org
Wed Dec 11 22:05:14 CET 2024
commit 8e51cc36efb7af1ae3994fc639d451daf092753e
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Wed Dec 11 21:59:46 2024 +0100
- updated to 2.109.1 (now whole under Boost license, so distributable)
dmd-make.patch | 19 ++++++++
dmd-opt.patch | 10 ----
dmd-shared.patch | 29 ++++++------
dmd-system-zlib.patch | 124 +++++++++++++++++++++++++++++++++++++-------------
dmd.spec | 91 ++++++++++++++++++++----------------
5 files changed, 179 insertions(+), 94 deletions(-)
---
diff --git a/dmd.spec b/dmd.spec
index bb4e849..bcf2bdd 100644
--- a/dmd.spec
+++ b/dmd.spec
@@ -1,27 +1,25 @@
#
# Conditional build:
%bcond_with bootstrap # bootstrap using upstream binaries
-%bcond_with dynamic # dynamic linking with libphobos (doesn't work properly as of 2.065.0)
+%bcond_without dynamic # dynamic linking with libphobos (static doesn't work properly as of 2.109.1)
#
Summary: Digital Mars D compiler
Summary(pl.UTF-8): Digital Mars D - kompilator języka D
Name: dmd
-Version: 2.072.0
+Version: 2.109.1
Release: 1
-# Digital Mars is proprietary license (not redistributable)
-License: Boost v1.0 (D runtime, Phobos, tools), GPL v1+ or Artistic (frontend), Digital Mars (backend)
+License: Boost v1.0
Group: Development/Languages
Source0: http://downloads.dlang.org/releases/2.x/%{version}/%{name}.%{version}.linux.tar.xz
-# NoSource0-md5: 5928fdc2065fec9440f5d255146384ad
+# Source0-md5: 4ac0c77e283fb5b14da94e187532ba12
Source1: https://github.com/dlang/tools/archive/v%{version}/d-tools-%{version}.tar.gz
-# Source1-md5: 3244aab8bb1583c3c970d8a702dd5280
+# Source1-md5: c32c0dc33c7a3b16e631cc9dd6b08f34
Patch0: %{name}-system-zlib.patch
-Patch1: %{name}-opt.patch
Patch2: %{name}-shared.patch
-NoSource: 0
-URL: http://dlang.org/dmd-linux.html
+Patch3: %{name}-make.patch
+URL: https://dlang.org/dmd-linux.html
BuildRequires: curl-devel
-%{!?with_bootstrap:BuildRequires: dmd >= 2.068.2}
+%{!?with_bootstrap:BuildRequires: dmd >= 2.095.0}
BuildRequires: libstdc++-devel
BuildRequires: zlib-devel
%if %{with dynamic}
@@ -29,9 +27,14 @@ Requires: %{name}-libs = %{version}-%{release}
%endif
# used as linker
Requires: gcc
+%if %{without dynamic}
+Requires: zlib-devel
+%endif
ExclusiveArch: %{ix86} %{x8664}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define _debugsource_packages %{nil}
+
%ifarch %{ix86}
%define model 32
%else
@@ -72,45 +75,59 @@ Biblioteki statyczne Phobos oraz D-runtime dla języka D.
%{__mv} tools-%{version} tools
%patch0 -p1
-%patch1 -p1
%{?with_dynamic:%patch2 -p1}
+%patch3 -p1
+# for DMD
+echo "%{version}" > VERSION
+# for Phobos
echo "%{version}" > src/dmd/VERSION
-cp -p src/dmd/backendlicense.txt dmd-backendlicense.txt
-cp -p src/dmd/readme.txt dmd-readme.txt
-cp -p src/druntime/LICENSE druntime-LICENSE
+cp -p src/dmd/README.md dmd-README.md
cp -p src/druntime/README.md druntime-README.md
+# TODO: patch
+sed -i -e 's,/compiler/src/,/dmd/,' src/druntime/Makefile
+sed -i -e 's,/compiler/src/,/,' src/phobos/Makefile
+
%build
-%{__make} -C src/dmd -f posix.mak \
- OS=LINUX \
- TARGET_CPU=X86 \
- MODEL=%{model} \
- HOST_CC="%{__cxx}" \
- %{?with_bootstrap:HOST_DMD=$(pwd)/linux/bin%{model}/dmd} \
- CXXOPTFLAGS="%{rpmcxxflags}"
+%if %{with bootstrap}
+HOST_DMD=$(pwd)/linux/bin%{model}/dmd
+HOST_RDMD=$(pwd)/linux/bin%{model}/rdmd
+%else
+HOST_DMD=dmd
+HOST_RDMD=rdmd
+%endif
+
+cd src/dmd
+$HOST_RDMD build.d -v \
+ CXX="%{__cxx}" \
+ CXXFLAGS="%{rpmcxxflags}" \
+ ENABLE_RELEASE=1 \
+ HOST_DMD="$HOST_DMD" \
+ MODEL=%{model}
+cd ../..
-DMD=$(pwd)/src/dmd/dmd
+DMD=$(pwd)/generated/linux/release/%{model}/dmd
-%{__make} -C src/druntime -f posix.mak \
+%{__make} -C src/druntime \
OS=linux \
MODEL=%{model} \
+ DMD="$DMD" \
CC="%{__cc}" \
CFLAGS="%{rpmcflags} -m%{model} -fPIC -DHAVE_UNISTD_H" \
- DMD="$DMD" \
PIC="-fPIC"
-%{__make} -C src/phobos -f posix.mak \
+%{__make} -C src/phobos \
OS=linux \
MODEL=%{model} \
+ DMD="$DMD" \
+ DRUNTIME_PATH="$(pwd)/src/druntime" \
CC="%{__cc}" \
CFLAGS="%{rpmcflags} -m%{model} -fPIC -DHAVE_UNISTD_H" \
- DMD="$DMD" \
- LIBCURL_STUB= \
- PIC="-fPIC"
+ PIC=1
-%{__make} -C tools -f posix.mak \
+%{__make} -C tools \
OS=linux \
MODEL=%{model} \
CC="%{__cc}" \
@@ -120,9 +137,9 @@ DMD=$(pwd)/src/dmd/dmd
rm -rf $RPM_BUILD_ROOT
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/generated/linux/release/%{model}/libdruntime* $RPM_BUILD_ROOT%{_libdir}
+install -Dp generated/linux/release/%{model}/dmd $RPM_BUILD_ROOT%{_bindir}/dmd
cp -a src/phobos/generated/linux/release/%{model}/libphobos2.so* $RPM_BUILD_ROOT%{_libdir}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libphobos2.so*.o
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
@@ -131,9 +148,6 @@ 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
-# some intermediate(?) object disliked a lot by ldconfig
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libdruntime.so.a
-
cat >$RPM_BUILD_ROOT%{_sysconfdir}/dmd.conf <<EOF
[Environment]
DFLAGS=-I/usr/include/d/dmd/phobos -I/usr/include/d/dmd/druntime -L-L%{_libdir} -L--no-warn-search-mismatch -L--export-dynamic
@@ -147,18 +161,16 @@ rm -rf $RPM_BUILD_ROOT
%files libs
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libphobos2.so.0.72.0
-%attr(755,root,root) %ghost %{_libdir}/libphobos2.so.0.72
+%attr(755,root,root) %{_libdir}/libphobos2.so.0.109.1
+%attr(755,root,root) %ghost %{_libdir}/libphobos2.so.0.109
%files
%defattr(644,root,root,755)
-%doc README.TXT license.txt dmd-*.txt druntime-*
+%doc README.TXT license.txt dmd-*.md druntime-*.md
%attr(755,root,root) %{_bindir}/ddemangle
%attr(755,root,root) %{_bindir}/dmd
%attr(755,root,root) %{_bindir}/rdmd
%attr(755,root,root) %{_libdir}/libphobos2.so
-%{_libdir}/libdruntime.so.o
-%{_libdir}/libphobos2.so.0.72.o
%{_sysconfdir}/dmd.conf
%dir %{_includedir}/d
%{_includedir}/d/dmd
@@ -170,5 +182,4 @@ rm -rf $RPM_BUILD_ROOT
%files static
%defattr(644,root,root,755)
%endif
-%{_libdir}/libdruntime.a
%{_libdir}/libphobos2.a
diff --git a/dmd-make.patch b/dmd-make.patch
new file mode 100644
index 0000000..145bdc5
--- /dev/null
+++ b/dmd-make.patch
@@ -0,0 +1,19 @@
+--- dmd2/tools/Makefile.orig 2024-06-03 00:59:36.000000000 +0200
++++ dmd2/tools/Makefile 2024-12-02 20:13:19.997432332 +0100
+@@ -1,4 +1,4 @@
+-DMD_DIR = ../dmd
++DMD_DIR = ..
+ BUILD = release
+ DMD = $(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd
+ INSTALL_DIR = ../install
+@@ -9,9 +9,7 @@ DUB=dub
+ WITH_DOC = no
+ DOC = ../dlang.org
+
+-# Load operating system $(OS) (e.g. linux, osx, ...) and $(MODEL) (e.g. 32, 64) detection Makefile from dmd
+-$(shell [ ! -d $(DMD_DIR) ] && git clone --depth=1 https://github.com/dlang/dmd $(DMD_DIR))
+-include $(DMD_DIR)/compiler/src/osmodel.mak
++include $(DMD_DIR)/src/dmd/osmodel.mak
+
+ ifeq (windows,$(OS))
+ DOTEXE:=.exe
diff --git a/dmd-opt.patch b/dmd-opt.patch
deleted file mode 100644
index 13fcb30..0000000
--- a/dmd-opt.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- dmd2/src/dmd/posix.mak.orig 2016-06-16 16:00:10.672370313 +0200
-+++ dmd2/src/dmd/posix.mak 2016-06-16 16:37:01.565610862 +0200
-@@ -136,6 +136,7 @@
-
- # Default compiler flags for all source files
- CXXFLAGS := $(WARNINGS) \
-+ $(CXXOPTFLAGS) \
- -fno-exceptions -fno-rtti \
- -D__pascal= -DMARS=1 -DTARGET_$(OS_UPCASE)=1 -DDM_TARGET_CPU_$(TARGET_CPU)=1 \
- $(MODEL_FLAG)
diff --git a/dmd-shared.patch b/dmd-shared.patch
index 66ab61b..62dcbb6 100644
--- a/dmd-shared.patch
+++ b/dmd-shared.patch
@@ -1,13 +1,16 @@
---- 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"
+--- dmd2/src/dmd/dmd/mars.d.orig 2024-06-30 18:32:38.000000000 +0200
++++ dmd2/src/dmd/dmd/mars.d 2024-12-02 19:55:00.354473035 +0100
+@@ -357,11 +357,11 @@ void setDefaultLibrary(ref Param params,
+ else
+ driverParams.defaultlibname = "phobos";
+ }
+- else if (target.os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
++ else if (target.os & (Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+ {
+ driverParams.defaultlibname = "libphobos2.a";
+ }
+- else if (target.os == Target.OS.OSX)
++ else if (target.os & (Target.OS.linux | Target.OS.OSX))
+ {
+ driverParams.defaultlibname = "phobos2";
+ }
diff --git a/dmd-system-zlib.patch b/dmd-system-zlib.patch
index a0a6e69..e8f9522 100644
--- a/dmd-system-zlib.patch
+++ b/dmd-system-zlib.patch
@@ -1,31 +1,93 @@
---- dmd2/src/phobos/posix.mak.orig 2015-04-25 05:20:30.000000000 +0200
-+++ dmd2/src/phobos/posix.mak 2015-07-22 15:28:25.126243307 +0200
-@@ -160,7 +160,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
-@@ -262,7 +262,7 @@
- # 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)))
-+OBJS =
-
- MAKEFILE = $(firstword $(MAKEFILE_LIST))
-
---- dmd2/tools/posix.mak.orig 2015-07-21 22:13:45.308848546 +0200
-+++ dmd2/tools/posix.mak 2015-07-22 15:29:39.346240185 +0200
-@@ -103,7 +103,7 @@
- $(DMD) $(MODEL_FLAG) $(DFLAGS) -c -of$(@).o $(<)
- # grep for the linker invocation and append -lcurl
- LINKCMD=$$($(DMD) $(MODEL_FLAG) $(DFLAGS) -v -of$(@) $(@).o 2>/dev/null | grep $(@).o); \
-- $${LINKCMD} -lcurl
-+ $${LINKCMD} -lcurl -lz
-
- $(TOOLS) $(DOC_TOOLS): $(ROOT)/%: %.d
- $(DMD) $(MODEL_FLAG) $(DFLAGS) -of$(@) $(<)
+--- dmd2/src/phobos/Makefile.orig 2024-12-02 16:50:03.490099174 +0100
++++ dmd2/src/phobos/Makefile 2024-12-02 19:45:41.494624384 +0100
+@@ -175,6 +175,7 @@ endif
+ UDFLAGS=-unittest -version=StdUnittest
+
+ LINKDL:=$(if $(findstring $(OS),linux),-L-ldl,)
++LINKZ:=$(if $(findstring $(OS),linux),-L-lz,)
+
+ # use timelimit to avoid deadlocks if available
+ TIMELIMIT:=$(if $(shell which timelimit 2>/dev/null || true),timelimit -t 90 ,)
+@@ -290,17 +291,6 @@ ALL_D_FILES = $(addsuffix .d, $(STD_MODU
+ $(EXTRA_MODULES_LINUX) $(EXTRA_MODULES_OSX) $(EXTRA_MODULES_FREEBSD) \
+ $(EXTRA_MODULES_WIN32) $(EXTRA_MODULES_INTERNAL))
+
+-# C files to be part of the build
+-C_MODULES := $(addprefix etc/c/zlib/, adler32 compress crc32 deflate \
+- gzclose gzlib gzread gzwrite infback inffast inflate inftrees trees uncompr zutil)
+-C_FILES := $(addsuffix .c, $(C_MODULES))
+-
+-ifeq ($(USE_IMPORTC),1)
+- C_OBJS := $(ROOT)/zlib$(DOTOBJ)
+-else
+- C_OBJS := $(addprefix $(ROOT)/, $(addsuffix $(DOTOBJ), $(C_MODULES)))
+-endif
+-
+ # build with shared library support (defaults to true on supported platforms)
+ SHARED=$(if $(findstring $(OS),linux freebsd),1,)
+
+@@ -345,18 +335,8 @@ endif
+ lib: $(LIB)
+ dll: $(ROOT)/libphobos2.so
+
+-ifeq ($(USE_IMPORTC),1)
+-# the druntime dependency makes sure DMD has been built
+-$(ROOT)/zlib$(DOTOBJ): $(C_FILES) $(DRUNTIME)
+- $(DMD) -c $(DFLAGS) $(addprefix -P=,$(CPPFLAGS) -Ietc/c/zlib) -of$@ $(C_FILES)
+-else
+-$(ROOT)/%$(DOTOBJ): %.c
+- @[ -d $(dir $@) ] || mkdir -p $(dir $@) || [ -d $(dir $@) ]
+- $(CC) -c $(CFLAGS) $(CPPFLAGS) $< $(CC_OUTFILEFLAG)$@
+-endif
+-
+-$(LIB): $(C_OBJS) $(ALL_D_FILES) $(DRUNTIME)
+- $(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(C_OBJS)
++$(LIB): $(ALL_D_FILES) $(DRUNTIME)
++ $(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES)
+
+ $(ROOT)/libphobos2.so: $(ROOT)/$(SONAME)
+ ln -sf $(notdir $(LIBSO)) $@
+@@ -365,8 +345,8 @@ $(ROOT)/$(SONAME): $(LIBSO)
+ ln -sf $(notdir $(LIBSO)) $@
+
+ $(LIBSO): override PIC:=-fPIC
+-$(LIBSO): $(C_OBJS) $(ALL_D_FILES) $(DRUNTIMESO)
+- $(DMD) $(DFLAGS) -shared $(NODEFAULTLIB) -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(D_FILES) $(C_OBJS)
++$(LIBSO): $(ALL_D_FILES) $(DRUNTIMESO)
++ $(DMD) $(DFLAGS) -shared $(NODEFAULTLIB) -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(LINKZ) $(D_FILES)
+
+ ifeq (osx,$(OS))
+ # Build fat library that combines the 32 bit and the 64 bit libraries
+@@ -407,8 +387,8 @@ ifneq (1,$(SHARED))
+
+ $(UT_D_OBJS): $(DRUNTIME)
+
+-$(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(C_OBJS) $(DRUNTIME)
+- $(DMD) $(DFLAGS) $(UDFLAGS) -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(C_OBJS) $(DRUNTIME) $(LINKDL) $(NODEFAULTLIB)
++$(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(DRUNTIME)
++ $(DMD) $(DFLAGS) $(UDFLAGS) -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(DRUNTIME) $(LINKDL) $(LINKZ) $(NODEFAULTLIB)
+
+ else
+
+@@ -417,8 +397,8 @@ UT_LIBSO:=$(ROOT)/unittest/libphobos2-ut
+ $(UT_D_OBJS): $(DRUNTIMESO)
+
+ $(UT_LIBSO): override PIC:=-fPIC
+-$(UT_LIBSO): $(UT_D_OBJS) $(C_OBJS) $(DRUNTIMESO)
+- $(DMD) $(DFLAGS) -shared $(UDFLAGS) -of$@ $(UT_D_OBJS) $(C_OBJS) $(DRUNTIMESO) $(LINKDL) $(NODEFAULTLIB)
++$(UT_LIBSO): $(UT_D_OBJS) $(DRUNTIMESO)
++ $(DMD) $(DFLAGS) -shared $(UDFLAGS) -of$@ $(UT_D_OBJS) $(DRUNTIMESO) $(LINKDL) $(LINKZ) $(NODEFAULTLIB)
+
+ $(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_LIBSO)
+ $(DMD) $(DFLAGS) -of$@ $< -L$(UT_LIBSO) $(NODEFAULTLIB)
+--- dmd2/src/dmd/dmd/link.d.orig 2024-06-30 18:32:38.000000000 +0200
++++ dmd2/src/dmd/dmd/link.d 2024-12-02 21:54:42.175979964 +0100
+@@ -725,6 +725,8 @@ public int runLINK(bool verbose, ErrorSi
+ argv.push(getbuf(libname[3 .. $-2]));
+ argv.push("-Xlinker");
+ argv.push("-Bdynamic");
++ if (libname == "libphobos2.a")
++ argv.push("-lz");
+ }
+ else if (libname[$-3 .. $] == ".so")
+ argv.push(getbuf(libname[3 .. $-3]));
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/dmd.git/commitdiff/8e51cc36efb7af1ae3994fc639d451daf092753e
More information about the pld-cvs-commit
mailing list