mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-11-04 02:11:39 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From: Jakub Jirutka <jakub@jirutka.cz>
 | 
						|
Date: Mon, 3 Apr 2017 20:49:00 +0200
 | 
						|
Subject: [PATCH] Add support for global r/o cache of prebuilt libraries
 | 
						|
 | 
						|
--- a/tools/cache.py
 | 
						|
+++ b/tools/cache.py
 | 
						|
@@ -29,9 +29,12 @@
 | 
						|
 
 | 
						|
     if use_subdir:
 | 
						|
       if os.environ.get('EMCC_WASM_BACKEND') and os.environ.get('EMCC_WASM_BACKEND') != '0':
 | 
						|
-        dirname = os.path.join(dirname, 'wasm')
 | 
						|
+        self.subdir = 'wasm'
 | 
						|
       else:
 | 
						|
-        dirname = os.path.join(dirname, 'asmjs')
 | 
						|
+        self.subdir = 'asmjs'
 | 
						|
+      dirname = os.path.join(dirname, self.subdir)
 | 
						|
+    else:
 | 
						|
+      self.subdir = ''
 | 
						|
     self.dirname = dirname
 | 
						|
     self.debug = debug
 | 
						|
 
 | 
						|
@@ -90,6 +93,11 @@
 | 
						|
       if what is None:
 | 
						|
         if shortname.endswith(('.bc', '.so', '.a')): what = 'system library'
 | 
						|
         else: what = 'system asset'
 | 
						|
+      if shared.GLOBAL_CACHE_DIR and os.getenv('EM_USE_GLOBAL_CACHE') == '1' and not force:
 | 
						|
+        path = os.path.join(shared.GLOBAL_CACHE_DIR, self.subdir, shortname)
 | 
						|
+        if os.path.exists(path):
 | 
						|
+          logging.info('using %s: %s from global cache: %s' % (what, shortname, path))
 | 
						|
+          return path
 | 
						|
       message = 'generating ' + what + ': ' + shortname + '... (this will be cached in "' + cachename + '" for subsequent builds)'
 | 
						|
       logging.info(message)
 | 
						|
       self.ensure()
 |