The older 0.28 version has a buggy --msvc-syntax option: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8717#note_3001648 This 32-bit version was compiled from our meson port of pkg-config: https://gitlab.freedesktop.org/gstreamer/meson-ports/pkg-config The toolchain used was MSYS2's mingw32-gcc toolchain `mingw-w64-i686-gcc` so that it uses 32-bit MSVCRT, which gives it maximum compatibility with all Windows versions. UCRT DLLs are specific to the VS version and Windows version. This version will also not insert any system library or include paths, like the previous 0.28 version. The build commands were: ``` meson setup --optimization=s --strip \ --wrap-mode=forcefallback \ -Dpc_path='' \ -Dsystem_include_path='' \ -Dsystem_library_path='' \ _mingw32 meson install --destdir $PWD/install -C _mingw32 cp install/bin/pkg-config.exe . zip pkg-config-$VERSION.zip pkg-config.exe ``` Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9376>
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
import ssl
|
|
import zipfile
|
|
import hashlib
|
|
import urllib.request
|
|
import urllib.error
|
|
|
|
# Disable certificate checking because it always fails on Windows
|
|
# We verify the checksum anyway.
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
MIRROR_URL = 'https://gstreamer.freedesktop.org/src/mirror/pkg-config/pkg-config-{}.zip'
|
|
|
|
version = sys.argv[1]
|
|
zip_sha256 = sys.argv[2]
|
|
source_dir = os.path.join(
|
|
os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])
|
|
url = MIRROR_URL.format(version)
|
|
dest = os.path.basename(url)
|
|
dest_path = os.path.join(source_dir, dest)
|
|
|
|
|
|
def get_sha256(zipf):
|
|
hasher = hashlib.sha256()
|
|
with open(zipf, 'rb') as f:
|
|
hasher.update(f.read())
|
|
return hasher.hexdigest()
|
|
|
|
|
|
if os.path.isfile(dest_path):
|
|
found_sha256 = get_sha256(dest_path)
|
|
if found_sha256 == zip_sha256:
|
|
print('{} already downloaded'.format(dest))
|
|
sys.exit(0)
|
|
else:
|
|
print('{} checksum mismatch, redownloading'.format(dest))
|
|
|
|
print('Downloading {} to {}'.format(url, dest))
|
|
try:
|
|
with open(dest_path, 'wb') as d:
|
|
f = urllib.request.urlopen(url, context=ctx)
|
|
d.write(f.read())
|
|
except urllib.error.URLError as ex:
|
|
curdir = os.path.dirname(sys.argv[0])
|
|
print('Couldn\'t download {!r}! Try downloading it manually and '
|
|
'placing it into {!r}'.format(dest, curdir))
|
|
|
|
found_sha256 = get_sha256(dest_path)
|
|
if found_sha256 != zip_sha256:
|
|
print('SHA256 of downloaded file {} was {} instead of {}'
|
|
''.format(dest, found_sha256, zip_sha256))
|
|
sys.exit(1)
|
|
|
|
print('Extracting {}'.format(dest))
|
|
zf = zipfile.ZipFile(dest_path, "r")
|
|
zf.extractall(path=source_dir)
|