fix win side, add incomplete build script

This commit is contained in:
cathugger 2022-05-16 21:17:50 +00:00
parent 8b2d09d1c0
commit 481a6b701f
No known key found for this signature in database
GPG key ID: 9BADDA2DAF6F01A8
3 changed files with 41 additions and 5 deletions

3
contrib/winbuild/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/winepfx
/x86_64
/i686

33
contrib/winbuild/buildwin.sh Executable file
View file

@ -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

View file

@ -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);