A lot of changes

Refactor Build guide
Add build script
Switch to Native VS
Fix Redists
Auto Detect and Use max threads for build
This commit is contained in:
EAZYBLACK 2026-09-13 01:51:43 +03:00
commit ca9cf2a080
7 changed files with 191 additions and 75 deletions

3
.gitignore vendored
View file

@ -131,3 +131,6 @@ lextab.py
# tup database
/.tup
# build script stuff
.redist-stage-*

View file

@ -102,6 +102,7 @@
@BINPATH@/@MSVC_C_RUNTIME_DLL@
@BINPATH@/@MSVC_CMP_RUNTIME_DLL@
@BINPATH@/@MSVC_CXX_RUNTIME_DLL@
@BINPATH@/concrt140.dll
#endif
#if MOZ_PACKAGE_WIN_UCRT_DLLS
@BINPATH@/api-ms-win-*.dll

97
build-msvc-win Normal file
View file

@ -0,0 +1,97 @@
#!/bin/bash
set -e
win_to_msys() {
echo "$1" | sed 's|\\|/|g; s|^\([A-Za-z]\):/|/\1/|' | tr 'A-Z' 'a-z' | sed 's|^/\([a-z]\)/|\1:/|; s|^\([a-z]\):/|/\1/|'
}
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
case "$BUILD_ARCH" in
x64) MOZCONFIG_NAME="uxp-win64-msvc" ; REDIST_ARCH="x64" ;;
x86) MOZCONFIG_NAME="uxp-win32-msvc" ; REDIST_ARCH="x86" ;;
*)
echo "[build] BUILD_ARCH is not set or not x64/x86, Make sure you run the dactyl msvc shell first."
exit 1
;;
esac
MOZCONFIG_SRC="$SCRIPT_DIR/mozconfigs/windows/$MOZCONFIG_NAME"
MOZCONFIG_DST="$SCRIPT_DIR/.mozconfig"
if [ ! -f "$MOZCONFIG_SRC" ]; then
echo "[build] ERROR: Mozconfig not found: $MOZCONFIG_SRC"
exit 1
fi
echo "[build] Architecture : $BUILD_ARCH"
echo "[build] Mozconfig : mozconfigs/windows/$MOZCONFIG_NAME"
cp "$MOZCONFIG_SRC" "$MOZCONFIG_DST"
echo "[build] Copied to : .mozconfig"
if [ -z "$VCINSTALLDIR" ]; then
echo "[build] ERROR: VCINSTALLDIR is not set. Make sure you run the dactyl msvc shell first."
exit 1
fi
REDIST_BASE="$(win_to_msys "$VCINSTALLDIR")/Redist/MSVC"
echo "[build] VC install : $VCINSTALLDIR"
if [ ! -d "$REDIST_BASE" ]; then
echo "[build] ERROR: VC redist not found at $REDIST_BASE"
exit 1
fi
REDIST_VER=""
for DIR in "$REDIST_BASE"/14.16.*; do
[ -d "$DIR" ] && REDIST_VER="$DIR" && break
done
if [ -z "$REDIST_VER" ]; then
echo "[build] ERROR: No VS2017 redist found under $REDIST_BASE"
exit 1
fi
STAGING_DIR="$SCRIPT_DIR/.redist-stage-$REDIST_ARCH"
mkdir -p "$STAGING_DIR"
for SUBDIR in Microsoft.VC141.CRT Microsoft.VC141.OPENMP; do
SRC="$REDIST_VER/$REDIST_ARCH/$SUBDIR"
if [ -d "$SRC" ]; then
echo "[build] <- $SUBDIR"
cp -u "$SRC"/*.dll "$STAGING_DIR/"
else
echo "[build] WARNING: Redist Dlls not found, skipping."
fi
done
if [ -z "$UNIVERSALCRTSDKDIR" ]; then
echo "[build] ERROR: CRT SDK Dir ENV is not set. Make sure you run the dactyl msvc shell first."
exit 1
fi
UCRT_DIR="$(win_to_msys "$UNIVERSALCRTSDKDIR")/Redist/ucrt/DLLs/$REDIST_ARCH"
if [ -d "$UCRT_DIR" ]; then
echo "[build] <- ucrt ($UCRT_DIR)"
cp -u "$UCRT_DIR"/*.dll "$STAGING_DIR/"
else
echo "[build] WARNING: UCRT redist not found at $UCRT_DIR"
fi
# workaround: Default ucrtbase doesnt work on Windows 2000 for some reason but newer does.
UCRT19041_FILE="$(win_to_msys "$UNIVERSALCRTSDKDIR")/Redist/10.0.19041.0/ucrt/DLLs/$REDIST_ARCH/ucrtbase.dll"
if [ -f "$UCRT19041_FILE" ]; then
echo "[build] 19041 ucrtbase applied"
cp -u "$UCRT19041_FILE" "$STAGING_DIR/"
else
echo "[build] WARNING: 19041 ucrtbase not found for Windows 2000 Compat"
fi
export WIN32_REDIST_DIR="$STAGING_DIR"
export WIN_UCRT_REDIST_DIR="$STAGING_DIR"
echo "[build] Starting build..."
./mach build
case "$BUILD_ARCH" in
x64) OBJ_DIR="obj-x86_64-pc-mingw32" ;;
x86) OBJ_DIR="obj-i686-pc-mingw32" ;;
esac
cp "$STAGING_DIR/concrt140.dll" "$SCRIPT_DIR/$OBJ_DIR/dist/bin/"

42
docs/build/windows.md vendored
View file

@ -1,37 +1,29 @@
# How to compile Dactyloidae (as of version 13.2)
# How to compile Dactyloidae
Step 0. INSTALL GIT FOR WINDOWS!!!!!
Step 1. Install Git for Windows (win7 users should install 2.46.2)
Step 1. If you are on Windows 8.1 or older, mount your installation media.
Step 2. Enable .NET 3.5 in optionalfeatures.exe\
NOTE: Win8 users may need to use this https://github.com/abbodi1406/dotNetFx35W81
Step 2. Go Win+R and type 'optionalfeatures.exe' and check .NET 3.5
Step 3. Install VS 2019 Community with Desktop Developement with C++ and "C++ Windows XP Support for VS 2017 (v141)\
and MSVC v141 - VS 2017 C++ x64/x86 build tools (v14.16)\
Make sure you also get 10.0.19041 sdk
Step 3. Get the DirectX SDK (June 2010) from HERE: https://archive.org/details/dxsdk_jun10
Step 4. Get the DirectX SDK https://www.microsoft.com/en-us/download/details.aspx?id=6812\
(NOTE if you get a S2023 error in the end you can safely ignore it)
Step 4. After that has installed, get MozillaBuild 3.2 from HERE: https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-3.2.exe
Step 5. Get and Install MozillaBuild from here https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-3.2.exe
Step 5. After THAT has installed, you can commence onto installing the FWDK. First, get the .7z HERE: https://archive.org/details/funny-windows-development-kit
Step 6. Copy shell-msvc-dactyl.bat from docs folder to your mozilla-build directory (usually at C:\mozilla-build)
Step 6. Extract the FWDK to C:\Dev
Step 7. Run shell-msvc-dactyl.bat from the mozilla-build directory.
Step 7. Move the start-shell-ewdk and start-shell-ewdk-x64 from this folder into c:\mozilla-build.
Step 8. Select the architecture that you want to build Dactyloidae for
Step 8. Now that you have done all those prerequisites, open your start-shell-ewdk (64 if you want to build a 64 bit browser)
Step 9. CD to the Repo (msys uses unix style dirs, c:\ is /c/ for example)
Step 9. Git clone this repo if you have not already
Step 10. Run ./build-msvc-win
Step 10. CD into the directory of where your git clone is, and execute THESE commands:
Step 10.5. After the build, if you really feel fancy, you can test your build before packaging it with ``./mach run``
``git config core.autocrlf false``
``git config core.eof lf``
``git rm --cached -r .``
``git reset --hard``
Step 11. Now that you have FINALLY done all those, you are now free to do a ``./mach build`` (isn't mozillabuild fun?)
Step 11.5. After the build, if you really feel fancy, you can test your build before packaging it with ``./mach run``
Step 12. Run ``./mach installer `` (64-bit only for now, sorry)
Step 11. Run ``./mach installer`` (if you want to build an installer)

View file

@ -0,0 +1,73 @@
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET CYGWIN=
SET INCLUDE=
SET LIB=
IF NOT DEFINED MOZ_NO_RESET_PATH (
SET PATH=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0
)
SET MOZILLABUILD=%~dp0
SET WINCURVERKEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
REG QUERY "%WINCURVERKEY%" /v "ProgramFilesDir (x86)" >nul 2>nul
IF NOT ERRORLEVEL 1 (
SET WIN64=1
) ELSE (
SET WIN64=0
)
SET BUILD_ARCH=
:ASK_ARCH
ECHO.
ECHO What architecture will you build for?
ECHO [1] 64-bit
ECHO [2] 32-bit
ECHO.
SET /P ARCH_CHOICE="Enter 1 or 2: "
IF "!ARCH_CHOICE!" == "1" (
SET BUILD_ARCH=x64
) ELSE IF "!ARCH_CHOICE!" == "2" (
SET BUILD_ARCH=x86
) ELSE (
ECHO Invalid choice. Please enter 1 or 2.
GOTO :ASK_ARCH
)
ECHO Target architecture: !BUILD_ARCH!
SET VCVARSALL=
SET VS2019_BASE=%ProgramFiles(x86)%\Microsoft Visual Studio\2019
IF EXIST "!VS2019_BASE!\Community\VC\Auxiliary\Build\vcvarsall.bat" (
SET VCVARSALL=!VS2019_BASE!\Community\VC\Auxiliary\Build\vcvarsall.bat
SET VS2019_EDITION=Community
) ELSE IF EXIST "!VS2019_BASE!\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
SET VCVARSALL=!VS2019_BASE!\Professional\VC\Auxiliary\Build\vcvarsall.bat
SET VS2019_EDITION=Professional
) ELSE IF EXIST "!VS2019_BASE!\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
SET VCVARSALL=!VS2019_BASE!\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
SET VS2019_EDITION=Enterprise
) ELSE IF EXIST "!VS2019_BASE!\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
SET VCVARSALL=!VS2019_BASE!\BuildTools\VC\Auxiliary\Build\vcvarsall.bat
SET VS2019_EDITION=BuildTools
)
CALL "!VCVARSALL!" !BUILD_ARCH! -vcvars_ver=14.16
IF ERRORLEVEL 1 (
ECHO vcvarsall.bat failed.
ECHO Ensure the v141 + v141 xp toolset is installed via the
ECHO VS 2019 installer ^(Individual components tab^).
pause
exit
)
ECHO Build environment ready.
REM ============================================================
REM Launch shell
REM ============================================================
START %MOZILLABUILD%msys\bin\mintty -e %MOZILLABUILD%msys\bin\console %MOZILLABUILD%msys\bin\bash --login
EXIT /B

View file

@ -1,25 +0,0 @@
@ECHO OFF
SET MOZ_MSVCBITS=64
SET MOZ_MSVCVERSION=14
SET MOZ_MSVCYEAR=2017
SET VCDIR=C:\DEV\MSVC14\
SET TOOLCHAIN=64-bit
SET MOZILLABUILD=%~dp0
SET MOZ_TOOLS=%MOZILLABUILD%moztools
SET VSINSTALLDIR=C:\DEV\MSVC14
SET VCINSTALLDIR=C:\DEV\MSVC14
SET FrameworkDir32=C:\Windows\Microsoft.NET\Framework\
SET FrameworkVersion32=v4.0.30319
SET Framework40Version=v4.0.30319
SET UCRTVersion=10.0.19041.0
SET WindowsSDKLibVersion=10.0.19041.0\
SET INCLUDE=C:\Dev\MSVC14\include;C:\Dev\MSVC14\atlmfc\include;C:\Dev\Windows Kits\10\include\shared;C:\Dev\Windows Kits\10\include\10.0.19041.0\um;C:\Dev\Windows Kits\10\include\10.0.19041.0\winrt;C:\Dev\Windows Kits\10\include\10.0.19041.0\ucrt;
SET LIB=C:\Dev\MSVC14\lib\x64;C:\Dev\MSVC14\atlmfc\lib\x64;C:\Dev\Windows Kits\10\lib\10.0.19041.0\um\x64;C:\Dev\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;
SET LIBPATH=C:\Dev\MSVC14\lib\x64;C:\Dev\MSVC14\atlmfc\lib\x64;C:\Dev\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;
SET PATH=C:\Dev\MSVC14\bin\Hostx64\x64;C:\Dev\MSVC14\bin\Hostx64\x64;C:\Dev\Windows Kits\10\bin\10.0.19041.0\x64;%PATH%
SET SDKDIR=C:\Dev\Windows Kits\10\
SET WINDOWSSDKDIR=C:\Dev\Windows Kits\10\
set "UCRTContentRoot=%WDKContentRoot%"
set "UniversalCRTSdkDir=%WDKContentRoot%"
START %MOZILLABUILD%msys\bin\mintty -e %MOZILLABUILD%msys\bin\console %MOZILLABUILD%msys\bin\bash --login

View file

@ -1,25 +0,0 @@
@ECHO OFF
SET MOZ_MSVCBITS=32
SET MOZ_MSVCVERSION=14
SET MOZ_MSVCYEAR=2017
SET VCDIR=C:\DEV\MSVC14\
SET TOOLCHAIN=32-bit
SET MOZILLABUILD=%~dp0
SET MOZ_TOOLS=%MOZILLABUILD%moztools
SET VSINSTALLDIR=C:\DEV\MSVC14
SET VCINSTALLDIR=C:\DEV\MSVC14
SET FrameworkDir32=C:\Windows\Microsoft.NET\Framework\
SET FrameworkVersion32=v4.0.30319
SET Framework40Version=v4.0.30319
SET UCRTVersion=10.0.19041.0
SET WindowsSDKLibVersion=10.0.19041.0\
SET INCLUDE=C:\Dev\MSVC14\include;C:\Dev\MSVC14\atlmfc\include;C:\Dev\Windows Kits\10\include\shared;C:\Dev\Windows Kits\10\include\10.0.19041.0\um;C:\Dev\Windows Kits\10\include\10.0.19041.0\winrt;C:\Dev\Windows Kits\10\include\10.0.19041.0\ucrt;
SET LIB=C:\Dev\MSVC14\lib\x86;C:\Dev\MSVC14\atlmfc\lib\x86;C:\Dev\Windows Kits\10\lib\10.0.19041.0\um\x86;C:\Dev\Windows Kits\10\lib\10.0.19041.0\ucrt\x86;
SET LIBPATH=C:\Dev\MSVC14\lib\x86;C:\Dev\MSVC14\atlmfc\lib\x86;C:\Dev\Windows Kits\10\lib\10.0.19041.0\ucrt\x86;
SET PATH=C:\Dev\MSVC14\bin\Hostx64\x86;C:\Dev\MSVC14\bin\Hostx64\x64;C:\Dev\Windows Kits\10\bin\10.0.19041.0\x86;%PATH%
SET SDKDIR=C:\Dev\Windows Kits\10\
SET WINDOWSSDKDIR=C:\Dev\Windows Kits\10\
set "UCRTContentRoot=%WDKContentRoot%"
set "UniversalCRTSdkDir=%WDKContentRoot%"
START %MOZILLABUILD%msys\bin\mintty -e %MOZILLABUILD%msys\bin\console %MOZILLABUILD%msys\bin\bash --login