Browse Source

add mingw-w64-faudio and dependencies

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
master
Steven Noonan 1 year ago
parent
commit
49eb0f90b4
Signed by: steven GPG Key ID: 408EEB508ED0CD4D
  1. 1
      mingw-w64-aom/.gitignore
  2. 66
      mingw-w64-aom/PKGBUILD
  3. 11
      mingw-w64-aom/cmake.patch
  4. 50
      mingw-w64-dav1d/PKGBUILD
  5. 3
      mingw-w64-faudio/.gitignore
  6. 60
      mingw-w64-faudio/PKGBUILD
  7. 1
      mingw-w64-ffmpeg/.gitignore
  8. 140
      mingw-w64-ffmpeg/PKGBUILD
  9. 17
      mingw-w64-ffmpeg/configure.patch
  10. 13
      mingw-w64-ffmpeg/vmaf-model-path.patch
  11. 26
      mingw-w64-fontconfig/.SRCINFO
  12. 7
      mingw-w64-fontconfig/.gitignore
  13. 22
      mingw-w64-fontconfig/0007-pkgconfig.mingw.patch
  14. 66
      mingw-w64-fontconfig/PKGBUILD
  15. 46
      mingw-w64-freetype2-bootstrap/0001-Enable-table-validation-modules.patch
  16. 30
      mingw-w64-freetype2-bootstrap/0002-Enable-infinality-subpixel-hinting.patch
  17. 28
      mingw-w64-freetype2-bootstrap/0003-Enable-long-PCF-family-names.patch
  18. 69
      mingw-w64-freetype2-bootstrap/PKGBUILD
  19. 46
      mingw-w64-freetype2/0001-Enable-table-validation-modules.patch
  20. 30
      mingw-w64-freetype2/0002-Enable-infinality-subpixel-hinting.patch
  21. 28
      mingw-w64-freetype2/0003-Enable-long-PCF-family-names.patch
  22. 69
      mingw-w64-freetype2/PKGBUILD
  23. 1
      mingw-w64-fribidi/.gitignore
  24. 55
      mingw-w64-fribidi/PKGBUILD
  25. 60
      mingw-w64-fribidi/testrunnerwine.patch
  26. 5
      mingw-w64-giflib/.gitignore
  27. 43
      mingw-w64-giflib/0001-respect-existence-of-distro-CFLAGS-and-CPPFLAGS.patch
  28. 57
      mingw-w64-giflib/001-mingw-build.patch
  29. 52
      mingw-w64-giflib/PKGBUILD
  30. 32
      mingw-w64-giflib/giflib-5.1.9-fix-missing-quantize-API-symbols.patch
  31. 6
      mingw-w64-glib2/.gitignore
  32. 550
      mingw-w64-glib2/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch
  33. 67
      mingw-w64-glib2/PKGBUILD
  34. 63
      mingw-w64-glib2/glib-prefer-constructors-over-DllMain.patch
  35. 83
      mingw-w64-gnutls/PKGBUILD
  36. 11
      mingw-w64-gnutls/gnutls-fix-external-libtasn1-detection.patch
  37. 24
      mingw-w64-graphite/.SRCINFO
  38. 7
      mingw-w64-graphite/.gitignore
  39. 20
      mingw-w64-graphite/002-graphite2-1.2.1-pkgconfig.patch
  40. 62
      mingw-w64-graphite/003-graphite2-1.3.8-staticbuild.patch
  41. 53
      mingw-w64-graphite/PKGBUILD
  42. 66
      mingw-w64-gsm/PKGBUILD
  43. 519
      mingw-w64-gsm/makefile.patch
  44. 20
      mingw-w64-gsm/win32.patch
  45. 26
      mingw-w64-icu/.SRCINFO
  46. 7
      mingw-w64-icu/.gitignore
  47. 34
      mingw-w64-icu/0015-debug.mingw.patch
  48. 32
      mingw-w64-icu/0016-icu-pkgconfig.patch
  49. 26
      mingw-w64-icu/0021-mingw-static-libraries-without-s.patch
  50. 72
      mingw-w64-icu/PKGBUILD
  51. 53
      mingw-w64-l-smash/PKGBUILD
  52. 76
      mingw-w64-lame/0007-revert-posix-code.patch
  53. 56
      mingw-w64-lame/PKGBUILD
  54. 9
      mingw-w64-lame/mingw.patch
  55. 18
      mingw-w64-lcms2/.SRCINFO
  56. 7
      mingw-w64-lcms2/.gitignore
  57. 45
      mingw-w64-lcms2/PKGBUILD
  58. 4
      mingw-w64-libffi/.gitignore
  59. 41
      mingw-w64-libffi/PKGBUILD
  60. 6
      mingw-w64-libjpeg-turbo/.gitignore
  61. 44
      mingw-w64-libjpeg-turbo/PKGBUILD
  62. 38
      mingw-w64-libmodplug/PKGBUILD
  63. 36
      mingw-w64-libogg/PKGBUILD
  64. 112
      mingw-w64-libsoxr/PKGBUILD
  65. 12
      mingw-w64-libsoxr/tests_executable_suffix.patch
  66. 39
      mingw-w64-libtasn1/PKGBUILD
  67. 66
      mingw-w64-libtheora/PKGBUILD
  68. 27
      mingw-w64-libtheora/libtheora-1.1.1-fix-pp_sharp_mod-calc.patch
  69. 14
      mingw-w64-libtheora/libtheora-1.1.1-libadd.patch
  70. 12
      mingw-w64-libtheora/libtheora-1.1.1-libm.patch
  71. 17
      mingw-w64-libtheora/libtheora-1.1.1-libpng16.patch
  72. 38
      mingw-w64-libtheora/mingw-libtheora-1.1.1-rint.patch
  73. 19
      mingw-w64-libtiff/.SRCINFO
  74. 7
      mingw-w64-libtiff/.gitignore
  75. 48
      mingw-w64-libtiff/PKGBUILD
  76. 35
      mingw-w64-libvorbis/PKGBUILD
  77. 1
      mingw-w64-libvpx/.gitignore
  78. 80
      mingw-w64-libvpx/PKGBUILD
  79. 118
      mingw-w64-libvpx/configure.patch
  80. 7
      mingw-w64-libwebp/.gitignore
  81. 53
      mingw-w64-libwebp/PKGBUILD
  82. 58
      mingw-w64-libxml2/PKGBUILD
  83. 25
      mingw-w64-make/PKGBUILD
  84. 5
      mingw-w64-make/mingw-make.sh
  85. 35
      mingw-w64-opencore-amr/PKGBUILD
  86. 22
      mingw-w64-openjpeg2/.SRCINFO
  87. 7
      mingw-w64-openjpeg2/.gitignore
  88. 26
      mingw-w64-openjpeg2/0001-fix-install-for-dlls.all.patch
  89. 55
      mingw-w64-openjpeg2/0003-versioned-dlls.mingw.patch
  90. 69
      mingw-w64-openjpeg2/PKGBUILD
  91. 38
      mingw-w64-opus/PKGBUILD
  92. 20
      mingw-w64-p11-kit/.SRCINFO
  93. 7
      mingw-w64-p11-kit/.gitignore
  94. 60
      mingw-w64-p11-kit/PKGBUILD
  95. 7
      mingw-w64-pcre/.gitignore
  96. 48
      mingw-w64-pcre/PKGBUILD
  97. 4
      mingw-w64-pixman/.gitignore
  98. 30
      mingw-w64-pixman/4851d4e20f66f540cd61fb69851df17671fc90d2.patch
  99. 46
      mingw-w64-pixman/PKGBUILD
  100. 44
      mingw-w64-pixman/afc6c935f1b52ca74d96f1ea2cbfb3e47ffb7fd4.patch

1
mingw-w64-aom/.gitignore

@ -0,0 +1 @@
/aom

66
mingw-w64-aom/PKGBUILD

@ -0,0 +1,66 @@
# Maintainer: Karl-Felix Glatzer <karl.glatzer@gmx.de>
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Chocobo1 <chocobo1 AT archlinux DOT net>
pkgname=mingw-w64-aom
pkgver=2.0.0
pkgrel=1
pkgdesc="Alliance for Open Media video codec (mingw-w64)"
url="https://aomedia.org/"
arch=('any')
license=(BSD custom:PATENTS)
depends=(mingw-w64-crt)
options=(!strip !buildflags staticlibs)
makedepends=(mingw-w64-gcc mingw-w64-cmake git ninja yasm)
_commit=bb35ba9148543f22ba7d8642e4fbd29ae301f5dc # tags/v2.0.0^0
source=("git+https://aomedia.googlesource.com/aom#commit=$_commit"
"cmake.patch")
sha256sums=('SKIP'
'0e32c089670732e8193050fd63b0677458cc86ed58ac42d5b73ea07f945632e0')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
pkgver() {
cd aom
git describe --tags | sed 's/^v//;s/-/+/g'
}
prepare() {
cd aom
patch -Np1 -i ${srcdir}/cmake.patch
}
build() {
for _arch in ${_architectures}; do
mkdir -p "${srcdir}"/aom/build-static-${_arch} && cd "${srcdir}"/aom/build-static-${_arch}
${_arch}-cmake -Haom -G Ninja \
-DBUILD_SHARED_LIBS=0 \
-DENABLE_TESTS=0 \
..
cmake --build .
done
for _arch in ${_architectures}; do
mkdir -p "${srcdir}"/aom/build-${_arch} && cd "${srcdir}"/aom/build-${_arch}
${_arch}-cmake -Haom -G Ninja \
-DBUILD_SHARED_LIBS=1 \
-DENABLE_TESTS=0 \
..
cmake --build .
done
}
package() {
cd "${srcdir}"/aom
for _arch in ${_architectures}; do
DESTDIR="$pkgdir" cmake --build build-static-${_arch} --target install
DESTDIR="$pkgdir" cmake --build build-${_arch} --target install
mv "${pkgdir}"/usr/${_arch}/lib/*.dll "${pkgdir}"/usr/${_arch}/bin/
${_arch}-strip -s "${pkgdir}"/usr/${_arch}/bin/*.exe
${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
done
}
# vim:set et sw=2:

11
mingw-w64-aom/cmake.patch

@ -0,0 +1,11 @@
diff -ruN aom/build/cmake/aom_configure.cmake patched/build/cmake/aom_configure.cmake
--- aom/build/cmake/aom_configure.cmake 2020-05-25 10:32:02.443333045 +0200
+++ patched/build/cmake/aom_configure.cmake 2020-05-25 10:37:34.206666378 +0200
@@ -67,6 +67,7 @@
" CMAKE_GENERATOR=${CMAKE_GENERATOR}\n")
endif()
elseif("${cpu_lowercase}" STREQUAL "i386"
+ OR "${cpu_lowercase}" STREQUAL "i686"
OR "${cpu_lowercase}" STREQUAL "x86")
set(AOM_TARGET_CPU "x86")
elseif("${cpu_lowercase}" MATCHES "^arm"

50
mingw-w64-dav1d/PKGBUILD

@ -0,0 +1,50 @@
# Maintainer: Karl-Felix Glatzer <karl[dot]glatzer[at]gmx[dot]de>
# Contributor: Daniel Bermond < gmail-com: danielbermond >
pkgname=mingw-w64-dav1d
pkgver=0.7.1
pkgrel=1
pkgdesc='AV1 cross-platform decoder focused on speed and correctness (mingw-w64)'
arch=('i686' 'x86_64')
url='https://code.videolan.org/videolan/dav1d/'
license=('BSD')
depends=('mingw-w64-crt' 'mingw-w64-vulkan-icd-loader')
options=('!strip' '!buildflags' '!libtool' 'staticlibs')
makedepends=('mingw-w64-gcc' 'mingw-w64-meson' 'mingw-w64-wine' 'git' 'nasm' 'doxygen')
source=(https://downloads.videolan.org/pub/videolan/dav1d/${pkgver}/dav1d-${pkgver}.tar.xz{,.asc})
sha512sums=('fe7f4a4a547d1239e62025bb40d2f7f97e9fbdfde1d32f9930497801b703a68050ee2fa79793c1cd0c4723678a0736f32431e1b711f63f5de782fe675e5c82de'
'SKIP')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
validpgpkeys=('65F7C6B4206BD057A7EB73787180713BE58D1ADC') # VideoLAN Release Signing Key
build () {
export NEED_WINE=1
export WINEDEBUG=-all
for _arch in ${_architectures}; do
mkdir -p "${srcdir}/dav1d-${pkgver}/build-${_arch}" && cd "${srcdir}/dav1d-${pkgver}/build-${_arch}"
${_arch}-meson .. --default-library both
ninja
done
}
check() {
for _arch in ${_architectures}; do
cd "${srcdir}/dav1d-${pkgver}/build-${_arch}"
export WINEDEBUG=-all
meson test
done
}
package () {
for _arch in ${_architectures}; do
cd "${srcdir}/dav1d-${pkgver}/build-${_arch}"
DESTDIR="$pkgdir" ninja install
done
cd "${srcdir}/dav1d-${pkgver}"
install -D -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -D -m644 doc/PATENTS -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

3
mingw-w64-faudio/.gitignore

@ -0,0 +1,3 @@
/lz4/
/*.pkg.tar.*
/*.src.tar.*

60
mingw-w64-faudio/PKGBUILD

@ -0,0 +1,60 @@
pkgname=mingw-w64-faudio
pkgver=20.07
pkgrel=1
pkgdesc='XAudio2 reimplementation'
arch=('any')
url='https://github.com/FNA-XNA/FAudio'
license=('custom:zlib')
depends=('mingw-w64-crt' 'mingw-w64-sdl2' 'mingw-w64-ffmpeg')
makedepends=('mingw-w64-cmake' 'ninja')
options=('!buildflags' 'staticlibs' '!strip')
source=("$pkgname-$pkgver.tar.gz::https://github.com/FNA-XNA/FAudio/archive/$pkgver.tar.gz")
sha512sums=('00104a019582bd8a04a4966b7b6d179f9791c8ee3a475068117d71d50de011bb537dee55390f6dcb60380abe04d21179cb0ae5e23beab19494fec6bf6109903f')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
build() {
cd FAudio-$pkgver
for _arch in ${_architectures}; do
mkdir -p build-${_arch}-static && pushd build-${_arch}-static
${_arch}-cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLIB_INSTALL_DIR=lib \
-DBUILD_SHARED_LIBS=OFF \
-DFFMPEG=ON \
-DSDL2_INCLUDE_DIRS="/usr/${_arch}/include/SDL2" \
-DSDL2_LIBRARIES="-L/usr/${_arch}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows" \
..
ninja
popd
mkdir -p build-${_arch}-shared && pushd build-${_arch}-shared
${_arch}-cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLIB_INSTALL_DIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DFFMPEG=ON \
-DSDL2_INCLUDE_DIRS="/usr/${_arch}/include/SDL2" \
-DSDL2_LIBRARIES="-L/usr/${_arch}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows" \
..
ninja
popd
done
}
package() {
cd FAudio-$pkgver
for _arch in ${_architectures}; do
for _type in static shared; do
pushd build-${_arch}-${_type}
DESTDIR="${pkgdir}" ninja install
popd
done
#rm -r "${pkgdir}"/usr/${_arch}/share
#rm -r "${pkgdir}"/usr/${_arch}/bin/*.exe
#${_arch}-strip --strip-unneeded "${pkgdir}/usr/${_arch}/bin"/*.dll
#${_arch}-strip --strip-debug "${pkgdir}/usr/${_arch}/lib"/*.a
done
}

1
mingw-w64-ffmpeg/.gitignore

@ -0,0 +1 @@
/ffmpeg

140
mingw-w64-ffmpeg/PKGBUILD

@ -0,0 +1,140 @@
# Maintainer : Karl-Felix Glatzer <karl[dot]glatzer[at]gmx[dot]de>
pkgname=mingw-w64-ffmpeg
pkgver=4.3.1
pkgrel=2
epoch=1
pkgdesc="Complete solution to record, convert and stream audio and video (mingw-w64)"
arch=('any')
url="https://ffmpeg.org/"
license=('GPL3')
depends=(
'mingw-w64-aom'
'mingw-w64-crt'
'mingw-w64-bzip2'
'mingw-w64-fontconfig'
'mingw-w64-fribidi'
'mingw-w64-gmp'
'mingw-w64-gsm'
'mingw-w64-lame'
'mingw-w64-dav1d'
'mingw-w64-libmodplug'
'mingw-w64-libsoxr'
'mingw-w64-libtheora'
'mingw-w64-vid.stab'
'mingw-w64-libwebp'
'mingw-w64-libxml2'
'mingw-w64-libvorbis'
'mingw-w64-libvpx'
'mingw-w64-opencore-amr'
'mingw-w64-openjpeg2'
'mingw-w64-opus'
'mingw-w64-rav1e'
'mingw-w64-sdl2'
'mingw-w64-speex'
'mingw-w64-srt'
'mingw-w64-x264'
'mingw-w64-xvidcore'
'mingw-w64-zlib'
'mingw-w64-x265'
)
# TODO: Add vmaf dependency
#'mingw-w64-vmaf'
options=(!strip !buildflags staticlibs)
# TODO: Add avisynth dependency
#'mingw-w64-avisynthplus'
makedepends=('mingw-w64-gcc' 'mingw-w64-pkg-config' 'git' 'yasm')
_tag=6b6b9e593dd4d3aaf75f48d40a13ef03bdef9fdb
#source=("git+https://git.ffmpeg.org/ffmpeg.git#tag=n${pkgver}"
source=(git+https://git.ffmpeg.org/ffmpeg.git#tag=${_tag}
vmaf-model-path.patch
configure.patch)
sha256sums=('SKIP'
'8dff51f84a5f7460f8893f0514812f5d2bd668c3276ef7ab7713c99b71d7bd8d'
'3cec5d47cd190cc9cf7969b2c2c94690d7b15ffb5d7147bdd4e60eecb0991eed')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
pkgver() {
cd ffmpeg
git describe --tags | sed 's/^n//'
}
prepare() {
cd ffmpeg
patch -Np1 -i ../configure.patch
# TODO: Add vmaf dependency
# patch -Np1 -i "${srcdir}"/vmaf-model-path.patch
}
build() {
for _arch in ${_architectures}; do
mkdir -p "${srcdir}"/build-${_arch} && cd "${srcdir}"/build-${_arch}
"${srcdir}"/ffmpeg/configure \
--prefix="/usr/${_arch}" \
--enable-cross-compile \
--cross-prefix="${_arch}-" \
--target-os=mingw32 \
--arch=${_arch%%-*} \
--disable-debug \
--enable-static \
--disable-stripping \
--enable-fontconfig \
--enable-gmp \
--enable-gpl \
--enable-libaom \
--enable-libdav1d \
--enable-libfreetype \
--enable-libfribidi \
--enable-libgsm \
--enable-libmodplug \
--enable-libmp3lame \
--enable-libopencore_amrnb \
--enable-libopencore_amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-librav1e \
--enable-libsoxr \
--enable-libspeex \
--enable-libsrt \
--enable-libtheora \
--enable-libvidstab \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxml2 \
--enable-libxvid \
--enable-zlib \
--enable-shared \
--enable-version3 \
--disable-doc \
--x86asmexe=yasm
# TODO: Add avisynth dependency
# --enable-avisynth \
# TODO: Add vmaf dependency
# --enable-libvmaf \
make
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}"/build-${_arch}
make DESTDIR="$pkgdir" install
${_arch}-strip -s "${pkgdir}"/usr/${_arch}/bin/*.exe
${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
mv "${pkgdir}"/usr/${_arch}/bin/*.lib "${pkgdir}"/usr/${_arch}/lib/
done
}
# vim:set ts=2 sw=2 et:

17
mingw-w64-ffmpeg/configure.patch

@ -0,0 +1,17 @@
diff -ruN ffmpeg-4.0/configure patched/configure
--- ffmpeg-4.0/configure 2018-04-20 12:02:55.000000000 +0200
+++ patched/configure 2018-05-13 10:55:23.199869611 +0200
@@ -5101,10 +5101,10 @@
elif enabled aarch64; then
LIBTARGET="arm64"
fi
- if enabled shared; then
+ #if enabled shared; then
# Cannot build both shared and static libs when using dllimport.
- disable static
- fi
+ # disable static
+ #fi
enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -Wl,--large-address-aware
shlibdir_default="$bindir_default"

13
mingw-w64-ffmpeg/vmaf-model-path.patch

@ -0,0 +1,13 @@
diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c
index 249e50c720..9b791e19b1 100644
--- a/libavfilter/vf_libvmaf.c
+++ b/libavfilter/vf_libvmaf.c
@@ -72,7 +72,7 @@ typedef struct LIBVMAFContext {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption libvmaf_options[] = {
- {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/local/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS},
+ {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS},
{"log_path", "Set the file path to be used to store logs.", OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
{"log_fmt", "Set the format of the log (xml or json).", OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
{"enable_transform", "Enables transform for computing vmaf.", OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},

26
mingw-w64-fontconfig/.SRCINFO

@ -0,0 +1,26 @@
pkgbase = mingw-w64-fontconfig
pkgdesc = A library for configuring and customizing font access (mingw-w64)
pkgver = 2.13.92
pkgrel = 1
url = https://www.freedesktop.org/wiki/Software/fontconfig/
arch = any
license = custom
makedepends = mingw-w64-configure
makedepends = git
makedepends = autoconf-archive
makedepends = gperf
makedepends = python-lxml
makedepends = json-c
makedepends = python-six
depends = mingw-w64-expat
depends = mingw-w64-freetype2
options = !strip
options = staticlibs
options = !buildflags
source = git+https://gitlab.freedesktop.org/fontconfig/fontconfig.git#commit=b1df1101a643ae16cdfa1d83b939de2497b1bf27
source = 0007-pkgconfig.mingw.patch
sha256sums = SKIP
sha256sums = af373531873da46d0356305da5444c1ec74f443cd2635ea2db6b7dadd1561f5b
pkgname = mingw-w64-fontconfig

7
mingw-w64-fontconfig/.gitignore

@ -0,0 +1,7 @@
*
!.gitignore
!.SRCINFO
!PKGBUILD
!*.install
!*.patch
!*.diff

22
mingw-w64-fontconfig/0007-pkgconfig.mingw.patch

@ -0,0 +1,22 @@
--- fontconfig-2.11.93/m4/pkg.m4.orig 2015-03-09 02:54:03.000000000 +0000
+++ fontconfig-2.11.93/m4/pkg.m4 2015-04-06 11:04:21.862416100 +0000
@@ -111,8 +111,8 @@
pkg_failed=no
AC_MSG_CHECKING([for $1])
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+_PKG_CONFIG([$1][_CFLAGS], [cflags --dont-define-prefix], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs --dont-define-prefix], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
@@ -207,7 +207,7 @@
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+_PKG_CONFIG([$1], [variable="][$3][" --dont-define-prefix], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl

66
mingw-w64-fontconfig/PKGBUILD

@ -0,0 +1,66 @@
# Maintainer: pingplug < aur at pingplug dot me >
# Contributor: Schala Zeal < schalaalexiazeal at gmail dot com >
_commit=b1df1101a643ae16cdfa1d83b939de2497b1bf27 # tags/2.13.92^0
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
pkgname=mingw-w64-fontconfig
pkgver=2.13.92
pkgrel=1
pkgdesc="A library for configuring and customizing font access (mingw-w64)"
arch=('any')
url="https://www.freedesktop.org/wiki/Software/fontconfig/"
license=('custom')
depends=('mingw-w64-expat'
'mingw-w64-freetype2')
makedepends=('mingw-w64-configure'
'git'
'autoconf-archive'
'gperf'
'python-lxml'
'json-c'
'python-six')
options=('!strip' 'staticlibs' '!buildflags')
source=("git+https://gitlab.freedesktop.org/fontconfig/fontconfig.git#commit=${_commit}"
"0007-pkgconfig.mingw.patch")
sha256sums=('SKIP'
'af373531873da46d0356305da5444c1ec74f443cd2635ea2db6b7dadd1561f5b')
pkgver() {
cd fontconfig
git describe --tags | sed 's/-/+/g'
}
prepare() {
cd fontconfig
patch -p1 -i ${srcdir}/0007-pkgconfig.mingw.patch
# do not build buggy test code
sed -i /test\\/Makefile/d configure.ac
sed -i "s/po-conf test/po-conf/g" Makefile.am
rm -r test
NOCONFIGURE=1 ./autogen.sh
}
build() {
cd fontconfig
for _arch in ${_architectures}; do
mkdir -p build-${_arch} && pushd build-${_arch}
${_arch}-configure \
--with-arch=${_arch%-w64-mingw32} \
--disable-docs
make
popd
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/fontconfig/build-${_arch}"
make DESTDIR="${pkgdir}" install
find "${pkgdir}/usr/${_arch}" -name '*.exe' -exec rm {} \;
find "${pkgdir}/usr/${_arch}" -name '*.dll' -exec ${_arch}-strip --strip-unneeded {} \;
find "${pkgdir}/usr/${_arch}" -name '*.a' -o -name '*.dll' | xargs ${_arch}-strip -g
done
}
# vim:set ts=2 sw=2 et:

46
mingw-w64-freetype2-bootstrap/0001-Enable-table-validation-modules.patch

@ -0,0 +1,46 @@
From b609203df7333beea20dbfd604262a9486f01497 Mon Sep 17 00:00:00 2001
Message-Id: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 23 Jun 2015 08:40:29 +0200
Subject: [PATCH 1/4] Enable table validation modules
---
modules.cfg | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.cfg b/modules.cfg
index dc6c8d42d..2ab145016 100644
--- a/modules.cfg
+++ b/modules.cfg
@@ -111,26 +111,26 @@ AUX_MODULES += cache
# TrueType GX/AAT table validation. Needs `ftgxval.c' below.
#
-# AUX_MODULES += gxvalid
+AUX_MODULES += gxvalid
# Support for streams compressed with gzip (files with suffix .gz).
#
# See include/freetype/ftgzip.h for the API.
AUX_MODULES += gzip
# Support for streams compressed with LZW (files with suffix .Z).
#
# See include/freetype/ftlzw.h for the API.
AUX_MODULES += lzw
# Support for streams compressed with bzip2 (files with suffix .bz2).
#
# See include/freetype/ftbzip2.h for the API.
AUX_MODULES += bzip2
# OpenType table validation. Needs `ftotval.c' below.
#
-# AUX_MODULES += otvalid
+AUX_MODULES += otvalid
# Auxiliary PostScript driver component to share common code.
#
--
2.21.0

30
mingw-w64-freetype2-bootstrap/0002-Enable-infinality-subpixel-hinting.patch

@ -0,0 +1,30 @@
From fbeffd53c40de0932b1e9ef32ca4f30b7e1aeea2 Mon Sep 17 00:00:00 2001
Message-Id: <fbeffd53c40de0932b1e9ef32ca4f30b7e1aeea2.1552648361.git.jan.steffens@gmail.com>
In-Reply-To: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
References: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 29 Aug 2016 08:43:10 +0200
Subject: [PATCH 2/4] Enable infinality subpixel hinting
---
include/freetype/config/ftoption.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 12f47a82e..1d4469a99 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -658,8 +658,8 @@ FT_BEGIN_HEADER
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
/**************************************************************************
--
2.21.0

28
mingw-w64-freetype2-bootstrap/0003-Enable-long-PCF-family-names.patch

@ -0,0 +1,28 @@
From a7c04e60d28a0ad0420bb7a1943479a08a923d07 Mon Sep 17 00:00:00 2001
Message-Id: <a7c04e60d28a0ad0420bb7a1943479a08a923d07.1552648361.git.jan.steffens@gmail.com>
In-Reply-To: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
References: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Sun, 14 May 2017 18:09:31 +0200
Subject: [PATCH 3/4] Enable long PCF family names
---
include/freetype/config/ftoption.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 1d4469a99..4ff4e7821 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -847,7 +847,7 @@ FT_BEGIN_HEADER
* If this option is activated, it can be controlled with the
* `no-long-family-names` property of the 'pcf' driver module.
*/
-/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
+#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
/*************************************************************************/
--
2.21.0

69
mingw-w64-freetype2-bootstrap/PKGBUILD

@ -0,0 +1,69 @@
# Maintainer: Martchus <martchus@gmx.net>
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.
pkgname=mingw-w64-freetype2-bootstrap
pkgver=2.10.1
pkgrel=1
pkgdesc='Font rasterization library (mingw-w64)'
arch=('any')
url='https://www.freetype.org/'
license=('GPL')
depends=(mingw-w64-crt mingw-w64-zlib mingw-w64-bzip2)
makedepends=(mingw-w64-gcc mingw-w64-configure)
provides=(mingw-w64-freetype)
replaces=(mingw-w64-freetype)
conflicts=(mingw-w64-freetype)
source=(https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${pkgver}.tar.xz{,.sig}
0001-Enable-table-validation-modules.patch
0002-Enable-infinality-subpixel-hinting.patch
0003-Enable-long-PCF-family-names.patch)
options=(!strip !buildflags !libtool staticlibs)
sha1sums=('79874ef4eaa52025126b71d836453b8279bdd331'
'SKIP'
'46fd67e6a594f6c2c473b9321ba64913984ba42f'
'4bf0c0749db09878b918cc404300f0d3e9091607'
'af76172be8135e74391b7ad1b82c2124ae0ad86c')
validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')
if [[ $pkgname = 'mingw-w64-freetype2-bootstrap' ]]; then
_provides=${pkgname%-bootstrap}
else
_provides=${pkgname}-bootstrap
# adding harfbuzz for improved OpenType features auto-hinting
# introduces a cycle dep to harfbuzz depending on freetype wanted by upstream
depends+=(mingw-w64-harfbuzz)
replaces+=(${_provides})
fi
provides+=(${_provides})
conflicts+=(${_provides})
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
prepare() {
cd "${srcdir}/freetype-${pkgver}"
patch -Np1 -i ../0001-Enable-table-validation-modules.patch
patch -Np1 -i ../0002-Enable-infinality-subpixel-hinting.patch
patch -Np1 -i ../0003-Enable-long-PCF-family-names.patch
}
build() {
for _arch in ${_architectures}; do
mkdir -p "${srcdir}/freetype-${pkgver}/build-${_arch}"
cd "${srcdir}/freetype-${pkgver}/build-${_arch}"
${_arch}-configure --with-zlib=/usr/${_arch} --without-png
make
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/freetype-${pkgver}/build-${_arch}"
make DESTDIR="${pkgdir}" install
rm -rf "${pkgdir}/usr/${_arch}/share/"
${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a
${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
done
}

46
mingw-w64-freetype2/0001-Enable-table-validation-modules.patch

@ -0,0 +1,46 @@
From b609203df7333beea20dbfd604262a9486f01497 Mon Sep 17 00:00:00 2001
Message-Id: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 23 Jun 2015 08:40:29 +0200
Subject: [PATCH 1/4] Enable table validation modules
---
modules.cfg | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.cfg b/modules.cfg
index dc6c8d42d..2ab145016 100644
--- a/modules.cfg
+++ b/modules.cfg
@@ -111,26 +111,26 @@ AUX_MODULES += cache
# TrueType GX/AAT table validation. Needs `ftgxval.c' below.
#
-# AUX_MODULES += gxvalid
+AUX_MODULES += gxvalid
# Support for streams compressed with gzip (files with suffix .gz).
#
# See include/freetype/ftgzip.h for the API.
AUX_MODULES += gzip
# Support for streams compressed with LZW (files with suffix .Z).
#
# See include/freetype/ftlzw.h for the API.
AUX_MODULES += lzw
# Support for streams compressed with bzip2 (files with suffix .bz2).
#
# See include/freetype/ftbzip2.h for the API.
AUX_MODULES += bzip2
# OpenType table validation. Needs `ftotval.c' below.
#
-# AUX_MODULES += otvalid
+AUX_MODULES += otvalid
# Auxiliary PostScript driver component to share common code.
#
--
2.21.0

30
mingw-w64-freetype2/0002-Enable-infinality-subpixel-hinting.patch

@ -0,0 +1,30 @@
From fbeffd53c40de0932b1e9ef32ca4f30b7e1aeea2 Mon Sep 17 00:00:00 2001
Message-Id: <fbeffd53c40de0932b1e9ef32ca4f30b7e1aeea2.1552648361.git.jan.steffens@gmail.com>
In-Reply-To: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
References: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Mon, 29 Aug 2016 08:43:10 +0200
Subject: [PATCH 2/4] Enable infinality subpixel hinting
---
include/freetype/config/ftoption.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 12f47a82e..1d4469a99 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -658,8 +658,8 @@ FT_BEGIN_HEADER
* https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx
*/
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */
-#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2
-/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */
+/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */
+#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )
/**************************************************************************
--
2.21.0

28
mingw-w64-freetype2/0003-Enable-long-PCF-family-names.patch

@ -0,0 +1,28 @@
From a7c04e60d28a0ad0420bb7a1943479a08a923d07 Mon Sep 17 00:00:00 2001
Message-Id: <a7c04e60d28a0ad0420bb7a1943479a08a923d07.1552648361.git.jan.steffens@gmail.com>
In-Reply-To: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
References: <b609203df7333beea20dbfd604262a9486f01497.1552648361.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Sun, 14 May 2017 18:09:31 +0200
Subject: [PATCH 3/4] Enable long PCF family names
---
include/freetype/config/ftoption.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 1d4469a99..4ff4e7821 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -847,7 +847,7 @@ FT_BEGIN_HEADER
* If this option is activated, it can be controlled with the
* `no-long-family-names` property of the 'pcf' driver module.
*/
-/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */
+#define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES
/*************************************************************************/
--
2.21.0

69
mingw-w64-freetype2/PKGBUILD

@ -0,0 +1,69 @@
# Maintainer: Martchus <martchus@gmx.net>
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.
pkgname=mingw-w64-freetype2
pkgver=2.10.1
pkgrel=1
pkgdesc='Font rasterization library (mingw-w64)'
arch=('any')
url='https://www.freetype.org/'
license=('GPL')
depends=(mingw-w64-crt mingw-w64-zlib mingw-w64-bzip2)
makedepends=(mingw-w64-gcc mingw-w64-configure)
provides=(mingw-w64-freetype)
replaces=(mingw-w64-freetype)
conflicts=(mingw-w64-freetype)
source=(https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${pkgver}.tar.xz{,.sig}
0001-Enable-table-validation-modules.patch
0002-Enable-infinality-subpixel-hinting.patch
0003-Enable-long-PCF-family-names.patch)
options=(!strip !buildflags !libtool staticlibs)
sha1sums=('79874ef4eaa52025126b71d836453b8279bdd331'
'SKIP'
'46fd67e6a594f6c2c473b9321ba64913984ba42f'
'4bf0c0749db09878b918cc404300f0d3e9091607'
'af76172be8135e74391b7ad1b82c2124ae0ad86c')
validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')
if [[ $pkgname = 'mingw-w64-freetype2-bootstrap' ]]; then
_provides=${pkgname%-bootstrap}
else
_provides=${pkgname}-bootstrap
# adding harfbuzz for improved OpenType features auto-hinting
# introduces a cycle dep to harfbuzz depending on freetype wanted by upstream
depends+=(mingw-w64-harfbuzz)
replaces+=(${_provides})
fi
provides+=(${_provides})
conflicts+=(${_provides})
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
prepare() {
cd "${srcdir}/freetype-${pkgver}"
patch -Np1 -i ../0001-Enable-table-validation-modules.patch
patch -Np1 -i ../0002-Enable-infinality-subpixel-hinting.patch
patch -Np1 -i ../0003-Enable-long-PCF-family-names.patch
}
build() {
for _arch in ${_architectures}; do
mkdir -p "${srcdir}/freetype-${pkgver}/build-${_arch}"
cd "${srcdir}/freetype-${pkgver}/build-${_arch}"
${_arch}-configure --with-zlib=/usr/${_arch} --without-png
make
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/freetype-${pkgver}/build-${_arch}"
make DESTDIR="${pkgdir}" install
rm -rf "${pkgdir}/usr/${_arch}/share/"
${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a
${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
done
}

1
mingw-w64-fribidi/.gitignore

@ -0,0 +1 @@
/fribidi

55
mingw-w64-fribidi/PKGBUILD

@ -0,0 +1,55 @@
# Maintainer: Karl-Felix Glatzer <karl[dot]glatzer[at]gmx[dot]de>
pkgname=mingw-w64-fribidi
pkgver=1.0.10
pkgrel=1
pkgdesc="A Free Implementation of the Unicode Bidirectional Algorithm (mingw-w64)"
arch=('any')
license=('LGPL')
url="http://fribidi.org"
depends=('mingw-w64-crt')
options=('!strip' '!buildflags' '!libtool' 'staticlibs')
makedepends=('mingw-w64-gcc' 'mingw-w64-meson' 'mingw-w64-wine' 'git')
_commit=5464c284034da9c058269377b7f5013bb089f553 # tags/v1.0.10^0
source=("git+https://github.com/fribidi/fribidi#commit=$_commit"
"testrunnerwine.patch")
sha256sums=('SKIP'
'5bdbddcec6ef0a092d49dacec149b5219da12033b76787b3e65c0f9b338045d7')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
prepare() {
cd ${srcdir}/fribidi
patch -Np1 -i ${srcdir}/testrunnerwine.patch
}
build() {
export NEED_WINE=1
for _arch in ${_architectures}; do
mkdir -p ${srcdir}/fribidi/build-${_arch} && cd ${srcdir}/fribidi/build-${_arch}
${_arch}-meson .. --default-library both -D docs=false
meson compile
done
}
check() {
export NEED_WINE=1
for _arch in ${_architectures}; do
cp ${srcdir}/fribidi/build-${_arch}/lib/*.dll ${srcdir}/fribidi/build-${_arch}/bin/
cp ${srcdir}/fribidi/build-${_arch}/lib/*.dll ${srcdir}/fribidi/build-${_arch}/test/unicode-conformance/
WINEDEBUG=-all meson test -C ${srcdir}/fribidi/build-${_arch} --print-errorlogs
done
}
package() {
for _arch in ${_architectures}; do
DESTDIR="${pkgdir}" meson install -C ${srcdir}/fribidi/build-${_arch}
#FIXME: Ranlib (isn't meson supposed to do this?)
${_arch}-ranlib ${pkgdir}/usr/${_arch}/lib/*.a
${_arch}-strip -s ${pkgdir}/usr/${_arch}/bin/*.exe
${_arch}-strip -x -g ${pkgdir}/usr/${_arch}/bin/*.dll
${_arch}-strip -g ${pkgdir}/usr/${_arch}/lib/*.a
done
}

60
mingw-w64-fribidi/testrunnerwine.patch

@ -0,0 +1,60 @@
diff -ruN fribidi/test/meson.build patched/test/meson.build
--- fribidi/test/meson.build 2018-08-08 11:44:23.532552727 +0200
+++ patched/test/meson.build 2018-08-08 11:42:06.210001912 +0200
@@ -15,7 +15,16 @@
test_name = '@0@_@1@'.format(charset, suffix)
input_file = files('test_@0@.input'.format(test_name))
reference_file = files('test_@0@.reference'.format(test_name))
- test(test_name, test_runner, args: [fribidi, charset, input_file, reference_file])
+ wrapper = ''
+ if meson.is_cross_build() and meson.has_exe_wrapper()
+ #FIXME: How to get the wrapper executable defined in the cross-build file?
+ if host_machine.cpu() == 'i686'
+ wrapper = 'i686-w64-mingw32-wine'
+ else
+ wrapper = 'x86_64-w64-mingw32-wine'
+ endif
+ endif
+ test(test_name, test_runner, args: [wrapper, fribidi, charset, input_file, reference_file])
endforeach
subdir('unicode-conformance')
diff -ruN fribidi/test/test-runner.py patched/test/test-runner.py
--- fribidi/test/test-runner.py 2018-08-08 11:47:28.165977986 +0200
+++ patched/test/test-runner.py 2018-08-08 11:32:04.748784989 +0200
@@ -6,14 +6,16 @@
import sys
import os
-if len(sys.argv) != 5:
- raise Exception('Expected 4 command-line arguments: test_exe charset test.input test.reference')
+if len(sys.argv) != 6:
+ raise Exception('Expected 5 command-line arguments: wrapper test_exe charset test.input test.reference')
script = sys.argv[0]
-test_exe = sys.argv[1]
-charset = sys.argv[2]
-input_file = sys.argv[3]
-reference_file = sys.argv[4]
+wrapper = sys.argv[1]
+test_exe = sys.argv[2]
+charset = sys.argv[3]
+input_file = sys.argv[4]
+reference_file = sys.argv[5]
+run_with_wine = False
if os.name == 'nt':
libpath = os.path.join(os.path.dirname(os.path.realpath(test_exe)),
@@ -22,9 +24,10 @@
os.environ['PATH'] = libpath + ';' + os.environ['PATH']
try:
- output = subprocess.check_output([test_exe, '--test', '--charset', charset, input_file])
+ output = subprocess.check_output([wrapper, test_exe, '--test', '--charset', charset, input_file])
ref_data = open(reference_file, "rb").read()
- if os.name == 'nt':
+# FIXME AUR mingw-w64 specific. Needs general solution (custom meson option?)
+ if os.name == 'nt' or os.environ.get('NEED_WINE') == '1':
output = output.replace(b'\r\n', b'\n')
ref_data = ref_data.replace(b'\r\n', b'\n')
if output != ref_data:

5
mingw-w64-giflib/.gitignore

@ -0,0 +1,5 @@
pkg/
src/
*.bz2
*.tar
*.xz

43
mingw-w64-giflib/0001-respect-existence-of-distro-CFLAGS-and-CPPFLAGS.patch

@ -0,0 +1,43 @@
From 788a52c399f4731ac1fb27a49db48626f3e140e1 Mon Sep 17 00:00:00 2001
From: anthraxx <levente@leventepolyak.net>
Date: Tue, 2 Apr 2019 14:53:28 +0200
Subject: [PATCH] respect existence of distro CFLAGS and CPPFLAGS
- append CFLAGS instead of set to honor default distro CFLAGS
- add CPPFLAGS that are defined by distros
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 8dffb43..74d5b61 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
#
OFLAGS = -O0 -g
OFLAGS = -O2
-CFLAGS = -std=gnu99 -fPIC -Wall -Wno-format-truncation $(OFLAGS)
+CFLAGS += -std=gnu99 -fPIC -Wall -Wno-format-truncation $(OFLAGS)
SHELL = /bin/sh
TAR = tar
@@ -67,13 +67,13 @@ all: libgif-$(LIBMAJOR).dll libgif.a libutil-$(LIBMAJOR).dll libutil.a $(UTILS)
$(UTILS):: libgif.a libutil.a
libgif-$(LIBMAJOR).dll: $(OBJECTS) $(HEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libgif.dll.a -o libgif-$(LIBMAJOR).dll $(OBJECTS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libgif.dll.a -o libgif-$(LIBMAJOR).dll $(OBJECTS)
libgif.a: $(OBJECTS) $(HEADERS)
$(AR) rcs libgif.a $(OBJECTS)
libutil-$(LIBMAJOR).dll: $(UOBJECTS) $(UHEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libutil.dll.a -o libutil-$(LIBMAJOR).dll $(UOBJECTS) -L. -lgif
+ $(CC) $(CFLAGS) $(CPPFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libutil.dll.a -o libutil-$(LIBMAJOR).dll $(UOBJECTS) -L. -lgif
libutil.a: $(UOBJECTS) $(UHEADERS)
$(AR) rcs libutil.a $(UOBJECTS)
--
2.22.0

57
mingw-w64-giflib/001-mingw-build.patch

@ -0,0 +1,57 @@
--- giflib-5.1.9/Makefile.orig 2019-06-10 11:06:10.797407400 +0300
+++ giflib-5.1.9/Makefile 2019-06-10 11:10:11.917745000 +0300
@@ -62,27 +62,25 @@
LDLIBS=libgif.a -lm
-all: libgif.so libgif.a libutil.so libutil.a $(UTILS)
+all: libgif-$(LIBMAJOR).dll libgif.a libutil-$(LIBMAJOR).dll libutil.a $(UTILS)
$(MAKE) -C doc
$(UTILS):: libgif.a libutil.a
-libgif.so: $(OBJECTS) $(HEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libgif.so.$(LIBMAJOR) -o libgif.so $(OBJECTS)
+libgif-$(LIBMAJOR).dll: $(OBJECTS) $(HEADERS)
+ $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libgif.dll.a -o libgif-$(LIBMAJOR).dll $(OBJECTS)
libgif.a: $(OBJECTS) $(HEADERS)
$(AR) rcs libgif.a $(OBJECTS)
-libutil.so: $(UOBJECTS) $(UHEADERS)
- $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libutil.so.$(LIBMAJOR) -o libutil.so $(UOBJECTS)
+libutil-$(LIBMAJOR).dll: $(UOBJECTS) $(UHEADERS)
+ $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,--out-implib,libutil.dll.a -o libutil-$(LIBMAJOR).dll $(UOBJECTS) -L. -lgif
libutil.a: $(UOBJECTS) $(UHEADERS)
$(AR) rcs libutil.a $(UOBJECTS)
clean:
- rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a libgif.so libutil.a libutil.so *.o
- rm -f libgif.so.$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
- rm -f libgif.so.$(LIBMAJOR)
+ rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a libgif-$(LIBMAJOR).dll libgif.dll.a libutil.a libutil-$(LIBMAJOR).dll libutil.dll.a *.o
rm -fr doc/*.1 *.html doc/staging
check: all
@@ -100,9 +98,8 @@
install-lib:
$(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
- $(INSTALL) -m 755 libgif.so "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBVER)"
- ln -sf libgif.so.$(LIBVER) "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBMAJOR)"
- ln -sf libgif.so.$(LIBMAJOR) "$(DESTDIR)$(LIBDIR)/libgif.so"
+ $(INSTALL) -m 644 libgif.dll.a "$(DESTDIR)$(LIBDIR)/libgif.dll.a"
+ $(INSTALL) -m 755 libgif-$(LIBMAJOR).dll "$(DESTDIR)$(BINDIR)/libgif-$(LIBMAJOR).dll"
install-man:
$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man1"
$(INSTALL) -m 644 doc/*.1 "$(DESTDIR)$(MANDIR)/man1"
@@ -113,7 +110,7 @@
rm -f "$(DESTDIR)$(INCDIR)/gif_lib.h"
uninstall-lib:
cd "$(DESTDIR)$(LIBDIR)" && \
- rm -f libgif.a libgif.so libgif.so.$(LIBMAJOR) libgif.so.$(LIBVER)
+ rm -f libgif.a libgif-$(LIBMAJOR).dll libgif.dll.a
uninstall-man:
cd "$(DESTDIR)$(MANDIR)/man1" && rm -f $(shell cd doc >/dev/null && echo *.1)

52
mingw-w64-giflib/PKGBUILD

@ -0,0 +1,52 @@
# Maintainer: drakkan <nicola.murino at gmail dot com>
pkgname=mingw-w64-giflib
pkgver=5.2.1
pkgrel=5
pkgdesc="A library for reading and writing gif images (mingw-w64)"
arch=(any)
url="http://sourceforge.net/projects/giflib/"
license=("MIT")
makedepends=('xmlto' 'docbook-xsl' 'mingw-w64-make')
depends=('mingw-w64-crt')
options=(staticlibs !strip !buildflags !makeflags)
source=("https://downloads.sourceforge.net/project/giflib/${pkgname#mingw-w64-}-${pkgver}.tar.gz"
"giflib-5.1.9-fix-missing-quantize-API-symbols.patch"
"001-mingw-build.patch"
"0001-respect-existence-of-distro-CFLAGS-and-CPPFLAGS.patch")
sha512sums=('4550e53c21cb1191a4581e363fc9d0610da53f7898ca8320f0d3ef6711e76bdda2609c2df15dc94c45e28bff8de441f1227ec2da7ea827cb3c0405af4faa4736'
'5de1e8724f5221fa3637b4e6a482f650f7608673e2c9200233290018ec8a0bf1beea049b3979b5f57dbf2b2a5fda409324e636e9af10582fd01c71d92d4de3b3'
'3b5d5937162d9a3c1076cdc58a803a8881b264c65aa8d33e9592c43dc1686724fce280e8b56ed2751a6bf8a5c75ed9d887c31a042bc9e0a15c1697ea0b2fedc9'
'2b0eb1a5d1a3ff8270018f7cfbe87d902bca3e2105315c4169f4c7859dd37aac0c34dc27008ee2dc2acaa52375ffda260d5318a5c065b1ba51e7aed9f4ca3356')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
prepare() {
cd giflib-$pkgver
patch -Np1 < ../giflib-5.1.9-fix-missing-quantize-API-symbols.patch
patch -Np1 < ../001-mingw-build.patch
patch -Np1 < ../0001-respect-existence-of-distro-CFLAGS-and-CPPFLAGS.patch
}
build() {
for _arch in ${_architectures}; do
[[ -d "build-${_arch}" ]] && rm -rf "build-${_arch}"
cp -rf "$srcdir/giflib-${pkgver}" "${srcdir}/build-${_arch}"
pushd build-${_arch}
${_arch}-make
popd
done
}
package() {
for _arch in ${_architectures}; do
cd "${srcdir}/build-${_arch}"
${_arch}-make DESTDIR="${pkgdir}" PREFIX="/usr/${_arch}" install INSTALLABLE="gif2rgb.exe gifbuild.exe giffix.exe giftext.exe giftool.exe gifclrmp.exe"
${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
${_arch}-strip --strip-all "$pkgdir"/usr/${_arch}/bin/*.exe
rm -r "$pkgdir/usr/${_arch}/share"
done
}
# vim: ts=2 sw=2 et:

32
mingw-w64-giflib/giflib-5.1.9-fix-missing-quantize-API-symbols.patch

@ -0,0 +1,32 @@
From ff8d9a59e79b79657e64430730c35835a84db619 Mon Sep 17 00:00:00 2001
From: anthraxx <levente@leventepolyak.net>
Date: Tue, 2 Apr 2019 11:46:18 +0200
Subject: [PATCH] fix missing quantize API symbols
GifQuantizeBuffer is required by many libs and applications
like mplayer, libgdiplus (mono) and others.
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index e4ded69..17d0a5c 100644
--- a/Makefile
+++ b/Makefile
@@ -29,11 +29,11 @@ LIBPOINT=0
LIBVER=$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
SOURCES = dgif_lib.c egif_lib.c gifalloc.c gif_err.c gif_font.c \
- gif_hash.c openbsd-reallocarray.c
+ gif_hash.c openbsd-reallocarray.c quantize.c
HEADERS = gif_hash.h gif_lib.h gif_lib_private.h
OBJECTS = $(SOURCES:.c=.o)
-USOURCES = qprintf.c quantize.c getarg.c
+USOURCES = qprintf.c getarg.c
UHEADERS = getarg.h
UOBJECTS = $(USOURCES:.c=.o)
--
2.21.0

6
mingw-w64-glib2/.gitignore

@ -0,0 +1,6 @@
glib/
pkg/
src/
*.log
*.tar
*.xz

550
mingw-w64-glib2/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch

@ -0,0 +1,550 @@
diff -rupN --no-dereference glib-2.64.1/gio/tests/org.gtk.test.gschema.override.orig glib-2.64.1-new/gio/tests/org.gtk.test.gschema.override.orig
--- glib-2.64.1/gio/tests/org.gtk.test.gschema.override.orig 2020-03-11 13:21:39.000000000 +0100
+++ glib-2.64.1-new/gio/tests/org.gtk.test.gschema.override.orig 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-[org.gtk.test.per-desktop:GNOME-Classic]
-desktop = "GNOME Classic"
diff -rupN --no-dereference glib-2.64.1/gio/tests/org.gtk.test.gschema.xml.orig glib-2.64.1-new/gio/tests/org.gtk.test.gschema.xml.orig
--- glib-2.64.1/gio/tests/org.gtk.test.gschema.xml.orig 2020-03-11 13:21:39.000000000 +0100
+++ glib-2.64.1-new/gio/tests/org.gtk.test.gschema.xml.orig 1970-01-01 01:00:00.000000000 +0100
@@ -1,222 +0,0 @@
-<schemalist>
-
- <schema id="org.gtk.test" path="/tests/" gettext-domain="test">
- <key name="greeting" type="s">
- <default l10n="messages">"Hello, earthlings"</default>
- <summary>A greeting</summary>
- <description>
- Greeting of the invading martians
- </description>
- </key>
- <key name="farewell" type="s">
- <default l10n="messages">"So long"</default>
- </key>
-
- <child name='basic-types' schema='org.gtk.test.basic-types'/>
- <child name='complex-types' schema='org.gtk.test.complex-types'/>
- <child name='localized' schema='org.gtk.test.localized'/>
- </schema>
-
- <schema id="org.gtk.test.no-path">
- <key name="test-boolean" type="b">
- <default>true</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.basic-types" path="/tests/basic-types/">
- <key name="test-boolean" type="b">
- <default>true</default>
- </key>
- <key name="test-byte" type="y">
- <default>25</default>
- </key>
- <key name="test-int16" type="n">
- <default>-1234</default>
- </key>
- <key name="test-uint16" type="q">
- <default>1234</default>
- </key>
- <key name="test-int32" type="i">
- <default>-123456</default>
- </key>
- <key name="test-uint32" type="u">
- <default>123456</default>
- </key>
- <key name="test-int64" type="x">
- <default>-123456789</default>
- </key>
- <key name="test-uint64" type="t">
- <default>123456789</default>
- </key>
- <key name="test-double" type="d">
- <default>123.456</default>
- </key>
- <key name="test-string" type="s">
- <default>"a string, it seems"</default>
- </key>
- <key name="test-objectpath" type="o">
- <default>"/a/object/path"</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.complex-types" path="/tests/complex-types/">
- <key name="test-tuple" type="(s(ii))">
- <default>("one",(2,3))</default>
- </key>
- <key name="test-array" type="ai">
- <default>[0,1,2,3,4,5]</default>
- </key>
- <key name="test-dict" type="a{sau}">
- <default>
- {
- "AC": [0,0, 0,0,0,0,0,0],
- "IV": [0,0, 0,0,0,0,0,0]
- }
- </default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.localized" path="/tests/localized/" gettext-domain="test">
- <key name="error-message" type="s">
- <default l10n="messages">"Unnamed"</default>
- </key>
- <key name="backspace" type="s">
- <default l10n="messages" context="keyboard label">"BackSpace"</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.binding" path="/tests/binding/">
- <key name="bool" type="b">
- <default>false</default>
- </key>
- <key name="anti-bool" type="b">
- <default>false</default>
- </key>
- <key name="byte" type="y">
- <default>0</default>
- </key>
- <key name="int16" type="n">
- <default>0</default>
- </key>
- <key name="uint16" type="q">
- <default>0</default>
- </key>
- <key name="int" type="i">
- <default>0</default>
- </key>
- <key name="uint" type="u">
- <default>0</default>
- </key>
- <key name="int64" type="x">
- <default>0</default>
- </key>
- <key name="uint64" type="t">
- <default>0</default>
- </key>
- <key name="double" type="d">
- <default>0</default>
- </key>
- <key name="string" type="s">
- <default>""</default>
- </key>
- <key name="chararray" type="ay">
- <default>[48, 49]</default>
- </key>
- <key name="strv" type="as">
- <default>[]</default>
- </key>
- <key name="enum" enum="org.gtk.test.TestEnum">
- <default>'foo'</default>
- </key>
- <key name="flags" flags="org.gtk.test.TestFlags">
- <default>['mourning', 'laughing']</default>
- </key>
- <key name="range" type='u'>
- <default>33</default>
- <range min="2" max="44"/>
- </key>
- </schema>
-
- <schema id='org.gtk.test.enums' path='/tests/enums/'>
- <key name='test' enum='org.gtk.test.TestEnum'>
- <default>'bar'</default>
- <aliases>
- <alias value='qux' target='quux'/>
- </aliases>
- </key>
- <key name='f-test' flags='org.gtk.test.TestFlags'>
- <default>[]</default>
- <aliases>
- <alias value='speaking' target='talking'/>
- </aliases>
- </key>
- </schema>
-
- <schema id='org.gtk.test.enums.direct' path='/tests/enums/'>
- <key name='f-test' type='as'>
- <default>[]</default>
- </key>
- <key name='test' type='s'>
- <default>'bar'</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.range' path='/tests/range/'>
- <key name='val' type='i'>
- <default>33</default>
- <range min='2' max='44'/>
- </key>
- </schema>
-
- <schema id='org.gtk.test.range.direct' path='/tests/range/'>
- <key name='val' type='i'>
- <default>33</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.mapped' path='/tests/mapped/'>
- <key name='val' type='i'>
- <default>0</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.descriptions" path="/a/">
- <key name='a' type='i'>
- <summary>
- a paragraph.
-
- with some whitespace.
-
- because not everyone has a great editor.
-
-
-
-
- lots of space is as one.
- </summary>
- <default>0</default>
- </key>
- </schema>
-
- <schema id='org.gtk.test.extends.base'>
- <key name='int32' type='i'>
- <default>0</default>
- </key>
- <key name='string' type='s'>
- <default>''</default>
- </key>
- </schema>
- <schema id='org.gtk.test.extends.extended' extends='org.gtk.test.extends.base'>
- <override name="int32">42</override>
- <key name='another-int32' type='i'>
- <default>0</default>
- </key>
- </schema>
-
- <schema id="org.gtk.test.per-desktop" path="/tests/per-desktop/">
- <key name="desktop" type="s">
- <default>"GNOME"</default>
- </key>
- </schema>
-
-</schemalist>
diff -rupN --no-dereference glib-2.64.1/glib/gstdio.c glib-2.64.1-new/glib/gstdio.c
--- glib-2.64.1/glib/gstdio.c 2020-03-11 13:21:39.000000000 +0100
+++ glib-2.64.1-new/glib/gstdio.c 2020-03-12 13:42:05.308446311 +0100
@@ -1036,6 +1036,11 @@ g_open (const gchar *filename,
int mode)
{
#ifdef G_OS_WIN32
+ HANDLE hFile;
+ DWORD dwDesiredAccess = 0;
+ DWORD dwFlagsAndAttributes = 0;
+ DWORD dwDisposition = OPEN_EXISTING;
+ DWORD dwSharedAccess = FILE_SHARE_READ | FILE_SHARE_DELETE;
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -1046,12 +1051,114 @@ g_open (const gchar *filename,
return -1;
}
- retval = _wopen (wfilename, flags, mode);
- save_errno = errno;
+ /* Set up the access modes and other attributes */
+ if ((flags & _O_CREAT) && (mode & _S_IREAD))
+ {
+ if (! (mode & _S_IWRITE))
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */
+ }
+ if ( !(flags & _O_ACCMODE))
+ {
+ /* Equates to _O_RDONLY */
+ if (flags & _O_TRUNC)
+ {
+ errno = EINVAL;
+ g_free (wfilename);
+ return -1;
+ }
+
+ dwDesiredAccess |= GENERIC_READ;
+ dwSharedAccess |= FILE_SHARE_WRITE;
+ }
+ if (flags & _O_WRONLY)
+ {
+ if (flags & _O_RDWR)
+ {
+ errno = EINVAL;
+ g_free (wfilename);
+ return -1;
+ }
+
+ dwDesiredAccess |= GENERIC_WRITE;
+ }
+ if (flags & _O_RDWR)
+ {
+ dwDesiredAccess |= GENERIC_READ;
+ dwDesiredAccess |= GENERIC_WRITE;
+ }
+ if (flags & _O_TRUNC)
+ {
+ if (flags & _O_CREAT)
+ dwDisposition = CREATE_ALWAYS;
+ else
+ dwDisposition = TRUNCATE_EXISTING;
+ }
+ if ((flags & _O_CREAT) && !(flags & _O_TRUNC))
+ {
+ if (flags & _O_EXCL)
+ dwDisposition = CREATE_NEW;
+ else
+ dwDisposition = OPEN_ALWAYS;
+ }
+ if (flags & _O_CREAT)
+ {
+ /* Handle the other flags that can be attached to _O_CREAT */
+ if ((flags & _O_TEMPORARY) || (flags & _O_SHORT_LIVED))
+ dwFlagsAndAttributes |= FILE_ATTRIBUTE_TEMPORARY;
+
+ if (flags & _O_TEMPORARY)
+ dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE;
+ }
+ if ((flags & _O_SEQUENTIAL) || (flags & _O_APPEND))
+ {
+ dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN;
+ }
+ else if (flags & _O_RANDOM)
+ {
+ dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
+ }
+
+ if (0 == dwFlagsAndAttributes)
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
+ hFile = CreateFileW(wfilename, dwDesiredAccess, dwSharedAccess, NULL, dwDisposition, dwFlagsAndAttributes, NULL);
+
+ if (INVALID_HANDLE_VALUE == hFile)
+ {
+ retval = (-1);
+
+ switch (GetLastError ())
+ {
+#define CASE(a,b) case ERROR_##a: errno = b; break
+ CASE (FILE_NOT_FOUND, ENOENT);
+ CASE (PATH_NOT_FOUND, ENOENT);
+ CASE (ACCESS_DENIED, EACCES);
+ CASE (NOT_SAME_DEVICE, EXDEV);
+ CASE (LOCK_VIOLATION, EACCES);
+ CASE (SHARING_VIOLATION, EACCES);
+ CASE (FILE_EXISTS, EEXIST);
+ CASE (ALREADY_EXISTS, EEXIST);
+#undef CASE
+ default: errno = EIO;
+ }
+ }
+ else
+ retval = _open_osfhandle((long)hFile, flags);
- g_free (wfilename);
+ if ((-1) != retval)
+ {
+ /* We have a valid file handle. Set its translation mode to text or binary, as appropriate */
+ if ((!(flags & _O_TEXT)) && (_fmode == _O_BINARY))
+ _setmode(retval, _O_BINARY);
+ else if ((flags & _O_TEXT) || (_fmode == _O_TEXT))
+ _setmode(retval, _O_TEXT);
+ else
+ _setmode(retval, _O_BINARY);
+ }
+ save_errno = errno;
+ g_free (wfilename);
errno = save_errno;
+
return retval;
#else
int fd;
@@ -1099,6 +1206,8 @@ g_creat (const gchar *filename,
int mode)
{
#ifdef G_OS_WIN32
+ HANDLE hFile;
+ DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
int retval;
int save_errno;
@@ -1109,12 +1218,41 @@ g_creat (const gchar *filename,
return -1;
}
- retval = _wcreat (wfilename, mode);
- save_errno = errno;
+ if (mode & _S_IREAD)
+ {
+ if (! (mode & _S_IWRITE))
+ dwFlagsAndAttributes = FILE_ATTRIBUTE_READONLY; /* Sets file to 'read only' after the file gets closed */
+ }
+
+ hFile = CreateFileW(wfilename, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_DELETE),
+ NULL, CREATE_ALWAYS, dwFlagsAndAttributes, NULL);
+
+ if (INVALID_HANDLE_VALUE == hFile)
+ {
+ retval = (-1);
+
+ switch (GetLastError ())
+ {
+#define CASE(a,b) case ERROR_##a: errno = b; break
+ CASE (FILE_NOT_FOUND, ENOENT);
+ CASE (PATH_NOT_FOUND, ENOENT);
+ CASE (ACCESS_DENIED, EACCES);
+ CASE (NOT_SAME_DEVICE, EXDEV);
+ CASE (LOCK_VIOLATION, EACCES);
+ CASE (SHARING_VIOLATION, EACCES);
+ CASE (FILE_EXISTS, EEXIST);
+ CASE (ALREADY_EXISTS, EEXIST);
+#undef CASE
+ default: errno = EIO;
+ }
+ }
+ else
+ retval = _open_osfhandle((long)hFile, _O_RDWR);
+ save_errno = errno;
g_free (wfilename);
-
errno = save_errno;
+
return retval;
#else
return creat (filename, mode);
@@ -1556,34 +1694,102 @@ g_fopen (const gchar *filename,
const gchar *mode)
{
#ifdef G_OS_WIN32
- wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
- wchar_t *wmode;
- FILE *retval;
- int save_errno;
-
- if (wfilename == NULL)
- {
- errno = EINVAL;
- return NULL;
- }
-
- wmode = g_utf8_to_utf16 (mode, -1, NULL, NULL, NULL);
-
- if (wmode == NULL)
- {
- g_free (wfilename);
- errno = EINVAL;
- return NULL;
- }
-
- _g_win32_fix_mode (wmode);
- retval = _wfopen (wfilename, wmode);
- save_errno = errno;
-
- g_free (wfilename);
- g_free (wmode);
-
- errno = save_errno;
+ int hFile;
+ int flags = 0;
+ gchar priv_mode[4];
+ FILE *retval = NULL;
+
+ if ((NULL == filename) || (NULL == mode))
+ {
+ errno = EINVAL;
+ goto out;
+ }
+ if ((strlen(mode) < 1) || (strlen(mode) > 3))
+ {
+ errno - EINVAL;
+ goto out;
+ }
+
+ strncpy(priv_mode, mode, 3);
+ priv_mode[3] = '\0';
+
+ /* Set up any flags to pass to 'g_open()' */
+ if (3 == strlen(priv_mode))
+ {
+ if (('c' == priv_mode[2]) || ('n' == priv_mode[2]))
+ priv_mode[2] = '\0';
+ else
+ {
+ if (0 == strcmp(priv_mode, "a+b"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "a+t"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND | _O_TEXT;
+ else if (0 == strcmp(priv_mode, "r+b"))
+ flags = _O_RDWR | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "r+t"))
+ flags = _O_RDWR | _O_TEXT;
+ else if (0 == strcmp(priv_mode, "w+b"))
+ flags = _O_RDWR | _O_CREAT |_O_TRUNC | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "w+t"))
+ flags = _O_RDWR | _O_CREAT |_O_TRUNC | _O_TEXT;
+ else
+ {
+ errno = EINVAL;
+ goto out;
+ }
+ }
+ }
+ if (2 == strlen(priv_mode))
+ {
+ if (('c' == priv_mode[1]) || ('n' == priv_mode[1]))
+ priv_mode[1] = '\0';
+ else
+ {
+ if (0 == strcmp(priv_mode, "a+"))
+ flags = _O_RDWR | _O_CREAT | _O_APPEND;
+ else if (0 == strcmp(priv_mode, "ab"))
+ flags = _O_WRONLY | _O_CREAT | _O_APPEND | _O_BINARY;
+ else if (0 == strcmp(priv_mode, "at"))
+ flags = _O_WRONLY | _O_CREAT | _O_APPEND | _O_TEXT;