git: dedce3354adc - main - emulators/azahar: New port, Actively maintained fork of Citra, a Nintendo 3DS emulator

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Fri, 25 Sep 2026 05:06:26 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=dedce3354adcf26cc2ead319ed24df79a44894ff

commit dedce3354adcf26cc2ead319ed24df79a44894ff
Author:     Kevin Reinholz <kreinholz@gmail.com>
AuthorDate: 2026-09-25 05:00:08 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2026-09-25 05:05:47 +0000

    emulators/azahar: New port, Actively maintained fork of Citra, a Nintendo 3DS emulator
    
    Fork of Citra which brings many improvements including Qt 6 support.
    On first run, Azahar offers to import data and settings (including
    game saves) from an existing Citra install.
    
    Builds with vulkan enabled, but I disabled this option by default as
    games crash immediately with Vulkan backend enabled, at least with my
    NVIDIA GPU. It's possible users with other configurations will have
    more luck with Vulkan, but it is still considered experimental by
    upstream whereas OpenGL is quite well supported.
    
    Also includes it as plugin to libretro, emulators/libretro-azahar
    
    PR:             290085
---
 emulators/Makefile                                 |   2 +
 emulators/azahar/Makefile                          | 116 +++++++++++++++++++
 emulators/azahar/distinfo                          |   3 +
 emulators/azahar/files/patch-add_more_system_libs  | 126 +++++++++++++++++++++
 .../azahar/files/patch-externals_teakra_src_test.h |  13 +++
 emulators/azahar/pkg-descr                         |   1 +
 emulators/azahar/pkg-message                       |   9 ++
 emulators/azahar/pkg-plist                         |   6 +
 emulators/libretro-azahar/Makefile                 |  14 +++
 9 files changed, 290 insertions(+)

diff --git a/emulators/Makefile b/emulators/Makefile
index bbdac0bf993b..d25902eb6935 100644
--- a/emulators/Makefile
+++ b/emulators/Makefile
@@ -10,6 +10,7 @@
     SUBDIR += aranym
     SUBDIR += ares
     SUBDIR += atari800
+    SUBDIR += azahar
     SUBDIR += bfe
     SUBDIR += bochs
     SUBDIR += bsvc
@@ -64,6 +65,7 @@
     SUBDIR += libc6-shim
     SUBDIR += libdsk
     SUBDIR += libmt32emu
+    SUBDIR += libretro-azahar
     SUBDIR += libretro-bsnes
     SUBDIR += libretro-flycast
     SUBDIR += libretro-kronos
diff --git a/emulators/azahar/Makefile b/emulators/azahar/Makefile
new file mode 100644
index 000000000000..88f9823c3e4e
--- /dev/null
+++ b/emulators/azahar/Makefile
@@ -0,0 +1,116 @@
+PORTNAME=	azahar
+DISTVERSION=	2126.1.2
+CATEGORIES=	emulators
+MASTER_SITES=	https://github.com/azahar-emu/${PORTNAME}/releases/download/${DISTVERSION}/
+DISTNAME=	${PORTNAME}-unified-source-${DISTVERSION}
+
+MAINTAINER=	kreinholz@gmail.com
+COMMENT=	Nintendo 3DS emulator/debugger
+WWW=		https://azahar-emu.org
+
+LICENSE=	GPLv2+ ISCL
+LICENSE_COMB=	multi
+LICENSE_FILE_GPLv2+ =	${WRKSRC}/license.txt
+LICENSE_FILE_ISCL=	${WRKSRC}/externals/cubeb/LICENSE
+
+BROKEN_aarch64=	build fails on aarch64 with system boost-libs
+
+BUILD_DEPENDS=	nlohmann-json>0:devel/nlohmann-json \
+		cpp-httplib>0:www/cpp-httplib \
+		glslang>0:graphics/glslang \
+		robin-map>0:devel/robin-map \
+		spirv-tools>0:graphics/spirv-tools \
+		vulkan-headers>0:graphics/vulkan-headers
+
+LIB_DEPENDS=	libboost_iostreams.so:devel/boost-libs \
+		libCatch2.so:devel/catch2 \
+		libenet.so:net/enet \
+		libfaad.so:audio/faad \
+		libfmt.so:devel/libfmt \
+		libinih.so:devel/inih \
+		libSoundTouch.so:audio/soundtouch \
+		libxxhash.so:devel/xxhash \
+		libZycore.so:devel/zycore-c \
+		libZydis.so:devel/zydis
+
+USES=		cmake:testing compiler:c++17-lang localbase:ldflags pkgconfig \
+		ssl tar:xz
+
+CMAKE_ON=	Boost_USE_SHARED_LIBS \
+		USE_SYSTEM_BOOST \
+		USE_SYSTEM_CATCH2 \
+		USE_SYSTEM_CPP_HTTPLIB \
+		USE_SYSTEM_ENET \
+		USE_SYSTEM_FAAD \
+		USE_SYSTEM_FMT \
+		USE_SYSTEM_GLSLANG \
+		USE_SYSTEM_INIH \
+		USE_SYSTEM_JSON \
+		USE_SYSTEM_OPENSSL \
+		USE_SYSTEM_SOUNDTOUCH \
+		USE_SYSTEM_SPIRV_TOOLS \
+		USE_SYSTEM_SDL2 \
+		USE_SYSTEM_VULKAN_HEADERS \
+		USE_SYSTEM_XXHASH
+
+CMAKE_OFF=	ENABLE_OPENAL
+
+LDFLAGS+=	-Wl,--as-needed
+
+OPTIONS_DEFINE=		ALSA JACK PULSEAUDIO SNDIO VULKAN
+OPTIONS_DEFAULT=	JACK PULSEAUDIO SNDIO VULKAN
+
+ALSA_BUILD_DEPENDS=	alsa-lib>0:audio/alsa-lib
+ALSA_CMAKE_BOOL=	USE_ALSA
+
+JACK_BUILD_DEPENDS=	jackit>0:audio/jack
+JACK_CMAKE_BOOL=	USE_JACK
+
+PULSEAUDIO_BUILD_DEPENDS=pulseaudio>0:audio/pulseaudio
+PULSEAUDIO_CMAKE_BOOL=	USE_PULSE
+
+SNDIO_BUILD_DEPENDS=	sndio>0:audio/sndio
+SNDIO_CMAKE_BOOL=	USE_SNDIO
+
+VULKAN_DESC=		Vulkan renderer (experimental)
+VULKAN_BUILD_DEPENDS=	vulkan-headers>0:graphics/vulkan-headers
+VULKAN_LIB_DEPENDS=	libvulkan.so:graphics/vulkan-loader
+VULKAN_CMAKE_BOOL=	ENABLE_VULKAN
+
+.if !defined(AZAHAR_SLAVE)
+USES+=			desktop-file-utils qt:6 sdl shared-mime-info
+USE_QT=			base multimedia svg tools:build translations:run
+USE_SDL=		sdl2
+
+CMAKE_ON+=		ENABLE_QT \
+			ENABLE_QT_TRANSLATION \
+			ENABLE_SDL2
+.endif
+
+.if defined(AZAHAR_SLAVE)
+CMAKE_ON+=		ENABLE_LIBRETRO \
+			CMAKE_POSITION_INDEPENDENT_CODE
+.endif
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+	@${REINPLACE_CMD} -e 's/@GIT_BRANCH@/master/' \
+		-e 's/@GIT_DESC@/${GH_TAGNAME}/' \
+		-e 's/@BUILD_FULLNAME@/${DISTVERSION}/' \
+		${WRKSRC}/src/common/scm_rev.cpp.in
+
+.if defined(AZAHAR_SLAVE)
+do-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/libretro
+	${INSTALL_LIB} ${BUILD_WRKSRC}/bin/Release/${PORTNAME}_libretro.so \
+		${STAGEDIR}${PREFIX}/lib/libretro/
+.  for d in applications icons mime ${PORTNAME}
+	${RM} -r ${STAGEDIR}${PREFIX}/share/${d}
+.  endfor
+.else
+post-install:
+	${RM} ${STAGEDIR}${PREFIX}/lib/libcitra_room.a
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/emulators/azahar/distinfo b/emulators/azahar/distinfo
new file mode 100644
index 000000000000..5f603015908f
--- /dev/null
+++ b/emulators/azahar/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1790090044
+SHA256 (azahar-unified-source-2126.1.2.tar.xz) = ca0626312af68370e04c70b60eab4dd95e6f3f248d1d1c6a22ee784dfce6b361
+SIZE (azahar-unified-source-2126.1.2.tar.xz) = 43251244
diff --git a/emulators/azahar/files/patch-add_more_system_libs b/emulators/azahar/files/patch-add_more_system_libs
new file mode 100644
index 000000000000..f31ed4df3898
--- /dev/null
+++ b/emulators/azahar/files/patch-add_more_system_libs
@@ -0,0 +1,126 @@
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -105,7 +105,10 @@ foreach(_opt IN LISTS _LIBRETRO_INCOMPATIBLE_OPTIONS)
+ endforeach()
+ 
+ option(ENABLE_SDL2 "Enable using SDL2" ON)
++option(USE_SYSTEM_FAAD "Use the system faad2 lib (instead of the bundled one)" OFF)
+ option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OFF)
++option(USE_SYSTEM_SPIRV_TOOLS "Use the system SPIRV-Tools lib (instead of the bundled one)" OFF)
++option(USE_SYSTEM_XXHASH "Use the system xxHash lib (instead of the bundled one)" OFF)
+ 
+ # Set bundled qt as dependent options.
+ option(ENABLE_QT "Enable the Qt frontend" ON)
+@@ -541,6 +544,20 @@ if (USE_SYSTEM_SOUNDTOUCH)
+     target_include_directories(SoundTouch INTERFACE "${SOUNDTOUCH_INCLUDE_DIRS}")
+ endif()
+ 
++if (USE_SYSTEM_XXHASH)
++    find_package(PkgConfig)
++    if(PkgConfig_FOUND)
++	pkg_check_modules(libxxhash_PKGCONFIG IMPORTED_TARGET xxhash)
++    endif()
++endif()
++
++if (USE_SYSTEM_FAAD)
++    find_package(PkgConfig)
++    if(PkgConfig_FOUND)
++        pkg_check_modules(libfaad_PKGCONFIG IMPORTED_TARGET faad)
++    endif()
++endif()
++
+ add_subdirectory(src)
+ 
+ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT citra_meta)
+--- externals/CMakeLists.txt.orig
++++ externals/CMakeLists.txt
+@@ -176,7 +176,9 @@ endif()
+ add_subdirectory(open_source_archives)
+ 
+ # faad2
+-add_subdirectory(faad2 EXCLUDE_FROM_ALL)
++if(NOT USE_SYSTEM_FAAD)
++    add_subdirectory(faad2 EXCLUDE_FROM_ALL)
++endif()
+ 
+ # Dynamic library headers
+ add_library(library-headers INTERFACE)
+@@ -447,9 +449,12 @@ if (ENABLE_VULKAN)
+     endif()
+ 
+     # spirv-tools
+-    # TODO: Implement USE_SYSTEM_SPIRV_TOOLS -OS
+-    set(SPIRV_SKIP_EXECUTABLES ON)
+-    add_subdirectory(spirv-tools EXCLUDE_FROM_ALL)
++    if(USE_SYSTEM_SPIRV_TOOLS)
++        find_package(SPIRV-Tools REQUIRED)
++    else()
++        set(SPIRV_SKIP_EXECUTABLES ON)
++        add_subdirectory(spirv-tools EXCLUDE_FROM_ALL)
++    endif()
+ 
+     # glslang
+     if(USE_SYSTEM_GLSLANG)
+@@ -507,16 +512,18 @@ if (ENABLE_VULKAN)
+     endif()
+ endif()
+ 
+-set(XXHASH_BUILD_XXHSUM OFF)
+-add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
+-target_compile_definitions(xxhash PRIVATE XXH_FORCE_MEMORY_ACCESS=2)
+-if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
+-    target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_SSE2)
+-    message(STATUS "Enabling SSE2 for xxHash")
+-elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|armv8")
+-    target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_NEON)
+-    message(STATUS "Enabling NEON for xxHash")
+-else()
+-    target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_SCALAR)
+-    message(STATUS "Disabling SIMD for xxHash")
+-endif()
+\ No newline at end of file
++if(NOT USE_SYSTEM_XXHASH)
++    set(XXHASH_BUILD_XXHSUM OFF)
++    add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
++    target_compile_definitions(xxhash PRIVATE XXH_FORCE_MEMORY_ACCESS=2)
++    if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
++        target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_SSE2)
++        message(STATUS "Enabling SSE2 for xxHash")
++    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|armv8")
++        target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_NEON)
++        message(STATUS "Enabling NEON for xxHash")
++    else()
++        target_compile_definitions(xxhash PRIVATE XXH_VECTOR=XXH_SCALAR)
++        message(STATUS "Disabling SIMD for xxHash")
++    endif()
++endif()
+
+--- src/audio_core/CMakeLists.txt.orig
++++ src/audio_core/CMakeLists.txt
+@@ -45,7 +45,11 @@ add_library(audio_core STATIC
+ create_target_directory_groups(audio_core)
+ 
+ target_link_libraries(audio_core PUBLIC citra_common citra_core)
+-target_link_libraries(audio_core PRIVATE faad2 SoundTouch teakra)
++if(USE_SYSTEM_FAAD)
++    target_link_libraries(audio_core PRIVATE faad SoundTouch teakra)
++else()
++    target_link_libraries(audio_core PRIVATE faad2 SoundTouch teakra)
++endif()
+ 
+ if(ENABLE_SDL2)
+     target_link_libraries(audio_core PRIVATE SDL2::SDL2)
+
+--- src/common/CMakeLists.txt.orig
++++ src/common/CMakeLists.txt
+@@ -176,4 +176,8 @@ if (SSE42_COMPILE_OPTION)
+     target_compile_options(citra_common PRIVATE ${SSE42_COMPILE_OPTION})
+ endif()
+ 
+-target_link_libraries(citra_common PUBLIC xxHash::xxhash)
+\ No newline at end of file
++if (USE_SYSTEM_XXHASH)
++    target_link_libraries(citra_common PUBLIC xxhash)
++else()
++    target_link_libraries(citra_common PUBLIC xxHash::xxhash)
++endif()
diff --git a/emulators/azahar/files/patch-externals_teakra_src_test.h b/emulators/azahar/files/patch-externals_teakra_src_test.h
new file mode 100644
index 000000000000..96ceb0b0b4af
--- /dev/null
+++ b/emulators/azahar/files/patch-externals_teakra_src_test.h
@@ -0,0 +1,13 @@
+https://github.com/wwylele/teakra/pull/35
+
+--- externals/teakra/src/test.h.orig	2018-12-21 16:34:51 UTC
++++ externals/teakra/src/test.h
+@@ -31,7 +31,7 @@ static_assert(std::is_trivially_copyable_v<State>);
+ 
+ struct TestCase {
+     State before, after;
+-    u16 opcode, expand;
++    u16 opcode, expand, unused;
+ };
+ 
+ static_assert(sizeof(TestCase) == 4312);
diff --git a/emulators/azahar/pkg-descr b/emulators/azahar/pkg-descr
new file mode 100644
index 000000000000..5ca3e8fb7308
--- /dev/null
+++ b/emulators/azahar/pkg-descr
@@ -0,0 +1 @@
+Azahar is an open-source 3DS emulator project based on Citra.
diff --git a/emulators/azahar/pkg-message b/emulators/azahar/pkg-message
new file mode 100644
index 000000000000..25df0fb62f05
--- /dev/null
+++ b/emulators/azahar/pkg-message
@@ -0,0 +1,9 @@
+[
+{ type: install
+  message: <<EOM
+Known issues:
+- The video dumper doesn't work on Linux or FreeBSD.
+  See https://github.com/azahar-emu/azahar/issues/2404
+EOM
+}
+]
diff --git a/emulators/azahar/pkg-plist b/emulators/azahar/pkg-plist
new file mode 100644
index 000000000000..70397fdcd61c
--- /dev/null
+++ b/emulators/azahar/pkg-plist
@@ -0,0 +1,6 @@
+bin/azahar
+bin/azahar-room
+share/applications/org.azahar_emu.Azahar.desktop
+share/icons/hicolor/512x512/apps/org.azahar_emu.Azahar.png
+share/icons/hicolor/scalable/apps/org.azahar_emu.Azahar.svg
+share/mime/packages/org.azahar_emu.Azahar.xml
diff --git a/emulators/libretro-azahar/Makefile b/emulators/libretro-azahar/Makefile
new file mode 100644
index 000000000000..6da55352594c
--- /dev/null
+++ b/emulators/libretro-azahar/Makefile
@@ -0,0 +1,14 @@
+PORTNAME=	azahar
+PKGNAMEPREFIX=	libretro-
+
+COMMENT=	Libretro core for Azahar 3DS emulator
+MASTERDIR=	${.CURDIR}/../azahar
+
+AZAHAR_SLAVE=	libretro
+
+PLIST=
+PLIST_FILES=	lib/libretro/${PORTNAME}_libretro.so
+
+OPTIONS_DEFINE=	
+
+.include "${MASTERDIR}/Makefile"