1
+ # Copyright 2016 The Emscripten Authors. All rights reserved.
2
+ # Emscripten is available under two separate licenses, the MIT license and the
3
+ # University of Illinois/NCSA Open Source License. Both these licenses can be
4
+ # found in the LICENSE file.
5
+
1
6
import os
2
7
import shutil
3
- import stat
8
+ import logging
4
9
5
10
TAG = 'release-2.0.1'
6
11
HASH = '81fac757bd058adcb3eb5b2cc46addeaa44cee2cd4db653dad5d9666bdc0385cdc21bf5b72872e6dd6dd8eb65812a46d7752298827d6c61ad5ce2b6c963f7ed0'
@@ -13,29 +18,28 @@ def get(ports, settings, shared):
13
18
sdl_build = os .path .join (ports .get_build_dir (), 'sdl2' )
14
19
assert os .path .exists (sdl_build ), 'You must use SDL2 to use SDL2_mixer'
15
20
ports .fetch_project ('sdl2_mixer' , 'https://github.com/emscripten-ports/SDL2_mixer/archive/' + TAG + '.zip' , 'SDL2_mixer-' + TAG , sha512hash = HASH )
21
+ libname = ports .get_lib_name ('libSDL2_mixer' )
16
22
17
23
def create ():
18
- cwd = os .getcwd ()
19
- commonflags = ['--disable-shared' , '--disable-music-cmd' , '--enable-sdltest' , '--disable-smpegtest' ]
20
- formatflags = ['--enable-music-wave' , '--disable-music-mod' , '--disable-music-midi' , '--enable-music-ogg' , '--disable-music-ogg-shared' , '--disable-music-flac' , '--disable-music-mp3' ]
21
- configure = os .path .join (ports .get_dir (), 'sdl2_mixer' , 'SDL2_mixer-' + TAG , 'configure' )
22
- build_dir = os .path .join (ports .get_build_dir (), 'sdl2_mixer' )
23
- dist_dir = os .path .join (ports .get_build_dir (), 'sdl2_mixer' , 'dist' )
24
- out = os .path .join (dist_dir , 'lib' , 'libSDL2_mixer.a' )
25
- final = os .path .join (ports .get_build_dir (), 'sdl2_mixer' , 'libSDL2_mixer.a' )
26
- shared .safe_ensure_dirs (build_dir )
27
-
28
- try :
29
- os .chdir (build_dir )
30
- os .chmod (configure , os .stat (configure ).st_mode | stat .S_IEXEC )
31
- shared .run_process ([shared .PYTHON , shared .EMCONFIGURE , configure , '--prefix=' + dist_dir ] + formatflags + commonflags + ['CFLAGS=-s USE_VORBIS=1' ])
32
- shared .run_process ([shared .PYTHON , shared .EMMAKE , 'make' , 'install' ])
33
- shutil .copyfile (out , final )
34
- finally :
35
- os .chdir (cwd )
24
+ logging .info ('building port: sdl2_mixer' )
25
+
26
+ source_path = os .path .join (ports .get_dir (), 'sdl2_mixer' , 'SDL2_mixer-' + TAG )
27
+ dest_path = os .path .join (shared .Cache .get_path ('ports-builds' ), 'sdl2_mixer' )
28
+
29
+ shutil .rmtree (dest_path , ignore_errors = True )
30
+ shutil .copytree (source_path , dest_path )
31
+ # necessary for proper including of SDL_mixer.h
32
+ os .symlink (dest_path , os .path .join (dest_path , 'SDL2' ))
33
+
34
+ final = os .path .join (dest_path , libname )
35
+ ports .build_port (dest_path , final , [], ['-DOGG_MUSIC' , '-s' , 'USE_VORBIS=1' ],
36
+ ['dynamic_flac' , 'dynamic_fluidsynth' , 'dynamic_mod' , 'dynamic_modplug' , 'dynamic_mp3' ,
37
+ 'dynamic_ogg' , 'fluidsynth' , 'load_mp3' , 'music_cmd' , 'music_flac' , 'music_mad' , 'music_mod' ,
38
+ 'music_modplug' , 'playmus.c' , 'playwave.c' ],
39
+ ['external' , 'native_midi' , 'timidity' ])
36
40
return final
37
41
38
- return [shared .Cache .get ('libSDL2_mixer.a' , create , what = 'port' )]
42
+ return [shared .Cache .get (libname , create , what = 'port' )]
39
43
40
44
41
45
def clear (ports , shared ):
@@ -51,7 +55,7 @@ def process_dependencies(settings):
51
55
def process_args (ports , args , settings , shared ):
52
56
if settings .USE_SDL_MIXER == 2 :
53
57
get (ports , settings , shared )
54
- args += ['-Xclang' , '-isystem' + os .path .join (shared .Cache .get_path ('ports-builds' ), 'sdl2_mixer' , 'dist' , 'include' )]
58
+ args += ['-Xclang' , '-isystem' + os .path .join (shared .Cache .get_path ('ports-builds' ), 'sdl2_mixer' )]
55
59
return args
56
60
57
61
0 commit comments