Skip to content

Commit

Permalink
Fixed the _write bug with proper codegen modification
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchcapper committed Dec 19, 2024
1 parent e7140a8 commit 8541657
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/do_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ jobs:
key: gnulib-bare
enableCrossOsArchive: true

- name: MSBuild Setup
uses: microsoft/[email protected]
if: matrix.platform == 'windows'

- name: Move Bad DEFAULT MSYS
shell: powershell
run: Rename-Item c:/msys64 c:/trashmsys
Expand Down Expand Up @@ -144,10 +140,17 @@ jobs:
- name: Unpack / Move Artifacts
if: ${{ inputs.RequiredDeps != '' && inputs.BuildPkg != 'script' }}
run: ${{env.WLB_SCRIPT_FOLDER}}/.github/move_dl_artifacts.ps1

- name: VSLatest Build Tools Install
if: ${{ inputs.InstallLatestVSTools }}
run: ${{env.WLB_SCRIPT_FOLDER}}/vs_buildtools_installer.ps1
run: ${{env.WLB_SCRIPT_FOLDER}}/vs_buildtools_installer.ps1 -install_path d:/vstools

- name: MSBuild Setup
uses: microsoft/[email protected]
if: matrix.platform == 'windows'
with:
vs-prerelease: true
msbuild-architecture: x64

- name: Build Package
if: ${{ inputs.BuildPkg != 'script' }}
Expand Down
17 changes: 9 additions & 8 deletions build/f_gnutls_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BLD_CONFIG_BUILD_ADDL_CFLAGS=( "-I../gl/" )
BLD_CONFIG_BUILD_ADDL_CFLAGS_STATIC=("-DASN1_STATIC")
BLD_CONFIG_OUR_LIB_DEPS=("libtasn1" "p11-kit" "zlib")
BLD_CONFIG_OUR_LIB_BINS_PATH=("libtasn1")
BLD_CONFIG_BUILD_MSVC_IGNORE_WARNINGS=( "4068" "4061" "4820" "5045" "4668" )
BLD_CONFIG_BUILD_MSVC_IGNORE_WARNINGS=( "4068" "4061" "4820" "5045" "4668" "4996" )

# BLD_CONFIG_BUILD_FOLDER_NAME="myapp2"; #if you want it compiling in a diff folder
# BLD_CONFIG_BUILD_DEBUG=1
Expand All @@ -29,6 +29,13 @@ fi

if [[ -z $SKIP_STEP || $SKIP_STEP == "our_patch" ]]; then
apply_our_repo_patch; # Applies from patches folder repo_BUILD_NAME.patch to the sources
P11_FILE="cligen/cligen/code.py"
if [[ -e "${P11_FILE}" ]]; then
if grep -q "^struct {struct_name} {global_name};" "${P11_FILE}"; then
ex sed -i -E 's/^struct \{struct_name\} \{global_name\};/struct {struct_name} {global_name} ;\n#undef write/' "${P11_FILE}" # fix issue where write is refined to _write but then .write on a struct has problems
echo "Fixed ${P11_FILE} for _write bug"
fi
fi
fi

if [[ $BLD_CONFIG_GNU_LIBS_USED -eq "1" ]]; then
Expand Down Expand Up @@ -72,13 +79,7 @@ fi
else
setup_build_env;
fi
P11_FILE="src/p11tool-options.c"
if [[ -e "${P11_FILE}" ]]; then
if grep -Fq " p11tool_options;" "${P11_FILE}"; then
sed -i -E 's/ p11tool_options;/ p11tool_options ;\n#undef write/' "${P11_FILE}" # fix issue where write is refined to _write but then .write on a struct has problems
echo "Fixed ${P11_FILE} for _write bug"
fi
fi


run_make
make_install
Expand Down
5 changes: 4 additions & 1 deletion vs_buildtools_installer.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
param (
[string] $install_path="c:/Program Files/vs_buildtools"
)

Set-StrictMode -version latest;
$ErrorActionPreference = "Stop";
param ($install_path="c:/Program Files/vs_buildtools")
$installer=Get-ChildItem ([IO.Path]::GetTempFileName()) | Rename-Item -NewName { [IO.Path]::ChangeExtension($_, ".exe") } -PassThru
Invoke-WebRequest 'https://aka.ms/vs/17/pre/vs_buildtools.exe' -OutFile $installer
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
Expand Down
3 changes: 2 additions & 1 deletion vs_msys_shell_launch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ if (! $env:VS_ENV_INITIALIZED) {
$instances=Get-CimInstance MSFT_VSInstance -Namespace root/cimv2/vs;
$VS_INSTANCE = $instances[0]
foreach ($instance in $instances) {
if ( [System.Version]$VS_INSTANCE.Version -gt [System.Version]$instance.Version ) {
if ( [System.Version]$VS_INSTANCE.Version -lt [System.Version]$instance.Version ) {
$VS_INSTANCE=$instance;
}
}
$VS_DEV_SHELL_PATH="$($VS_INSTANCE.InstallLocation)/Common7/Tools/Microsoft.VisualStudio.DevShell.dll";
$VS_INSTANCE_ID=$VS_INSTANCE.IdentifyingNumber;
$env:VS_ENV_INITIALIZED=1;
Write-Host "Starting msys shell with VS tools from: $($VS_INSTANCE.ProductLocation)"
Import-Module $VS_DEV_SHELL_PATH;
Enter-VsDevShell $VS_INSTANCE_ID -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64";
}
Expand Down

0 comments on commit 8541657

Please sign in to comment.