Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/dmd/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile 13 Oct 2021 04:38:50 -0000 1.1.1.1
+++ Makefile 2 Nov 2021 02:20:32 -0000
@@ -1,6 +1,6 @@
# $OpenBSD: Makefile,v 1.1.1.1 2021/10/13 04:38:50 bcallah Exp $
-# Possibly i386 one day, too
+# i386 forthcoming
ONLY_FOR_ARCHS = amd64
V = 2.098.0
@@ -24,11 +24,20 @@ MASTER_SITES = https://github.com/ibara/
USE_GMAKE = Yes
MAKE_ENV = HOST_CXX="${CXX}" \
- HOST_DMD="${WRKDIR}/dmd-${V}-bootstrap/openbsd/bin64/dmd"
+ HOST_DMD="${WRKDIR}/dmd-${V}-bootstrap/openbsd/bin${MODEL}/dmd"
MAKE_FILE = posix.mak
NO_TEST = Yes
+# MODEL depends on arch.
+# Also, i386 has one arch-specific patch.
+.if ${MACHINE_ARCH:Mamd64}
+MODEL = 64
+.else
+MODEL = 32
+PATCH_LIST = patch-* i386-*
+.endif
+
# Fix up the build system.
do-gen:
sed -i "s,TOPDIR,${WRKDIR},g" \
@@ -44,15 +53,15 @@ do-build:
cd ${WRKDIR}/druntime-${V} && \
${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} -f ${MAKE_FILE} && \
${SETENV} ${MAKE_PROGRAM} -f ${MAKE_FILE} install
- mkdir ${WRKDIR}/install/openbsd/bin64
- cp ${WRKDIR}/dmd-${V}/generated/openbsd/release/64/dmd \
- ${WRKDIR}/install/openbsd/bin64
+ mkdir ${WRKDIR}/install/openbsd/bin${MODEL}
+ cp ${WRKDIR}/dmd-${V}/generated/openbsd/release/${MODEL}/dmd \
+ ${WRKDIR}/install/openbsd/bin${MODEL}
# We need to do this manually too.
do-install:
- ${INSTALL_PROGRAM} ${WRKDIR}/install/openbsd/bin64/dmd \
+ ${INSTALL_PROGRAM} ${WRKDIR}/install/openbsd/bin${MODEL}/dmd \
${PREFIX}/bin
- ${INSTALL_DATA} ${WRKDIR}/install/openbsd/lib64/libphobos2.a \
+ ${INSTALL_DATA} ${WRKDIR}/install/openbsd/lib${MODEL}/libphobos2.a \
${PREFIX}/lib
${INSTALL_MAN} ${WRKDIR}/dmd-${V}/dmd.1 ${PREFIX}/man/man1
${INSTALL_MAN} ${WRKDIR}/dmd-${V}/docs/man/man5/dmd.conf.5 \
Index: patches/i386-patch-dmd-2_098_0_src_dmd_libmach_d
===================================================================
RCS file: patches/i386-patch-dmd-2_098_0_src_dmd_libmach_d
diff -N patches/i386-patch-dmd-2_098_0_src_dmd_libmach_d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/i386-patch-dmd-2_098_0_src_dmd_libmach_d 2 Nov 2021 02:20:32 -0000
@@ -0,0 +1,34 @@
+$OpenBSD$
+
+These casts are only needed on i386...
+
+Index: dmd-2.098.0/src/dmd/libmach.d
+--- dmd-2.098.0/src/dmd/libmach.d.orig
++++ dmd-2.098.0/src/dmd/libmach.d
+@@ -225,7 +225,7 @@ final class LibMach : Library
+ int i = module_name.toCStringThen!(slice => stat(slice.ptr, &statbuf));
+ if (i == -1) // error, errno is set
+ return corrupt(__LINE__);
+- om.file_time = statbuf.st_ctime;
++ om.file_time = cast(int)statbuf.st_ctime;
+ om.user_id = statbuf.st_uid;
+ om.group_id = statbuf.st_gid;
+ om.file_mode = statbuf.st_mode;
+@@ -254,7 +254,7 @@ final class LibMach : Library
+ om.user_id = 0; // meaningless on Windows
+ om.group_id = 0; // meaningless on Windows
+ }
+- time(&om.file_time);
++ time(cast(long*)&om.file_time);
+ om.file_mode = (1 << 15) | (6 << 6) | (4 << 3) | (4 << 0); // 0100644
+ }
+ objmodules.push(om);
+@@ -390,7 +390,7 @@ final class LibMach : Library
+ om.length = cast(uint)(hoffset - (8 + MachLibHeader.sizeof));
+ om.offset = 8;
+ om.name = "";
+- .time(&om.file_time);
++ .time(cast(long*)&om.file_time);
+ version (Posix)
+ {
+ om.user_id = getuid();
Hi ports --
I have now gotten DMD working on i386. I would like to make a 2-step
process towards i386 package support.
The first step (this patch, attached) updates the infrastructure to
handle either amd64 or i386, depending on platform. It does not enable
building for i386 nor update the bootstrap. It does include an
i386-specific patch that DMD needs.
There's no bump, since there is no change in the resulting package on
amd64. For amd64, we are just variablizing every instance of 64 to
${MODEL} in the port Makefile. The i386-specific patch does not get
applied on amd64.
Hopefully this makes testing the i386 DMD package easier, since we won't
have to deal with infrastructure changes and adding a new arch support
at the same time.
OK?
~Brian
No comments:
Post a Comment