make zlib and other makefile packages able to use emscripten
- also, bzip2 fix
This commit is contained in:
@@ -514,6 +514,12 @@ def _set_variables_for_single_module(pkg, module):
|
||||
# TODO: make these build deps that can be installed if not found.
|
||||
# FIXME: !!!!!
|
||||
m.make = MakeExecutable('make', jobs)
|
||||
m.emmake = MakeExecutable('emmake', jobs)
|
||||
m.emmake.add_default_arg('make')
|
||||
m.emmake.add_default_arg('AR=emar')
|
||||
m.emmake.add_default_arg('RANLIB=emranlib')
|
||||
m.emmake.add_default_arg('NM=emnm')
|
||||
|
||||
m.gmake = MakeExecutable('gmake', jobs)
|
||||
m.scons = MakeExecutable('scons', jobs)
|
||||
m.ninja = MakeExecutable('ninja', jobs)
|
||||
|
@@ -82,6 +82,9 @@ def build(self, spec, prefix):
|
||||
as targets.
|
||||
"""
|
||||
with working_dir(self.build_directory):
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
inspect.getmodule(self).emmake(*self.build_targets)
|
||||
else:
|
||||
inspect.getmodule(self).make(*self.build_targets)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
@@ -89,6 +92,9 @@ def install(self, spec, prefix):
|
||||
as targets.
|
||||
"""
|
||||
with working_dir(self.build_directory):
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
inspect.getmodule(self).emmake(*self.install_targets)
|
||||
else:
|
||||
inspect.getmodule(self).make(*self.install_targets)
|
||||
|
||||
run_after('build')(PackageBase._run_default_build_time_test_callbacks)
|
||||
|
@@ -1775,6 +1775,9 @@ def _if_make_target_execute(self, target, *args, **kwargs):
|
||||
"""
|
||||
if self._has_make_target(target):
|
||||
# Execute target
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
inspect.getmodule(self).emmake(target, *args, **kwargs)
|
||||
else:
|
||||
inspect.getmodule(self).make(target, *args, **kwargs)
|
||||
|
||||
def _has_ninja_target(self, target):
|
||||
|
67
var/spack/repos/builtin/packages/bzip2/no-tty-checking.patch
Normal file
67
var/spack/repos/builtin/packages/bzip2/no-tty-checking.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
diff --git a/bzip2.c b/bzip2.c
|
||||
index d95d280..30429ea 100644
|
||||
--- a/bzip2.c
|
||||
+++ b/bzip2.c
|
||||
@@ -1227,30 +1227,11 @@ void compress ( Char *name )
|
||||
case SM_I2O:
|
||||
inStr = stdin;
|
||||
outStr = stdout;
|
||||
- if ( isatty ( fileno ( stdout ) ) ) {
|
||||
- fprintf ( stderr,
|
||||
- "%s: I won't write compressed data to a terminal.\n",
|
||||
- progName );
|
||||
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
|
||||
- progName, progName );
|
||||
- setExit(1);
|
||||
- return;
|
||||
- };
|
||||
break;
|
||||
|
||||
case SM_F2O:
|
||||
inStr = fopen ( inName, "rb" );
|
||||
outStr = stdout;
|
||||
- if ( isatty ( fileno ( stdout ) ) ) {
|
||||
- fprintf ( stderr,
|
||||
- "%s: I won't write compressed data to a terminal.\n",
|
||||
- progName );
|
||||
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
|
||||
- progName, progName );
|
||||
- if ( inStr != NULL ) fclose ( inStr );
|
||||
- setExit(1);
|
||||
- return;
|
||||
- };
|
||||
if ( inStr == NULL ) {
|
||||
fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
|
||||
progName, inName, strerror(errno) );
|
||||
@@ -1413,15 +1394,6 @@ void uncompress ( Char *name )
|
||||
case SM_I2O:
|
||||
inStr = stdin;
|
||||
outStr = stdout;
|
||||
- if ( isatty ( fileno ( stdin ) ) ) {
|
||||
- fprintf ( stderr,
|
||||
- "%s: I won't read compressed data from a terminal.\n",
|
||||
- progName );
|
||||
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
|
||||
- progName, progName );
|
||||
- setExit(1);
|
||||
- return;
|
||||
- };
|
||||
break;
|
||||
|
||||
case SM_F2O:
|
||||
@@ -1554,15 +1526,6 @@ void testf ( Char *name )
|
||||
switch ( srcMode ) {
|
||||
|
||||
case SM_I2O:
|
||||
- if ( isatty ( fileno ( stdin ) ) ) {
|
||||
- fprintf ( stderr,
|
||||
- "%s: I won't read compressed data from a terminal.\n",
|
||||
- progName );
|
||||
- fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
|
||||
- progName, progName );
|
||||
- setExit(1);
|
||||
- return;
|
||||
- };
|
||||
inStr = stdin;
|
||||
break;
|
||||
|
@@ -28,6 +28,8 @@ class Bzip2(Package, SourcewarePackage):
|
||||
variant('pic', default=False, description='Build static libraries with PIC')
|
||||
variant('debug', default=False, description='Enable debug symbols and disable optimization')
|
||||
|
||||
patch('no-tty-checking.patch', when='%emscripten')
|
||||
|
||||
depends_on('diffutils', type='build')
|
||||
|
||||
@classmethod
|
||||
@@ -99,6 +101,9 @@ def patch(self):
|
||||
**kwargs)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
make = emmake
|
||||
|
||||
# Build the dynamic library first
|
||||
if '+shared' in spec:
|
||||
make('-f', 'Makefile-libbz2_so')
|
||||
@@ -107,6 +112,15 @@ def install(self, spec, prefix):
|
||||
make()
|
||||
make('install', 'PREFIX={0}'.format(prefix))
|
||||
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
install('bzip2.wasm',
|
||||
join_path(prefix.bin, 'bzip2.wasm'))
|
||||
install('bzip2recover.wasm',
|
||||
join_path(prefix.bin, 'bzip2recover.wasm'))
|
||||
if '+shared' in spec:
|
||||
install('bzip2-shared.wasm',
|
||||
join_path(prefix.bin, 'bzip2-shared.wasm'))
|
||||
|
||||
if '+shared' in spec:
|
||||
install('bzip2-shared', join_path(prefix.bin, 'bzip2'))
|
||||
|
||||
|
@@ -75,12 +75,13 @@ def install(self, spec, prefix):
|
||||
nmake('-f' 'win32\\Makefile.msc')
|
||||
self.win_install()
|
||||
else:
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
configure = emconfigure
|
||||
make = emmake
|
||||
|
||||
config_args = []
|
||||
if '~shared' in spec:
|
||||
config_args.append('--static')
|
||||
if self.spec.satisfies('%emscripten'):
|
||||
emconfigure('--prefix={0}'.format(prefix), *config_args)
|
||||
else:
|
||||
configure('--prefix={0}'.format(prefix), *config_args)
|
||||
|
||||
make()
|
||||
|
Reference in New Issue
Block a user