diff --git a/.gitmodules b/.gitmodules index 26db2c7..9cc2792 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "Dependencies/Actions.Library"] path = Dependencies/Actions.Library url = https://github.com/L-proger/Actions.Library.git +[submodule "Dependencies/subversion"] + path = Dependencies/subversion + url = https://github.com/apache/subversion.git diff --git a/Build/Dependencies.cs b/Build/Dependencies.cs index 65341d0..2fb3e3f 100644 --- a/Build/Dependencies.cs +++ b/Build/Dependencies.cs @@ -81,7 +81,7 @@ namespace Build { } public static async Task GetSubversion(string projectRootDir) { - return Path.GetFullPath(Path.Combine(projectRootDir, "..", "subversion")); + return Path.GetFullPath(Path.Combine(projectRootDir, "Dependencies", "subversion")); } } } diff --git a/Build/Program.cs b/Build/Program.cs index be09937..4e1c4ab 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -56,7 +56,7 @@ class Application { } - static void BuildApr(string source, string installDir) { + static string BuildApr(string source, string installDir) { var tmpDir = TempDirectory.New(); var cmake = Find.Executable("cmake"); @@ -66,6 +66,7 @@ class Application { var configResult = cmake.Run($"-DCMAKE_INSTALL_PREFIX={installPrefix} -G \"Ninja\" -DAPR_INSTALL_PRIVATE_H=ON -DCMAKE_BUILD_TYPE=RELEASE -DAPR_BUILD_STATIC=ON {source}", tmpDir); var buildResult = ninja.Run("", tmpDir); var installResult = ninja.Run("install", tmpDir); + return installPrefix; } static void BuildAprUtil(string source, string expatLibDir, string installDir) { @@ -123,14 +124,26 @@ class Application { File.WriteAllText(sconstructPath, text); } - static void BuildSubversion(string svnSource, string sqlSource, string installDir) { + static void CopyLibraries(string srcBinlDir, string svnInstallDir) { + string svnBinDir = Path.Combine(svnInstallDir, "bin"); + + string[] srcFiles = Directory.GetFiles(srcBinlDir).Where(x=>x.EndsWith(".dll")).ToArray(); + foreach(var file in srcFiles) { + var fileName = Path.GetFileName(file); + var dstPath = Path.Combine(svnBinDir, fileName); + File.Copy(file, dstPath, true); + } + + } + + static string BuildSubversion(string svnSource, string sqlSource, string installDir, string expatDir) { var aprPath = Path.Combine(installDir, "apr").Replace("\\", "/"); var serfPath = Path.Combine(installDir, "serf").Replace("\\", "/"); var zlibPath = Path.Combine(installDir, "zlib").Replace("\\", "/"); var opensslPath = Path.Combine(installDir, "openssl").Replace("\\", "/"); string libPaths = $"{aprPath};{serfPath};{zlibPath}"; - string expatBinDir = "e:/SvnDeps/expat/Bin"; - string expatIncDir = "e:/SvnDeps/expat/Source/lib"; + string expatBinDir = Path.Combine(expatDir,"Bin"); + string expatIncDir = Path.Combine(expatDir, "Source/lib"); string installPrefix = Path.Combine(installDir, "subversion"); List args = new List(); @@ -160,15 +173,20 @@ class Application { var buildResult = ninja.Run("", tmpDir); var installResult = ninja.Run("install", tmpDir); + + return installPrefix; } public static async Task Main() { VisualStudio.SetupEnvironment(CpuArchitecture.x64); var projectRootDir = GetProjectRootDir(); - var depsSourceDirectory = Path.Combine(projectRootDir, "DependenciesSource"); + + + var depsSourceDirectory = Path.Combine(projectRootDir, "Downloads"); Directory.CreateDirectory(depsSourceDirectory); - var depsBuildDirectory = Path.Combine(projectRootDir, "DependenciesBuild"); + var tempDir = TempDirectory.New(); + var depsBuildDirectory = Path.Combine(tempDir, "DependenciesBuild"); Directory.CreateDirectory(depsBuildDirectory); var svn = await Dependencies.GetSubversion(projectRootDir); @@ -182,12 +200,18 @@ class Application { BuildOpenssl(openssl, depsBuildDirectory); BuildZLib(zLib, depsBuildDirectory); - BuildApr(apr, depsBuildDirectory); + var aprInstallDir = BuildApr(apr, depsBuildDirectory); BuildAprUtil(aprUtil, expat, depsBuildDirectory); FixAprForSerf(depsBuildDirectory); PatchSerf(serf); BuildSerf(serf, depsBuildDirectory); - BuildSubversion(svn, sqLite, depsBuildDirectory); + var svnInstallDir = BuildSubversion(svn, sqLite, tempDir, expat); + + CopyLibraries(Path.Combine(aprInstallDir, "bin"), svnInstallDir); + CopyLibraries(Path.Combine(expat, "Bin"), svnInstallDir); + CopyLibraries(Path.Combine(openssl, "bin"), svnInstallDir); + + Console.WriteLine($"SVN install directory: {svnInstallDir}"); return 0; } diff --git a/Dependencies/subversion b/Dependencies/subversion new file mode 160000 index 0000000..37969e1 --- /dev/null +++ b/Dependencies/subversion @@ -0,0 +1 @@ +Subproject commit 37969e10a574047eb9bf6e3f56e019486fb5db59 diff --git a/FetchDependencies.ps1 b/FetchDependencies.ps1 deleted file mode 100644 index 8dd184b..0000000 --- a/FetchDependencies.ps1 +++ /dev/null @@ -1,155 +0,0 @@ - -$APR_VERSION="1.7.5" -$APU_VERSION="1.6.3" -$PY3C_VERSION="1.1" -$SERF_VERSION="1.3.10" -$ZLIB_VERSION="1.2.8" -$SQLITE_VERSION="3.39.4" - -# Used to construct the SQLite download URL. -$SQLITE_VERSION_REL_YEAR=2022 -$HTTPD_VERSION="2.4.10" -$APR_ICONV_VERSION="1.2.1" - -$APR="apr-$APR_VERSION" -$APR_UTIL="apr-util-$APU_VERSION" -$PY3C="py3c-$PY3C_VERSION" -$SERF="serf-$SERF_VERSION" -$ZLIB="zlib-$ZLIB_VERSION" - - -$SQLITE_VERSION_LIST= $SQLITE_VERSION.Split(".") -$SQLITE=[string]::Format("sqlite-amalgamation-{0}{1}{2}00", $SQLITE_VERSION_LIST[0], $SQLITE_VERSION_LIST[1].PadLeft(2, '0'), $SQLITE_VERSION_LIST[2].PadLeft(2, '0')) - - -$BASEDIR=$PSScriptRoot -$TEMPDIR="$BASEDIR/temp" -$APACHE_MIRROR="https://archive.apache.org/dist" - -New-Item -ItemType Directory -Force -Path "$TEMPDIR" - -function DownloadFile { - param ( $Src, $Dst ) - if(-Not (Test-Path "$Dst" -PathType Leaf)){ - Invoke-WebRequest "$Src" -OutFile "$Dst" - } -} - -function extractTarBz2{ - param ( $Src ) - 7z x -y "$Src" - - $srcFile = Get-ChildItem "$Src" - $tarFile = $srcFile.BaseName - Write-Host "TAR file name: $tarFile" - 7z x -y "$tarFile" -} - - -function extractTarGzip{ - param ( $Src ) - 7z x -tgzip -y "$Src" - - $srcFile = Get-ChildItem "$Src" - $tarFile = $srcFile.BaseName - Write-Host "TAR file name: $tarFile" - 7z x -y "$tarFile" -} - - -function moveDir{ - param ( $Src, $Dst ) - if (Test-Path -LiteralPath $Dst) { - Remove-Item -LiteralPath $Dst -Recurse - } - Move-Item -Path $Src -Destination "$Dst" -force -} - -function getApr { - Set-Location $TEMPDIR - - DownloadFile -Src "$APACHE_MIRROR/apr/$APR.tar.bz2" -Dst "$APR.tar.bz2" - extractTarBz2 -Src "$APR.tar.bz2" - moveDir -Src $APR -Dst "$BASEDIR/apr" - - DownloadFile -Src "$APACHE_MIRROR/apr/$APR_UTIL.tar.bz2" -Dst "$APR_UTIL.tar.bz2" - extractTarBz2 -Src "$APR_UTIL.tar.bz2" - moveDir -Src $APR_UTIL -Dst "$BASEDIR/apr-util" - - Set-Location $BASEDIR -} - -function getZlib() { - Set-Location $TEMPDIR - DownloadFile -Src "https://github.com/madler/zlib/archive/refs/tags/v$ZLIB_VERSION.tar.gz" -Dst "$ZLIB.tar.gz" - extractTarGzip -Src "$ZLIB.tar.gz" - - moveDir -Src $ZLIB -Dst "$BASEDIR/zlib" - Set-Location $BASEDIR -} - -function getSqlite() { - Set-Location $TEMPDIR - Write-Host "!!!! https://www.sqlite.org/$SQLITE_VERSION_REL_YEAR/$SQLITE.zip" - DownloadFile -Src "https://www.sqlite.org/$SQLITE_VERSION_REL_YEAR/$SQLITE.zip" -Dst "$SQLITE.zip" - Expand-Archive "$SQLITE.zip" -Force -DestinationPath "./" - moveDir -Src $SQLITE -Dst "$BASEDIR/sqlite-amalgamation" - Set-Location $BASEDIR -} - -function getSerf() { - Set-Location $TEMPDIR - DownloadFile -Src "https://archive.apache.org/dist/serf/$SERF.tar.bz2" -Dst "$SERF.tar.bz2" - extractTarBz2 -Src "$SERF.tar.bz2" - moveDir -Src $SERF -Dst "$BASEDIR/serf" - Set-Location $BASEDIR -} - - -function getExpat() { - Set-Location $TEMPDIR - DownloadFile -Src "https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.bz2" -Dst "expat-2.2.9.tar.bz2" - extractTarBz2 -Src "expat-2.2.9.tar.bz2" - moveDir -Src "expat-2.2.9" -Dst "$BASEDIR/expat" - Set-Location $BASEDIR -} - - -function getOpenssl() { - Set-Location $TEMPDIR - DownloadFile -Src "https://github.com/openssl/openssl/releases/download/openssl-3.2.3/openssl-3.2.3.tar.gz" -Dst "openssl-3.2.3.tar.gz" - extractTarGzip -Src "openssl-3.2.3.tar.gz" - moveDir -Src "openssl-3.2.3" -Dst "$BASEDIR/openssl" - Set-Location $BASEDIR -} - - - - -# function getPy3C -# { -# $py3cdist="v${PY3C_VERSION}.tar.gz" -# Set-Location $TEMPDIR -# DownloadFile -Src "https://github.com/encukou/py3c/archive/$py3cdist" -Dst "$py3cdist" - -# extractTarBz2 -Src "$py3cdist" -# moveDir -Src $PY3C -Dst "$BASEDIR/py3c" - -# Set-Location $BASEDIR -# } - -#getOpenssl -#getExpat -#getSqlite -#getZlib -getApr -getSerf - - - - -#getPy3C - - -Remove-Item -LiteralPath $TEMPDIR -Recurse -Write-Host "Done!" \ No newline at end of file diff --git a/README.md b/README.md index 8b53fc0..ef4ab1a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ sudo make install ``` # Windows build +## Install programs +1. Install Python3: https://www.python.org/downloads/ +2. Install scons: `pip install scons` +3. Install (for OpenSSL): https://strawberryperl.com/ +4. Install (for OpenSSL): https://www.nasm.us/ https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/win64/nasm-2.16.03-installer-x64.exe + + ## Download expat ``` https://sourceforge.net/projects/expat/files/expat_win64/2.6.4/expat-win64bin-2.6.4.exe/download @@ -37,8 +44,6 @@ cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=e:/SvnDeps/zlib -DCMAKE_BUILD_TYPE=RELEA ## Build Openssl ``` -Install https://strawberryperl.com/ -Install https://www.nasm.us/ https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/win64/nasm-2.16.03-installer-x64.exe perl Configure VC-WIN64A --prefix=e:/SvnDeps/openssl --openssldir=e:/SvnDeps/openssl nmake nmake install