From 481a6b701f471ea4c0f5d0f3d247bfebd9fabc80 Mon Sep 17 00:00:00 2001 From: cathugger Date: Mon, 16 May 2022 21:17:50 +0000 Subject: [PATCH] fix win side, add incomplete build script --- contrib/winbuild/.gitignore | 3 +++ contrib/winbuild/buildwin.sh | 33 +++++++++++++++++++++++++++++++++ ioutil.c | 10 +++++----- 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 contrib/winbuild/.gitignore create mode 100755 contrib/winbuild/buildwin.sh diff --git a/contrib/winbuild/.gitignore b/contrib/winbuild/.gitignore new file mode 100644 index 0000000..6b0e2e7 --- /dev/null +++ b/contrib/winbuild/.gitignore @@ -0,0 +1,3 @@ +/winepfx +/x86_64 +/i686 diff --git a/contrib/winbuild/buildwin.sh b/contrib/winbuild/buildwin.sh new file mode 100755 index 0000000..a321dd8 --- /dev/null +++ b/contrib/winbuild/buildwin.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -e + +D=$(realpath "$0") +D=$(dirname "$D") +cd "$D" + +export WINEARCH=win64 +export WINEPREFIX=$(realpath ./winepfx) +OPATH=$PATH + +for w in x86_64 i686 +do + rm -rf "$w" + mkdir "$w" + cd "$w" + p=$w-w64-mingw32 + + case $w in + i686) + CFLAGS="-march=i686 -mtune=generic" + ;; + x86_64) + CFLAGS="-march=x86-64 -mtune=generic" + ;; + esac + CFLAGS="-O3 $CFLAGS -fomit-frame-pointer" + + export PATH=/usr/$p/bin:$PATH + ../../../configure --enable-regex --enable-donna CC="$p-gcc" CFLAGS="$CFLAGS" + make + cd .. +done diff --git a/ioutil.c b/ioutil.c index cc430df..6ec260a 100644 --- a/ioutil.c +++ b/ioutil.c @@ -218,9 +218,9 @@ int createdir(const char *path,int secret) return CreateDirectoryA(path,0) ? 0 : -1; } -static int syncwritefile(const char *filename,const char *tmpname,int secret,const char *data,size_t datalen) +static int syncwritefile(const char *filename,const char *tmpname,int secret,const u8 *data,size_t datalen) { - FH f = createfile(tmpnamestr,secret) + FH f = createfile(tmpname,secret); if (f == FH_invalid) return -1; @@ -236,7 +236,7 @@ static int syncwritefile(const char *filename,const char *tmpname,int secret,con goto failrm; } - if (MoveFileA(tmpnamestr,filename) == 0) { + if (MoveFileA(tmpname,filename) == 0) { goto failrm; } @@ -245,12 +245,12 @@ static int syncwritefile(const char *filename,const char *tmpname,int secret,con failclose: (void) closefile(f); failrm: - remove(tmpnamestr); + remove(tmpname); return -1; } -int syncwrite(const char *filename,int secret,const char *data,size_t datalen) +int syncwrite(const char *filename,int secret,const u8 *data,size_t datalen) { size_t fnlen = strlen(filename);