mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Partial AIX .so support
[SVN r13702]
This commit is contained in:
@@ -188,21 +188,25 @@ rule Link-EXE
|
||||
|
||||
rule Link-DLL
|
||||
{
|
||||
if $(<[2])
|
||||
{
|
||||
MODE on $(<[2]) = $(IMPMODE) ;
|
||||
Chmod $(<[2]) ;
|
||||
}
|
||||
|
||||
gRUN_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
if $(UNIX)
|
||||
{
|
||||
RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(<))) $(RUN_LD_LIBRARY_PATH) : $(SPLITPATH) ] ;
|
||||
gRUN_LD_LIBRARY_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
}
|
||||
|
||||
if $(OS) = AIX
|
||||
{
|
||||
Aix-Implib-Action $(<) : $(>) ;
|
||||
}
|
||||
Link-action $(<) : $(>) : DLL ;
|
||||
}
|
||||
|
||||
actions Aix-Implib-Action bind import-generator-script
|
||||
{
|
||||
"$(BOOST_ROOT)/tools/build/gen_aix_import_file.py" $(<[1]:BD=) $(>:D=) "-directory=$(<[1]:D)" -verbose=1
|
||||
}
|
||||
|
||||
# store the shell's PATH again, just in case someone uses PATH.
|
||||
# This also allows the user to customize the base path for running built
|
||||
# products from the command-line
|
||||
|
||||
107
gen_aix_import_file.py
Normal file
107
gen_aix_import_file.py
Normal file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Valid arguments
|
||||
setValueArgs = {"-ld" : "LD",
|
||||
"-ldflags" : "LDFLAGS",
|
||||
"-optldflags" : "OPTLDFLAGS",
|
||||
"-impfilename" : "IMPFILENAME",
|
||||
"-expflag" : "EXPFLAG",
|
||||
"-maxlinelength" : "maxlinelength",
|
||||
"-verbose" : "chatty",
|
||||
"-directory" : "CHDIR" }
|
||||
validArgs = setValueArgs.keys()
|
||||
|
||||
# Little function to generate a usage statement.
|
||||
def printUsage():
|
||||
print "Usage: generateImportFile <target lib base name>"
|
||||
|
||||
# Helper to execute the given command string in the host OS.
|
||||
def execCommand(command, chatty):
|
||||
if chatty:
|
||||
print command
|
||||
import os
|
||||
os.system(command)
|
||||
|
||||
# Default values for the important vars
|
||||
LD = "xlC_r"
|
||||
LDFLAGS = "-G -qmkshrobj"
|
||||
OPTLDFLAGS = ""
|
||||
EXPFLAG = "-qexpfile"
|
||||
maxlinelength = 4095
|
||||
OBJS = ""
|
||||
chatty = None
|
||||
|
||||
import sys
|
||||
nargs = len(sys.argv)
|
||||
if nargs < 2:
|
||||
printUsage()
|
||||
exit(1)
|
||||
|
||||
# Get the name of the lib target.
|
||||
LIBTARGET = sys.argv[1]
|
||||
if LIBTARGET[-3:] != ".so":
|
||||
LIBTARGET += ".so"
|
||||
|
||||
# The default name for the export and import files we'll be generating.
|
||||
EXPFILENAME = LIBTARGET[:-3] + ".exp"
|
||||
IMPFILENAME = LIBTARGET[:-3] + ".imp"
|
||||
|
||||
CHDIR = "."
|
||||
|
||||
# Parse optional arguments
|
||||
for iarg in xrange(2, nargs):
|
||||
arg = sys.argv[iarg]
|
||||
|
||||
# Is this a -thingy=thingyValue argument?
|
||||
if arg[0] == "-":
|
||||
assert arg.count("=") == 1
|
||||
argKey, argValue = arg.split("=")
|
||||
if argKey not in validArgs:
|
||||
printUsage()
|
||||
exit(1)
|
||||
|
||||
exec("%s = '%s'" % (setValueArgs[argKey], argValue))
|
||||
print "Setting " + setValueArgs[argKey] + " to " + argValue
|
||||
|
||||
# Is this an object file/lib that needs to be linked in?
|
||||
elif arg[-2:] == ".o" or arg[-2:] == ".a" or arg[-3:] == ".so":
|
||||
OBJS += arg + " "
|
||||
|
||||
else:
|
||||
printUsage()
|
||||
exit()
|
||||
|
||||
import os
|
||||
os.chdir(CHDIR)
|
||||
|
||||
# Generate the export file by creating the shared obj library, which we then
|
||||
# promptly delete.
|
||||
command = LD + " " + LDFLAGS + " " + OPTLDFLAGS + " " + \
|
||||
EXPFLAG + "=" + EXPFILENAME + " " + \
|
||||
OBJS + " -o " + LIBTARGET
|
||||
execCommand(command, chatty)
|
||||
execCommand("rm -f " + LIBTARGET, chatty)
|
||||
|
||||
# Create the import file, and put the required tag as the first line indicating
|
||||
# the name of the archive which is exporting these symbols.
|
||||
impfile = open(IMPFILENAME, 'w')
|
||||
impfile.write("#!" + LIBTARGET + "\n")
|
||||
|
||||
# Attach the list of symbols being exported to the import file.
|
||||
expfile = open(EXPFILENAME, 'r')
|
||||
symbol = expfile.readline()
|
||||
while symbol:
|
||||
if maxlinelength:
|
||||
symbol = symbol[:maxlinelength]
|
||||
if symbol[-1] != '\n':
|
||||
symbol += '\n'
|
||||
impfile.write(symbol)
|
||||
symbol = expfile.readline()
|
||||
impfile.close()
|
||||
expfile.close()
|
||||
|
||||
#command = "cat " + EXPFILENAME + " >> " + IMPFILENAME
|
||||
#execCommand(command, chatty)
|
||||
|
||||
# Remove the export file.
|
||||
execCommand("rm -f " + EXPFILENAME, chatty)
|
||||
@@ -48,7 +48,7 @@ rule Link-action
|
||||
|
||||
actions kcc-Link-action bind NEEDLIBS
|
||||
{
|
||||
$(kcc.bin-directory)KCC $(LINKFLAGS) -o "$(<)" -L$(STDLIBPATH) "$(>)" $(NEEDLIBS) -lm
|
||||
$(kcc.bin-directory)KCC $(LINKFLAGS) -o "$(<[1])" -L$(STDLIBPATH) "$(>)" $(NEEDLIBS) -lm
|
||||
}
|
||||
|
||||
#### Cc #####
|
||||
|
||||
@@ -241,12 +241,6 @@ if $(NT)
|
||||
|
||||
rule Link-PYD
|
||||
{
|
||||
if $(<[2])
|
||||
{
|
||||
MODE on $(<[2]) = $(IMPMODE) ;
|
||||
Chmod $(<[2]) ;
|
||||
}
|
||||
|
||||
gRUN_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
if $(UNIX)
|
||||
{
|
||||
|
||||
@@ -188,21 +188,25 @@ rule Link-EXE
|
||||
|
||||
rule Link-DLL
|
||||
{
|
||||
if $(<[2])
|
||||
{
|
||||
MODE on $(<[2]) = $(IMPMODE) ;
|
||||
Chmod $(<[2]) ;
|
||||
}
|
||||
|
||||
gRUN_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
if $(UNIX)
|
||||
{
|
||||
RUN_LD_LIBRARY_PATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(<))) $(RUN_LD_LIBRARY_PATH) : $(SPLITPATH) ] ;
|
||||
gRUN_LD_LIBRARY_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
}
|
||||
|
||||
if $(OS) = AIX
|
||||
{
|
||||
Aix-Implib-Action $(<) : $(>) ;
|
||||
}
|
||||
Link-action $(<) : $(>) : DLL ;
|
||||
}
|
||||
|
||||
actions Aix-Implib-Action bind import-generator-script
|
||||
{
|
||||
"$(BOOST_ROOT)/tools/build/gen_aix_import_file.py" $(<[1]:BD=) $(>:D=) "-directory=$(<[1]:D)" -verbose=1
|
||||
}
|
||||
|
||||
# store the shell's PATH again, just in case someone uses PATH.
|
||||
# This also allows the user to customize the base path for running built
|
||||
# products from the command-line
|
||||
|
||||
107
v1/gen_aix_import_file.py
Normal file
107
v1/gen_aix_import_file.py
Normal file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Valid arguments
|
||||
setValueArgs = {"-ld" : "LD",
|
||||
"-ldflags" : "LDFLAGS",
|
||||
"-optldflags" : "OPTLDFLAGS",
|
||||
"-impfilename" : "IMPFILENAME",
|
||||
"-expflag" : "EXPFLAG",
|
||||
"-maxlinelength" : "maxlinelength",
|
||||
"-verbose" : "chatty",
|
||||
"-directory" : "CHDIR" }
|
||||
validArgs = setValueArgs.keys()
|
||||
|
||||
# Little function to generate a usage statement.
|
||||
def printUsage():
|
||||
print "Usage: generateImportFile <target lib base name>"
|
||||
|
||||
# Helper to execute the given command string in the host OS.
|
||||
def execCommand(command, chatty):
|
||||
if chatty:
|
||||
print command
|
||||
import os
|
||||
os.system(command)
|
||||
|
||||
# Default values for the important vars
|
||||
LD = "xlC_r"
|
||||
LDFLAGS = "-G -qmkshrobj"
|
||||
OPTLDFLAGS = ""
|
||||
EXPFLAG = "-qexpfile"
|
||||
maxlinelength = 4095
|
||||
OBJS = ""
|
||||
chatty = None
|
||||
|
||||
import sys
|
||||
nargs = len(sys.argv)
|
||||
if nargs < 2:
|
||||
printUsage()
|
||||
exit(1)
|
||||
|
||||
# Get the name of the lib target.
|
||||
LIBTARGET = sys.argv[1]
|
||||
if LIBTARGET[-3:] != ".so":
|
||||
LIBTARGET += ".so"
|
||||
|
||||
# The default name for the export and import files we'll be generating.
|
||||
EXPFILENAME = LIBTARGET[:-3] + ".exp"
|
||||
IMPFILENAME = LIBTARGET[:-3] + ".imp"
|
||||
|
||||
CHDIR = "."
|
||||
|
||||
# Parse optional arguments
|
||||
for iarg in xrange(2, nargs):
|
||||
arg = sys.argv[iarg]
|
||||
|
||||
# Is this a -thingy=thingyValue argument?
|
||||
if arg[0] == "-":
|
||||
assert arg.count("=") == 1
|
||||
argKey, argValue = arg.split("=")
|
||||
if argKey not in validArgs:
|
||||
printUsage()
|
||||
exit(1)
|
||||
|
||||
exec("%s = '%s'" % (setValueArgs[argKey], argValue))
|
||||
print "Setting " + setValueArgs[argKey] + " to " + argValue
|
||||
|
||||
# Is this an object file/lib that needs to be linked in?
|
||||
elif arg[-2:] == ".o" or arg[-2:] == ".a" or arg[-3:] == ".so":
|
||||
OBJS += arg + " "
|
||||
|
||||
else:
|
||||
printUsage()
|
||||
exit()
|
||||
|
||||
import os
|
||||
os.chdir(CHDIR)
|
||||
|
||||
# Generate the export file by creating the shared obj library, which we then
|
||||
# promptly delete.
|
||||
command = LD + " " + LDFLAGS + " " + OPTLDFLAGS + " " + \
|
||||
EXPFLAG + "=" + EXPFILENAME + " " + \
|
||||
OBJS + " -o " + LIBTARGET
|
||||
execCommand(command, chatty)
|
||||
execCommand("rm -f " + LIBTARGET, chatty)
|
||||
|
||||
# Create the import file, and put the required tag as the first line indicating
|
||||
# the name of the archive which is exporting these symbols.
|
||||
impfile = open(IMPFILENAME, 'w')
|
||||
impfile.write("#!" + LIBTARGET + "\n")
|
||||
|
||||
# Attach the list of symbols being exported to the import file.
|
||||
expfile = open(EXPFILENAME, 'r')
|
||||
symbol = expfile.readline()
|
||||
while symbol:
|
||||
if maxlinelength:
|
||||
symbol = symbol[:maxlinelength]
|
||||
if symbol[-1] != '\n':
|
||||
symbol += '\n'
|
||||
impfile.write(symbol)
|
||||
symbol = expfile.readline()
|
||||
impfile.close()
|
||||
expfile.close()
|
||||
|
||||
#command = "cat " + EXPFILENAME + " >> " + IMPFILENAME
|
||||
#execCommand(command, chatty)
|
||||
|
||||
# Remove the export file.
|
||||
execCommand("rm -f " + EXPFILENAME, chatty)
|
||||
@@ -48,7 +48,7 @@ rule Link-action
|
||||
|
||||
actions kcc-Link-action bind NEEDLIBS
|
||||
{
|
||||
$(kcc.bin-directory)KCC $(LINKFLAGS) -o "$(<)" -L$(STDLIBPATH) "$(>)" $(NEEDLIBS) -lm
|
||||
$(kcc.bin-directory)KCC $(LINKFLAGS) -o "$(<[1])" -L$(STDLIBPATH) "$(>)" $(NEEDLIBS) -lm
|
||||
}
|
||||
|
||||
#### Cc #####
|
||||
|
||||
@@ -241,12 +241,6 @@ if $(NT)
|
||||
|
||||
rule Link-PYD
|
||||
{
|
||||
if $(<[2])
|
||||
{
|
||||
MODE on $(<[2]) = $(IMPMODE) ;
|
||||
Chmod $(<[2]) ;
|
||||
}
|
||||
|
||||
gRUN_PATH($(<)) += $(gLOCATE($(<[1]))) ;
|
||||
if $(UNIX)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user