pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk/compiler



Module Name:    pkgsrc
Committed By:   gdt
Date:           Tue Apr  8 00:22:34 UTC 2025

Added Files:
        pkgsrc/mk/compiler: i386-sse2.mk

Log Message:
mk/compiler: Add i386-sse2.mk

Including this file, when the target is i386, instructs C and rust
compilers that they may use sse2 instructions.  Using it enables the
many rust packages that include the ring crate to build on i386,
rather than having to be marked BROKEN.

As proposed on tech-pkg@.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/mk/compiler/i386-sse2.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/mk/compiler/i386-sse2.mk
diff -u /dev/null pkgsrc/mk/compiler/i386-sse2.mk:1.1
--- /dev/null   Tue Apr  8 00:22:34 2025
+++ pkgsrc/mk/compiler/i386-sse2.mk     Tue Apr  8 00:22:34 2025
@@ -0,0 +1,41 @@
+# $NetBSD: i386-sse2.mk,v 1.1 2025/04/08 00:22:34 gdt Exp $
+#
+# This Makefile fragment is included by packages that require SSE2
+# instructions on i386 processors.  If on i386, it will add flags
+# instructing various compilers (that the package might or might not
+# use) that they may emit SSE2 instructions.
+#
+# The point is to enable programs which cannot be built or cannot be
+# reasonably be built without SSE2 to build, while not changing the
+# base machine definition (and thus causing i386 binaries in general
+# to fail on pre-SSE2 hardware.
+
+# i485 and i586 (pentium) never have SSE2.
+# i686 means "Pentium Pro" instruction set, with no SSE2.
+# Within i686, Pentium II and Pentium III also lack SSE2.
+# Pentium M, 4, 4-M, and essentially all later CPUs have SSE2.
+
+# When enabling SSE2, we enable generation of the i686 instruction set
+# when convenient, because no pre-686 processors implement SSE2, so
+# there's no portability gain from leaving the increased efficiency on
+# the table.
+
+.if !defined(I386_SSE2_MK)
+
+I386_SSE2_MK:=
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if ${MACHINE_ARCH} == "i386"
+
+.  if empty(CFLAGS:M*sse2=*)
+CFLAGS+=       -march=i686 -msse2
+.  endif
+
+# rust defaults to i586.  Choose minimal enabling of sse2, at least
+# for now.
+RUSTFLAGS+=    -C target-feature=+sse2
+
+.endif
+
+.endif



Home | Main Index | Thread Index | Old Index