Skip to content

Commit

Permalink
Added --prefix option to acprep
Browse files Browse the repository at this point in the history
Signed-off-by: Priit Laes <plaes@plaes.org>
  • Loading branch information
plaes authored and jwiegley committed Jun 13, 2010
1 parent 0c699e4 commit 7ef478b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion acprep
Expand Up @@ -357,7 +357,7 @@ class CommandLineApp(object):
exit_code = self.handleMainException()
if self.options.debug:
raise

if self.force_exit:
sys.exit(exit_code)
return exit_code
Expand All @@ -376,6 +376,7 @@ class PrepareBuild(CommandLineApp):
self.current_ver = None
#self.current_flavor = 'default'
self.current_flavor = 'debug'
self.prefix_dir = None
self.products_dir = None
self.build_dir = self.source_dir
self.configure_args = ['--with-included-gettext', '--enable-python']
Expand Down Expand Up @@ -502,6 +503,9 @@ class PrepareBuild(CommandLineApp):
op.add_option('', '--pic', action="callback",
callback=self.option_pic,
help='Compile with explicit PIC support')
op.add_option('', '--prefix', metavar='DIR', action="callback",
callback=self.option_prefix, type="string",
help='Use custom installation prefix')
op.add_option('', '--products', metavar='DIR', action="callback",
callback=self.option_products,
help='Collect all build products in this directory')
Expand Down Expand Up @@ -584,6 +588,9 @@ class PrepareBuild(CommandLineApp):
# Determine information about the surroundings #
#########################################################################

def prefix_directory(self):
return self.prefix_dir if self.prefix_dir else None

def default_products_directory(self):
if self.envvars['LEDGER_PRODUCTS']:
return self.envvars['LEDGER_PRODUCTS']
Expand Down Expand Up @@ -665,6 +672,8 @@ class PrepareBuild(CommandLineApp):
self.log.info("Source directory => " + self.source_dir)
self.log.info("Need to run autogen.sh => " +
str(self.need_to_prepare_autotools()))
if self.prefix_directory():
self.log.info("Installation prefix => " + self.prefix_directory())
self.log.info("Products directory => " + self.products_directory())
self.log.info("Build directory => " + self.build_directory())
self.log.info("Need to run configure => " +
Expand Down Expand Up @@ -1163,6 +1172,10 @@ class PrepareBuild(CommandLineApp):
self.log.debug('Saw option --output')
self.build_dir = value

def option_prefix(self, option=None, opt_str=None, value=None, parser=None):
self.log.debug('Saw option --prefix')
self.prefix_dir = value

def option_products(self, option=None, opt_str=None, value=None, parser=None):
self.log.debug('Saw option --products')
self.products_dir = value
Expand Down Expand Up @@ -1320,6 +1333,9 @@ class PrepareBuild(CommandLineApp):
conf_args.append('--with-boost-suffix=%s' %
self.boost_info.get_suffix())

if self.prefix_directory():
conf_args.append('--prefix=%s' % self.prefix_directory())

return (environ, conf_args + self.configure_args)

def need_to_run_configure(self):
Expand Down Expand Up @@ -1514,6 +1530,7 @@ class PrepareBuild(CommandLineApp):
self.build_dir = None # use the build/ tree
self.current_flavor = flavor
self.option_release()
self.prefix_dir = None

if reset and exists(self.build_directory()) and \
isdir(self.build_directory()):
Expand Down

0 comments on commit 7ef478b

Please sign in to comment.