Skip to content

Commit 68d6c7b

Browse files
committed
adapt ports changes
1 parent bc1a4fd commit 68d6c7b

File tree

3 files changed

+23
-27
lines changed

3 files changed

+23
-27
lines changed

tools/ports/__init__.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,17 @@ def fetch_project(name, url, sha512hash=None):
222222
port = ports_by_name.get(name)
223223
if not port:
224224
utils.exit_with_error('%s is not a known port' % name)
225-
if not hasattr(port, 'SUBDIR'):
226-
utils.exit_with_error(f'port {name} lacks .SUBDIR attribute, which we need in order to override it locally, please update it')
227-
subdir = port.SUBDIR
228-
target = os.path.join(fullname, subdir)
229-
230-
uptodate_message = f'not grabbing local port: {name} from {path} to {fullname} (subdir: {subdir}) as the destination {target} is newer (run emcc --clear-ports if that is incorrect)'
231-
# before acquiring the lock we have an early out if the port already exists
232-
if os.path.exists(target) and dir_is_newer(path, target):
233-
logger.warning(uptodate_message)
225+
226+
srcZip = os.path.join(path, name + '.zip')
227+
dstZip = os.path.join(Ports.get_dir(), name + '.zip')
228+
if os.path.exists(dstZip) and (os.path.getmtime(dstZip) >= os.path.getmtime(srcZip)):
229+
#early return before locking
234230
return
235-
with cache.lock('unpack local port'):
236-
# Another early out in case another process unpackage the library while we were
237-
# waiting for the lock
238-
if os.path.exists(target) and not dir_is_newer(path, target):
239-
logger.warning(uptodate_message)
240-
return
241-
logger.warning(f'grabbing local port: {name} from {path} to {fullname} (subdir: {subdir})')
242-
utils.delete_dir(fullname)
243-
shutil.copytree(path, target)
231+
with cache.lock('unpack local port'):
232+
if not os.path.exists(dstZip) or (os.path.getmtime(dstZip) < os.path.getmtime(srcZip)):
233+
logger.info('copying port sources from ' + srcZip + ' to ' + dstZip)
234+
shutil.copyfile(srcZip, dstZip)
235+
shutil.unpack_archive(filename=dstZip, extract_dir=fullname)
244236
Ports.clear_project_build(name)
245237
return
246238

tools/ports/freetype.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
import os
77

8-
TAG = 'version_1'
9-
HASH = '0d0b1280ba0501ad0a23cf1daa1f86821c722218b59432734d3087a89acd22aabd5c3e5e1269700dcd41e87073046e906060f167c032eb91a3ac8c5808a02783'
10-
8+
TAG = 'version_2'
119
variants = {'freetype-wasm-sjlj': {'SUPPORT_LONGJMP': 'wasm'}}
1210

1311

@@ -23,7 +21,7 @@ def get_lib_name(settings):
2321

2422

2523
def get(ports, settings, shared):
26-
ports.fetch_project('freetype', f'https://github.com/emscripten-ports/FreeType/archive/{TAG}.zip', sha512hash=HASH)
24+
ports.fetch_project('freetype', '', 'FreeType-' + TAG)
2725

2826
def create(final):
2927
source_path = os.path.join(ports.get_dir(), 'freetype', 'FreeType-' + TAG)
@@ -47,6 +45,7 @@ def create(final):
4745
'src/base/ftgloadr.c',
4846
'src/base/ftglyph.c',
4947
'src/base/ftgxval.c',
48+
'src/base/fthash.c',
5049
'src/base/ftinit.c',
5150
'src/base/ftlcdfil.c',
5251
'src/base/ftmm.c',
@@ -55,6 +54,7 @@ def create(final):
5554
'src/base/ftoutln.c',
5655
'src/base/ftpatent.c',
5756
'src/base/ftpfr.c',
57+
'src/base/ftpsprop.c',
5858
'src/base/ftrfork.c',
5959
'src/base/ftsnames.c',
6060
'src/base/ftstream.c',
@@ -78,6 +78,12 @@ def create(final):
7878
'src/pshinter/pshinter.c',
7979
'src/psnames/psmodule.c',
8080
'src/raster/raster.c',
81+
'src/sdf/ftsdfrend.c',
82+
'src/sdf/ftsdf.c',
83+
'src/sdf/ftbsdf.c',
84+
'src/sdf/ftsdfcommon.c',
85+
'src/sdf/sdf.c',
86+
'src/svg/ftsvg.c',
8187
'src/sfnt/sfnt.c',
8288
'src/smooth/smooth.c',
8389
'src/truetype/truetype.c',

tools/ports/zlib.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55

66
import os
77

8-
VERSION = '1.2.13'
9-
HASH = '44b834fbfb50cca229209b8dbe1f96b258f19a49f5df23b80970b716371d856a4adf525edb4c6e0e645b180ea949cb90f5365a1d896160f297f56794dd888659'
10-
8+
TAG = 'version_2'
119

1210
def needed(settings):
1311
return settings.USE_ZLIB
1412

1513

1614
def get(ports, settings, shared):
17-
ports.fetch_project('zlib', f'https://github.com/madler/zlib/archive/refs/tags/v{VERSION}.tar.gz', sha512hash=HASH)
15+
ports.fetch_project('zlib', '', 'zlib-' + TAG)
1816

1917
def create(final):
20-
source_path = os.path.join(ports.get_dir(), 'zlib', 'zlib-' + VERSION)
18+
source_path = os.path.join(ports.get_dir(), 'zlib', 'zlib-' + TAG)
2119
ports.write_file(os.path.join(source_path, 'zconf.h'), zconf_h)
2220
ports.install_headers(source_path)
2321

0 commit comments

Comments
 (0)