# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= pipewire VERSION= 1.4.2 KEYWORDS= multimedia VARIANTS= std SDESC[std]= Low-latency audio/video router and processor HOMEPAGE= https://pipewire.org/ CONTACT= nobody DOWNLOAD_GROUPS= main jtsiomb SITES[main]= https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.4.2/ SITES[jtsiomb]= https://github.com/jtsiomb/c11threads/releases/download/v1.0/ DISTFILE[1]= pipewire-1.4.2.tar.gz:main DISTFILE[2]= c11threads-1.0.tar.gz:jtsiomb DF_INDEX= 1 SPKGS[std]= set primary dev tools nls OPTIONS_AVAILABLE= JACK C11THREADS OPTIONS_STANDARD= JACK C11THREADS OPT_ON[dragonfly]= C11THREADS OPT_ON[midnightbsd]= C11THREADS BUILD_DEPENDS= video4linux:dev:std dbus:dev:std opus:dev:std libsndfile:dev:std webrtc-audio-processing0:dev:std gstreamer1:dev:std gstreamer1-plugins-base:dev:std evdev-proto:single:std BUILDRUN_DEPENDS= dbus:primary:std opus:primary:std libsndfile:primary:std webrtc-audio-processing0:primary:std gstreamer1:primary:std gstreamer1-plugins-base:primary:std EXRUN[tools]= primary USES= meson ncurses pkgconfig ssl shebangfix python:build gettext:build bsd:epoll,gudev,inotify GNOME_COMPONENTS= glib LICENSE= MIT:primary LICENSE_FILE= MIT:{{WRKSRC}}/LICENSE LICENSE_SCHEME= solo FPC_EQUIVALENT= multimedia/pipewire MESON_ARGS= -Dgstreamer=enabled -Dgstreamer-device-provider=enabled -Dpw-cat=enabled -Dv4l2=enabled -Draop=enabled -Dsession-managers='[]' -Dalsa=disabled -Dpipewire-alsa=disabled -Davb=disabled -Dbluez5=disabled -Dman=disabled -Dlibcamera=disabled -Droc=disabled -Dsdl2=disabled -Dselinux=disabled -Dsystemd=disabled -Dpipewire-v4l2=disabled -Dlibmysofa=disabled -Dlibffado=disabled -Djack=disabled -Dpipewire-jack=disabled -Dtests=disabled -Dudevrulesdir="{{LOCALBASE}}/lib/udev/rules.d" SHEBANG_FILES= doc/*.py INSTALL_REQ_TOOLCHAIN= yes SOVERSION= 0.1402.0 VAR_OPSYS[netbsd]= CFLAGS=-D_NETBSD_SOURCE CFLAGS=-I{{LOCALBASE}}/include/libepoll-shim [JACK].DESCRIPTION= Add Jack audio server support [JACK].BROKEN_ON= Not yet supported [C11THREADS].DESCRIPTION= Install on platforms missing it [C11THREADS].DF_INDEX_ON= 2 post-install-C11THREADS-ON: ${RM} ${LOCALBASE}/include/threads.h pre-configure-midnightbsd: ${REINPLACE_CMD} -e 's@freebsd@midnightbsd@g' \ ${WRKSRC}/src/pipewire/meson.build \ ${WRKSRC}/meson.build pre-configure: ${GREP} -rl "pw_init(" | ${XARGS} ${REINPLACE_CMD} -e 's|pw_init(|pipewire_init|g' ${FIND} ${WRKSRC} -name "*.orig" -delete pre-configure-C11THREADS-ON: ${INSTALL_DATA} ${WRKDIR}/c11threads-1.0/c11threads.h ${LOCALBASE}/include/threads.h pre-configure-dragonfly: ${REINPLACE_CMD} -e 's@freebsd@dragonfly@g' \ ${WRKSRC}/src/pipewire/meson.build \ ${WRKSRC}/meson.build [FILE:365:descriptions/desc.primary] PipeWire is a server and user space API to deal with multimedia pipelines. This includes: - Making available sources of video (such as from a capture devices or application provided streams) and multiplexing this with clients. - Accessing sources of video for consumption. - Generating graphs for audio and video processing. This package contains the libraries. [FILE:63:descriptions/desc.tools] This package contains all the executable programs of pipewire. [FILE:200:distinfo] 4712aada64b9b49ad41fbb8b440914481432a560f2619ffbdd49461f8d22994f 2559522 pipewire-1.4.2.tar.gz f445c5d2ea9cda887104ad24ae1c89b5145c412313d307c0794bb2de20f5c244 3472 c11threads-1.0.tar.gz [FILE:1868:manifests/plist.primary] lib/ libpipewire-0.3.so libpipewire-0.3.so.%%SOMAJOR%% libpipewire-0.3.so.%%SOVERSION%% lib/gstreamer-1.0/libgstpipewire.so lib/pipewire-0.3/ libpipewire-module-access.so libpipewire-module-adapter.so libpipewire-module-client-device.so libpipewire-module-client-node.so libpipewire-module-combine-stream.so libpipewire-module-echo-cancel.so libpipewire-module-fallback-sink.so libpipewire-module-filter-chain.so libpipewire-module-link-factory.so libpipewire-module-loopback.so libpipewire-module-metadata.so libpipewire-module-netjack2-driver.so libpipewire-module-netjack2-manager.so libpipewire-module-parametric-equalizer.so libpipewire-module-pipe-tunnel.so libpipewire-module-portal.so libpipewire-module-profiler.so libpipewire-module-protocol-native.so libpipewire-module-protocol-pulse.so libpipewire-module-protocol-simple.so libpipewire-module-raop-sink.so libpipewire-module-rt.so libpipewire-module-rtkit.so libpipewire-module-rtp-sap.so libpipewire-module-rtp-sink.so libpipewire-module-rtp-source.so libpipewire-module-session-manager.so libpipewire-module-spa-device-factory.so libpipewire-module-spa-device.so libpipewire-module-spa-node-factory.so libpipewire-module-spa-node.so libpipewire-module-vban-recv.so libpipewire-module-vban-send.so lib/spa-0.2/libspa.so lib/spa-0.2/aec/ libspa-aec-null.so libspa-aec-webrtc.so lib/spa-0.2/audioconvert/libspa-audioconvert.so lib/spa-0.2/audiomixer/libspa-audiomixer.so lib/spa-0.2/audiotestsrc/libspa-audiotestsrc.so lib/spa-0.2/control/libspa-control.so lib/spa-0.2/filter-graph/ libspa-filter-graph-plugin-builtin.so libspa-filter-graph-plugin-ladspa.so libspa-filter-graph.so lib/spa-0.2/support/ libspa-dbus.so libspa-support.so lib/spa-0.2/v4l2/libspa-v4l2.so lib/spa-0.2/videoconvert/libspa-videoconvert.so lib/spa-0.2/videotestsrc/libspa-videotestsrc.so [FILE:2968:manifests/plist.dev] include/pipewire-0.3/pipewire/ array.h buffers.h client.h conf.h context.h control.h core.h data-loop.h device.h factory.h filter.h global.h i18n.h impl-client.h impl-core.h impl-device.h impl-factory.h impl-link.h impl-metadata.h impl-module.h impl-node.h impl-port.h impl.h keys.h link.h log.h loop.h main-loop.h map.h mem.h module.h node.h permission.h pipewire.h port.h properties.h protocol.h proxy.h resource.h stream.h thread-loop.h thread.h type.h utils.h version.h work-queue.h include/pipewire-0.3/pipewire/extensions/ client-node.h metadata.h profiler.h protocol-native.h security-context.h session-manager.h include/pipewire-0.3/pipewire/extensions/session-manager/ impl-interfaces.h interfaces.h introspect-funcs.h introspect.h keys.h include/spa-0.2/spa/buffer/ alloc.h buffer.h meta.h type-info.h include/spa-0.2/spa/control/ control.h type-info.h ump-utils.h include/spa-0.2/spa/debug/ buffer.h context.h dict.h file.h format.h log.h mem.h node.h pod.h types.h include/spa-0.2/spa/filter-graph/filter-graph.h include/spa-0.2/spa/graph/graph.h include/spa-0.2/spa/interfaces/audio/aec.h include/spa-0.2/spa/monitor/ device.h event.h type-info.h utils.h include/spa-0.2/spa/node/ command.h event.h io.h keys.h node.h type-info.h utils.h include/spa-0.2/spa/param/ buffers-types.h buffers.h format-types.h format-utils.h format.h latency-types.h latency-utils.h latency.h param-types.h param.h port-config-types.h port-config.h profile-types.h profile.h profiler-types.h profiler.h props-types.h props.h route-types.h route.h tag-types.h tag-utils.h tag.h type-info.h include/spa-0.2/spa/param/audio/ aac-types.h aac-utils.h aac.h alac-utils.h alac.h amr-types.h amr-utils.h amr.h ape-utils.h ape.h compressed.h dsd-utils.h dsd.h dsp-utils.h dsp.h flac-utils.h flac.h format-utils.h format.h iec958-types.h iec958-utils.h iec958.h layout.h mp3-types.h mp3-utils.h mp3.h opus.h ra-utils.h ra.h raw-json.h raw-types.h raw-utils.h raw.h type-info.h vorbis-utils.h vorbis.h wma-types.h wma-utils.h wma.h include/spa-0.2/spa/param/bluetooth/ audio.h type-info.h include/spa-0.2/spa/param/video/ chroma.h color.h dsp-utils.h dsp.h encoded.h format-utils.h format.h h264-utils.h h264.h mjpg-utils.h mjpg.h multiview.h raw-types.h raw-utils.h raw.h type-info.h include/spa-0.2/spa/pod/ builder.h command.h compare.h dynamic.h event.h filter.h iter.h parser.h pod.h vararg.h include/spa-0.2/spa/support/ cpu.h dbus.h i18n.h log-impl.h log.h loop.h plugin-loader.h plugin.h system.h thread.h include/spa-0.2/spa/utils/ ansi.h atomic.h cleanup.h defs.h dict.h dll.h endian.h enum-types.h hook.h json-core.h json-pod.h json.h keys.h list.h names.h ratelimit.h result.h ringbuffer.h string.h type-info.h type.h lib/pkgconfig/ libpipewire-0.3.pc libspa-0.2.pc [FILE:992:manifests/plist.tools] bin/ pipewire pipewire-aes67 pipewire-avb pipewire-pulse pw-cat pw-cli pw-config pw-container pw-dot pw-dsdplay pw-dump pw-encplay pw-link pw-loopback pw-metadata pw-mididump pw-midiplay pw-midirecord pw-mon pw-play pw-profiler pw-record pw-reserve spa-inspect spa-json-dump spa-monitor spa-resample etc/security/limits.d/25-pw-rlimits.conf share/pipewire/ client.conf filter-chain.conf jack.conf minimal.conf pipewire-aes67.conf pipewire-avb.conf pipewire-pulse.conf pipewire.conf share/pipewire/client.conf.avail/20-upmix.conf share/pipewire/filter-chain/ demonic.conf sink-dolby-surround.conf sink-eq6.conf sink-make-LFE.conf sink-matrix-spatialiser.conf sink-mix-FL-FR.conf sink-upmix-5.1-filter.conf sink-virtual-surround-5.1-kemar.conf sink-virtual-surround-7.1-hesuvi.conf source-duplicate-FL.conf source-rnnoise.conf share/pipewire/pipewire-pulse.conf.avail/20-upmix.conf share/pipewire/pipewire.conf.avail/ 10-rates.conf 20-upmix.conf [FILE:2181:manifests/plist.nls] share/locale/af/LC_MESSAGES/pipewire.mo share/locale/as/LC_MESSAGES/pipewire.mo share/locale/be/LC_MESSAGES/pipewire.mo share/locale/bg/LC_MESSAGES/pipewire.mo share/locale/bn_IN/LC_MESSAGES/pipewire.mo share/locale/ca/LC_MESSAGES/pipewire.mo share/locale/cs/LC_MESSAGES/pipewire.mo share/locale/da/LC_MESSAGES/pipewire.mo share/locale/de/LC_MESSAGES/pipewire.mo share/locale/de_CH/LC_MESSAGES/pipewire.mo share/locale/el/LC_MESSAGES/pipewire.mo share/locale/eo/LC_MESSAGES/pipewire.mo share/locale/es/LC_MESSAGES/pipewire.mo share/locale/fi/LC_MESSAGES/pipewire.mo share/locale/fr/LC_MESSAGES/pipewire.mo share/locale/gl/LC_MESSAGES/pipewire.mo share/locale/gu/LC_MESSAGES/pipewire.mo share/locale/he/LC_MESSAGES/pipewire.mo share/locale/hi/LC_MESSAGES/pipewire.mo share/locale/hr/LC_MESSAGES/pipewire.mo share/locale/hu/LC_MESSAGES/pipewire.mo share/locale/id/LC_MESSAGES/pipewire.mo share/locale/it/LC_MESSAGES/pipewire.mo share/locale/ja/LC_MESSAGES/pipewire.mo share/locale/ka/LC_MESSAGES/pipewire.mo share/locale/kk/LC_MESSAGES/pipewire.mo share/locale/kn/LC_MESSAGES/pipewire.mo share/locale/ko/LC_MESSAGES/pipewire.mo share/locale/lt/LC_MESSAGES/pipewire.mo share/locale/ml/LC_MESSAGES/pipewire.mo share/locale/mr/LC_MESSAGES/pipewire.mo share/locale/my/LC_MESSAGES/pipewire.mo share/locale/nl/LC_MESSAGES/pipewire.mo share/locale/nn/LC_MESSAGES/pipewire.mo share/locale/oc/LC_MESSAGES/pipewire.mo share/locale/or/LC_MESSAGES/pipewire.mo share/locale/pa/LC_MESSAGES/pipewire.mo share/locale/pl/LC_MESSAGES/pipewire.mo share/locale/pt/LC_MESSAGES/pipewire.mo share/locale/pt_BR/LC_MESSAGES/pipewire.mo share/locale/ro/LC_MESSAGES/pipewire.mo share/locale/ru/LC_MESSAGES/pipewire.mo share/locale/si/LC_MESSAGES/pipewire.mo share/locale/sk/LC_MESSAGES/pipewire.mo share/locale/sl/LC_MESSAGES/pipewire.mo share/locale/sr/LC_MESSAGES/pipewire.mo share/locale/sr@latin/LC_MESSAGES/pipewire.mo share/locale/sv/LC_MESSAGES/pipewire.mo share/locale/ta/LC_MESSAGES/pipewire.mo share/locale/te/LC_MESSAGES/pipewire.mo share/locale/tr/LC_MESSAGES/pipewire.mo share/locale/uk/LC_MESSAGES/pipewire.mo share/locale/zh_CN/LC_MESSAGES/pipewire.mo share/locale/zh_TW/LC_MESSAGES/pipewire.mo [FILE:395:patches/patch-spa_include_spa_utils_endian.h] --- spa/include/spa/utils/endian.h.orig 2025-04-14 09:46:02 UTC +++ spa/include/spa/utils/endian.h @@ -5,7 +5,7 @@ #ifndef SPA_ENDIAN_H #define SPA_ENDIAN_H -#if defined(__FreeBSD__) || defined(__MidnightBSD__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__DragonFly__) || defined(__NetBSD__) #include #define bswap_16 bswap16 #define bswap_32 bswap32 [FILE:423:patches/patch-spa_include_spa_utils_json-pod.h] --- spa/include/spa/utils/json-pod.h.orig 2025-04-14 09:46:02 UTC +++ spa/include/spa/utils/json-pod.h @@ -121,7 +121,7 @@ SPA_API_JSON_POD int spa_json_to_pod_par spa_pod_builder_none(b); } else { - char *val = (char*)alloca(len+1); + char *val = (char*)__builtin_alloca(len+1); spa_json_parse_stringn(value, len, val, len+1); switch (info ? info->parent : (uint32_t)SPA_TYPE_Struct) { case SPA_TYPE_Id: [FILE:317:patches/patch-spa_include_spa_utils_string.h] --- spa/include/spa/utils/string.h.orig 2025-04-14 09:46:02 UTC +++ spa/include/spa/utils/string.h @@ -25,6 +25,11 @@ extern "C" { #endif #endif +#if defined(__NetBSD__) +// uselocale is not supported +#define __LOCALE_C_ONLY +#endif + /** * \defgroup spa_string String handling * String handling utilities [FILE:513:patches/patch-spa_plugins_filter-graph_filter-graph.c] --- spa/plugins/filter-graph/filter-graph.c.orig 2025-04-14 09:46:02 UTC +++ spa/plugins/filter-graph/filter-graph.c @@ -299,7 +299,13 @@ static struct port *find_port(struct nod const struct spa_fga_descriptor *d; uint32_t i, n_ports, port_id = SPA_ID_INVALID; - str = strdupa(name); + str = ({ + char *buf; + size_t len = strlen(name); + buf = __builtin_alloca(len + 1); + buf[len] = '\0'; + (char *)memcpy(buf, name, len); + }); col = strchr(str, ':'); if (col != NULL) { struct node *find; [FILE:336:patches/patch-spa_plugins_meson.build] --- spa/plugins/meson.build.orig 2025-04-14 09:46:02 UTC +++ spa/plugins/meson.build @@ -1,4 +1,4 @@ -if alsa_dep.found() and host_machine.system() == 'linux' +if alsa_dep.found() subdir('alsa') endif if get_option('avb').require(host_machine.system() == 'linux', error_message: 'AVB support is only available on Linux').allowed() [FILE:532:patches/patch-spa_plugins_support_cpu.c] --- spa/plugins/support/cpu.c.orig 2025-04-14 09:46:02 UTC +++ spa/plugins/support/cpu.c @@ -12,7 +12,7 @@ #include #include -#if defined(__FreeBSD__) || defined(__MidnightBSD__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__NetBSD__) #include #endif @@ -92,7 +92,7 @@ impl_cpu_force_flags(void *object, uint3 return 0; } -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) static uint32_t get_count(struct impl *this) { cpu_set_t cpuset; [FILE:449:patches/patch-spa_plugins_support_logger.c] --- spa/plugins/support/logger.c.orig 2025-04-14 09:46:02 UTC +++ spa/plugins/support/logger.c @@ -20,7 +20,7 @@ #include #include -#if defined(__FreeBSD__) || defined(__MidnightBSD__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__DragonFly__) || defined(__NetBSD__) #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC #elif defined(_MSC_VER) static inline void setlinebuf(FILE* stream) { [FILE:357:patches/patch-spa_plugins_v4l2_v4l2-utils.c] --- spa/plugins/v4l2/v4l2-utils.c.orig 2025-04-14 09:46:02 UTC +++ spa/plugins/v4l2/v4l2-utils.c @@ -15,6 +15,12 @@ #include #include +#if !defined(__linux__) +typedef uint32_t __u32; +typedef int32_t __s32; +typedef int64_t __s64; +#endif + static int xioctl(int fd, int request, void *arg) { int err; [FILE:317:patches/patch-spa_tests_stress-ringbuffer.c] --- spa/tests/stress-ringbuffer.c.orig 2025-04-14 09:46:02 UTC +++ spa/tests/stress-ringbuffer.c @@ -19,6 +19,9 @@ static int sched_getcpu(void) { return -1; }; #endif #endif +#if defined(__NetBSD__) +static int sched_getcpu(void) { return -1; }; +#endif static struct spa_ringbuffer rb; static uint32_t size; [FILE:1037:patches/patch-src_modules_module-netjack2-manager.c] --- src/modules/module-netjack2-manager.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-netjack2-manager.c @@ -39,6 +39,10 @@ #include "module-netjack2/peer.c" #include "network-utils.h" +#if defined(__FreeBSD__) || defined(__DragonFly__) +#define ifr_ifindex ifr_index +#endif + #ifndef IPTOS_DSCP #define IPTOS_DSCP_MASK 0xfc #define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) @@ -813,10 +817,16 @@ static int make_announce_socket(struct s static const uint32_t ipv4_mcast_mask = 0xe0000000; struct sockaddr_in *sa4 = (struct sockaddr_in*)sa; if ((ntohl(sa4->sin_addr.s_addr) & ipv4_mcast_mask) == ipv4_mcast_mask) { +#if defined(__NetBSD__) + struct ip_mreq mr4; + memset(&mr4, 0, sizeof(mr4)); + mr4.imr_multiaddr = sa4->sin_addr; +#else struct ip_mreqn mr4; memset(&mr4, 0, sizeof(mr4)); mr4.imr_multiaddr = sa4->sin_addr; mr4.imr_ifindex = req.ifr_ifindex; +#endif res = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr4, sizeof(mr4)); } else { sa4->sin_addr.s_addr = INADDR_ANY; [FILE:344:patches/patch-src_modules_module-protocol-pulse_message-handler.c] --- src/modules/module-protocol-pulse/message-handler.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-protocol-pulse/message-handler.c @@ -6,7 +6,9 @@ #include #include +#if !defined(__DragonFly__) && !defined(__FreeBSD__) #include +#endif #include #include [FILE:1408:patches/patch-src_modules_module-protocol-pulse_utils.c] --- src/modules/module-protocol-pulse/utils.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-protocol-pulse/utils.c @@ -86,6 +86,7 @@ int check_flatpak(struct client *client, root_fd = openat(AT_FDCWD, root_path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY); if (root_fd == -1) { res = -errno; +#if !defined(__NetBSD__) if (res == -EACCES) { struct statfs buf; /* Access to the root dir isn't allowed. This can happen if the root is on a fuse @@ -96,6 +97,7 @@ int check_flatpak(struct client *client, buf.f_type == 0x65735546) /* FUSE_SUPER_MAGIC */ return 0; } +#endif /* Not able to open the root dir shouldn't happen. Probably the app died and * we're failing due to /proc/$pid not existing. In that case fail instead * of treating this as privileged. */ @@ -124,8 +126,8 @@ int check_flatpak(struct client *client, pid_t get_client_pid(struct client *client, int client_fd) { - socklen_t len; #if defined(__linux__) + socklen_t len; struct ucred ucred; len = sizeof(ucred); if (getsockopt(client_fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) { @@ -133,6 +135,7 @@ pid_t get_client_pid(struct client *clie } else return ucred.pid; #elif defined(__FreeBSD__) || defined(__MidnightBSD__) + socklen_t len; struct xucred xucred; len = sizeof(xucred); if (getsockopt(client_fd, 0, LOCAL_PEERCRED, &xucred, &len) < 0) { [FILE:624:patches/patch-src_modules_module-rt.c] --- src/modules/module-rt.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-rt.c @@ -35,6 +35,9 @@ #if defined(__FreeBSD__) || defined(__MidnightBSD__) #include #endif +#if defined(__NetBSD__) +#include +#endif #if defined(__GNU__) #include #endif @@ -252,6 +255,10 @@ static pid_t _gettid(void) return (pid_t) gettid(); #elif defined(__linux__) return syscall(SYS_gettid); +#elif defined(__DragonFly__) + return syscall(SYS_lwp_gettid); +#elif defined(__NetBSD__) + return (pid_t)_lwp_self(); #elif defined(__FreeBSD__) || defined(__MidnightBSD__) long pid; thr_self(&pid); [FILE:1532:patches/patch-src_modules_module-rtp-sap.c] --- src/modules/module-rtp-sap.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-rtp-sap.c @@ -32,6 +32,14 @@ #define SO_PASSCRED LOCAL_CREDS_PERSISTENT #endif +#if defined(__DragonFly__) +#define ifr_ifindex ifr_index +#endif + +#if defined(__MidnightBSD__) +#include +#endif + /** \page page_module_rtp_sap SAP Announce and create RTP streams * * The `rtp-sap` module announces RTP streams that match the rules with the @@ -390,11 +398,13 @@ static int make_unix_socket(const char * return -1; } +#if !defined(__MidnightBSD__) && !defined(__NetBSD__) int val = 1; if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &val, sizeof(val)) < 0) { pw_log_warn("Failed to bind PTP management socket"); return -1; } +#endif spa_zero(addr); addr.sun_family = AF_UNIX; @@ -487,10 +497,16 @@ static int make_recv_socket(struct socka static const uint32_t ipv4_mcast_mask = 0xe0000000; struct sockaddr_in *sa4 = (struct sockaddr_in*)sa; if ((ntohl(sa4->sin_addr.s_addr) & ipv4_mcast_mask) == ipv4_mcast_mask) { +#if defined(__NetBSD__) + struct ip_mreq mr4; + memset(&mr4, 0, sizeof(mr4)); + mr4.imr_multiaddr = sa4->sin_addr; +#else struct ip_mreqn mr4; memset(&mr4, 0, sizeof(mr4)); mr4.imr_multiaddr = sa4->sin_addr; mr4.imr_ifindex = req.ifr_ifindex; +#endif pw_net_get_ip(sa, addr, sizeof(addr), NULL, NULL); pw_log_info("join IPv4 group: %s iface:%d", addr, req.ifr_ifindex); res = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr4, sizeof(mr4)); [FILE:827:patches/patch-src_modules_module-rtp-source.c] --- src/modules/module-rtp-source.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-rtp-source.c @@ -267,10 +267,16 @@ static int make_socket(const struct sock static const uint32_t ipv4_mcast_mask = 0xe0000000; struct sockaddr_in *sa4 = (struct sockaddr_in*)sa; if ((ntohl(sa4->sin_addr.s_addr) & ipv4_mcast_mask) == ipv4_mcast_mask) { +#if defined(__NetBSD__) + struct ip_mreq mr4; + memset(&mr4, 0, sizeof(mr4)); + mr4.imr_multiaddr = sa4->sin_addr; +#else struct ip_mreqn mr4; memset(&mr4, 0, sizeof(mr4)); mr4.imr_multiaddr = sa4->sin_addr; mr4.imr_ifindex = req.ifr_ifindex; +#endif pw_net_get_ip((struct sockaddr_storage*)sa, addr, sizeof(addr), NULL, NULL); pw_log_info("join IPv4 group: %s", addr); res = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr4, sizeof(mr4)); [FILE:749:patches/patch-src_modules_module-vban-recv.c] --- src/modules/module-vban-recv.c.orig 2025-04-14 09:46:02 UTC +++ src/modules/module-vban-recv.c @@ -241,10 +241,16 @@ static int make_socket(const struct sock static const uint32_t ipv4_mcast_mask = 0xe0000000; struct sockaddr_in *sa4 = (struct sockaddr_in*)sa; if ((ntohl(sa4->sin_addr.s_addr) & ipv4_mcast_mask) == ipv4_mcast_mask) { +#if defined(__NetBSD__) + struct ip_mreq mr4; + memset(&mr4, 0, sizeof(mr4)); + mr4.imr_multiaddr = sa4->sin_addr; +#else struct ip_mreqn mr4; memset(&mr4, 0, sizeof(mr4)); mr4.imr_multiaddr = sa4->sin_addr; mr4.imr_ifindex = req.ifr_ifindex; +#endif res = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr4, sizeof(mr4)); } else { sa4->sin_addr.s_addr = INADDR_ANY; [FILE:265:patches/patch-src_modules_network-utils.h] --- src/modules/network-utils.h.orig 2025-04-14 09:46:02 UTC +++ src/modules/network-utils.h @@ -8,7 +8,7 @@ #include #include -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__DragonFly__) #define ifr_ifindex ifr_index #endif [FILE:1583:patches/patch-src_pipewire_buffers.c] --- src/pipewire/buffers.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/buffers.c @@ -48,7 +48,7 @@ static int alloc_buffers(struct pw_mempo if (!SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_SHARED)) SPA_FLAG_SET(info.flags, SPA_BUFFER_ALLOC_FLAG_INLINE_ALL); - datas = alloca(sizeof(struct spa_data) * n_datas); + datas = __builtin_alloca(sizeof(struct spa_data) * n_datas); for (i = 0; i < n_datas; i++) { struct spa_data *d = &datas[i]; @@ -221,10 +221,10 @@ int pw_buffers_negotiate(struct pw_conte if ((res = param_filter(result, &input, &output, SPA_PARAM_Meta, &b)) > 0) n_params += res; - metas = alloca(sizeof(struct spa_meta) * n_params); + metas = __builtin_alloca(sizeof(struct spa_meta) * n_params); n_metas = 0; - params = alloca(n_params * sizeof(struct spa_pod *)); + params = __builtin_alloca(n_params * sizeof(struct spa_pod *)); for (i = 0, offset = 0; i < n_params; i++) { uint32_t type, size; @@ -318,10 +318,10 @@ int pw_buffers_negotiate(struct pw_conte if (SPA_FLAG_IS_SET(flags, PW_BUFFERS_FLAG_NO_MEM)) minsize = 0; - data_sizes = alloca(sizeof(uint32_t) * blocks); - data_strides = alloca(sizeof(int32_t) * blocks); - data_aligns = alloca(sizeof(uint32_t) * blocks); - data_types = alloca(sizeof(uint32_t) * blocks); + data_sizes = __builtin_alloca(sizeof(uint32_t) * blocks); + data_strides = __builtin_alloca(sizeof(int32_t) * blocks); + data_aligns = __builtin_alloca(sizeof(uint32_t) * blocks); + data_types = __builtin_alloca(sizeof(uint32_t) * blocks); for (i = 0; i < blocks; i++) { data_sizes[i] = minsize; [FILE:998:patches/patch-src_pipewire_conf.c] --- src/pipewire/conf.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/conf.c @@ -18,11 +18,9 @@ #ifdef HAVE_PWD_H #include #endif -#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__) #ifndef O_PATH #define O_PATH 0 #endif -#endif #include #include @@ -358,7 +356,7 @@ int pw_conf_save_state(const char *prefi if ((sfd = open_write_dir(path, sizeof(path), prefix)) < 0) return sfd; - tmp_name = alloca(strlen(name)+5); + tmp_name = __builtin_alloca(strlen(name)+5); sprintf(tmp_name, "%s.tmp", name); if ((fd = openat(sfd, tmp_name, O_CLOEXEC | O_CREAT | O_WRONLY | O_TRUNC, 0600)) < 0) { res = -errno; @@ -472,7 +470,7 @@ SPA_EXPORT int pw_conf_load_conf(const char *prefix, const char *name, struct pw_properties *conf) { char path[PATH_MAX]; - char fname[PATH_MAX + 256]; + char fname[PATH_MAX + 1024]; int i, res, level = 0; spa_autoptr(pw_properties) override = NULL; const char *dname; [FILE:290:patches/patch-src_pipewire_impl-node.c] --- src/pipewire/impl-node.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/impl-node.c @@ -8,7 +8,9 @@ #include #include #include +#if !defined(__DragonFly__) && !defined(__FreeBSD__) #include +#endif #include #include "config.h" [FILE:742:patches/patch-src_pipewire_mem.c] --- src/pipewire/mem.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/mem.c @@ -27,6 +27,7 @@ PW_LOG_TOPIC_EXTERN(log_mem); #define PW_LOG_TOPIC_DEFAULT log_mem #if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) \ + && !defined(__DragonFly__) && !defined(__NetBSD__) \ && !defined(HAVE_MEMFD_CREATE) /* * No glibc wrappers exist for memfd_create(2), so provide our own. @@ -44,7 +45,7 @@ static inline int memfd_create(const cha #define HAVE_MEMFD_CREATE 1 #endif -#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__) || defined(__DragonFly__) || defined(__NetBSD__) #define MAP_LOCKED 0 #endif [FILE:2223:patches/patch-src_pipewire_pipewire.c] PipeWire exports a function named "pw_init". FreeBSD also has the libutil.so library, which exports a function with the same name. To workaround the conflict, rename the PipeWire init function into "pipewire_init". Upstream issue: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819 --- src/pipewire/pipewire.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/pipewire.c @@ -7,7 +7,7 @@ #include #include #include -#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) && !defined(__DragonFly__) && !defined(__NetBSD__) #include #endif #include @@ -484,7 +484,7 @@ static struct spa_log *load_journal_logg * This function can be called multiple times. */ SPA_EXPORT -void pw_init(int *argc, char **argv[]) +void pipewire_init(int *argc, char **argv[]) { const char *str; struct spa_dict_item items[6]; @@ -599,7 +599,7 @@ done: * used again after being deinitialized with a new pw_init() call. */ SPA_EXPORT -void pw_deinit(void) +void pipewire_deinit(void) { struct support *support = &global_support; struct registry *registry = &support->registry; @@ -625,6 +625,21 @@ done: } +#if !defined(__FreeBSD__) && !defined(__DragonFly__) +#undef pw_init +SPA_EXPORT +void pw_init(int *argc, char **argv[]) +{ + pipewire_init(argc, argv); +} +#undef pw_deinit +SPA_EXPORT +void pw_deinit(void) +{ + pipewire_deinit(); +} +#endif + /** Check if a debug category is enabled * * \param name the name of the category to check @@ -662,7 +677,7 @@ static void init_prgname(void) } } #endif -#if defined __FreeBSD__ || defined(__MidnightBSD__) +#if defined __FreeBSD__ || defined(__MidnightBSD__) || defined(__DragonFly__) || defined(__NetBSD__) { ssize_t len; @@ -672,7 +687,7 @@ static void init_prgname(void) } } #endif -#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) +#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(__GNU__) && !defined(__DragonFly__) && !defined(__NetBSD__) { if (prctl(PR_GET_NAME, (unsigned long) name, 0, 0, 0) == 0) { prgname = name; [FILE:421:patches/patch-src_pipewire_pipewire.h] --- src/pipewire/pipewire.h.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/pipewire.h @@ -50,9 +50,12 @@ extern "C" { * \{ */ void -pw_init(int *argc, char **argv[]); +pipewire_init(int *argc, char **argv[]); -void pw_deinit(void); +void pipewire_deinit(void); +/* BSD has pw_init already */ +#define pw_init pipewire_init +#define pw_deinit pipewire_deinit bool pw_debug_is_category_enabled(const char *name); [FILE:626:patches/patch-src_pipewire_private.h] --- src/pipewire/private.h.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/private.h @@ -14,6 +14,11 @@ extern "C" { #include #include /* for pthread_t */ +#if defined(__NetBSD__) +#include +#include +#endif + #include "pipewire/impl.h" #include @@ -24,7 +29,7 @@ extern "C" { #include #include -#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__) +#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__GNU__) || defined(__NetBSD__) struct ucred { }; #endif [FILE:2133:patches/patch-src_pipewire_thread.c] --- src/pipewire/thread.c.orig 2025-04-14 09:46:02 UTC +++ src/pipewire/thread.c @@ -9,6 +9,9 @@ #ifdef __FreeBSD__ #include #endif +#ifdef __NetBSD__ +#include +#endif #include #include @@ -29,18 +32,31 @@ do { \ } \ } while(false); +#if defined(__MidnightBSD__) || defined(__NetBSD__) +static int parse_affinity(const char *affinity, cpuset_t *set) +#else static int parse_affinity(const char *affinity, cpu_set_t *set) +#endif { struct spa_json it[1]; int v; +#if defined(__NetBSD__) + cpuset_zero(set); +#else CPU_ZERO(set); +#endif if (spa_json_begin_array_relax(&it[0], affinity, strlen(affinity)) <= 0) return 0; while (spa_json_get_int(&it[0], &v) > 0) { +#if defined(__NetBSD__) + if (v >= 0 && v < (int)cpuset_size(set)) + cpuset_set(v, set); +#else if (v >= 0 && v < CPU_SETSIZE) CPU_SET(v, set); +#endif } return 0; } @@ -80,9 +96,23 @@ int pthread_setname_np(pthread_t thread, static int thread_setaffinity(pthread_t thread, const char *affinity) { +#if defined(__MidnightBSD__) + cpuset_t set; +#elif defined(__NetBSD__) + cpuset_t *set = cpuset_create(); +#else cpu_set_t set; +#endif + int result; +#if defined(__NetBSD__) + parse_affinity(affinity, set); + result = pthread_setaffinity_np(thread, cpuset_size(set), set); + cpuset_destroy(set); +#else parse_affinity(affinity, &set); - return -pthread_setaffinity_np(thread, sizeof(set), &set); + result = -pthread_setaffinity_np(thread, sizeof(set), &set); +#endif + return result; } static struct spa_thread *impl_create(void *object, @@ -113,7 +143,11 @@ static struct spa_thread *impl_create(vo } if (props) { if ((str = spa_dict_lookup(props, SPA_KEY_THREAD_NAME)) != NULL && +#if defined(__NetBSD__) + (err = pthread_setname_np(pt, "%s", (void *)str)) != 0) +#else (err = pthread_setname_np(pt, str)) != 0) +#endif pw_log_warn("pthread_setname error: %s", strerror(err)); if ((str = spa_dict_lookup(props, SPA_KEY_THREAD_AFFINITY)) != NULL && (err = thread_setaffinity(pt, str)) != 0) [FILE:198:patches/patch-test_test-functional.c] --- test/test-functional.c.orig 2025-04-14 09:46:02 UTC +++ test/test-functional.c @@ -6,6 +6,8 @@ #include "config.h" +#include + #include "pwtest.h" PWTEST(openal_info_test)