mirror of
https://github.com/RPCSX/xed.git
synced 2024-11-23 03:29:39 +00:00
moving headers to xed/ directory for install & kit. DISRUPTIVE CHANGE
* compiled kit users must refer to "#include "xed/xed-interface.h" and xed/ on any other public headers that they reference as part of the kit or new /usr/local installs. Or they can change their -I flag to include the xed/ path component. All the examples use xed/ in the #include statements now. * new knob --prefix=/usr/local (for example) that puts the compiled library in /usr/local/lib and the headers in /usr/local/include/xed . * To install in /usr/local, one typically must sudo. If you do the whole build at sudo, then it'll create root-owned files in your build directory whic you might not want. So I suggest first building as the local user and then sudo only for the final install. > ./mfile.py > sudo ./mfile.py --prefix=/usr/local * There is also a --prefix-lib-dir knob to specify something other than "lib" for /usr/local/lib. Some systems use lib, lib32 or lib64 and I don't know how to tell which is which so I give users a knob so they can decide for themselves. > ./mfile.py --host-cpu=ia32 > sudo ./mfile.py --prefix=/usr/local --prefix-lib-dir=lib32 > ./mfile.py --host-cpu=intel64 > sudo ./mfile.py --prefix=/usr/local --prefix-lib-dir=lib64 * added xed-util.h to xed-interface.h * moved headers from include/public to include/public/xed * genutil minor cleanup Change-Id: I3786d2280f24ff8d7e075fa7a75d90f3b28dd8c3
This commit is contained in:
parent
9da8d893e8
commit
fcd2d41b2b
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
#include "udhelp.H"
|
||||
#include <stdio.h>
|
||||
extern "C" {
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h" // xed_strdup
|
||||
}
|
||||
#include <process.h>
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
/// @file xed-dec-print.c
|
||||
// decode and print
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -31,8 +31,7 @@ END_LEGAL */
|
||||
# include <libelf.h>
|
||||
#endif
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed-portability.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-symbol-table.h"
|
||||
#include "avltree.h"
|
||||
|
@ -25,7 +25,7 @@ END_LEGAL */
|
||||
# if defined(XED_ELF_READER)
|
||||
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
|
||||
void xed_disas_elf(xed_disas_info_t* fi);
|
||||
|
@ -17,10 +17,9 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
|
||||
// to avoid empty compilation unit on no-decoder compiles
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
|
||||
#if defined(XED_DECODER)
|
||||
#include "xed-portability.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-disas-hex.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@ END_LEGAL */
|
||||
# define _XED_DISAS_HEX_H_
|
||||
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
|
||||
void
|
||||
|
@ -17,7 +17,7 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
/// @file xed-disas-macho.cpp
|
||||
|
||||
#include "xed-interface.h" // to get defines
|
||||
#include "xed/xed-interface.h" // to get defines
|
||||
#if defined(__APPLE__) && defined(XED_DECODER)
|
||||
|
||||
// mac specific headers
|
||||
|
@ -20,7 +20,7 @@ END_LEGAL */
|
||||
# define _XED_DISAS_MACHO_H_
|
||||
|
||||
# if defined(__APPLE__)
|
||||
# include "xed-interface.h"
|
||||
# include "xed/xed-interface.h"
|
||||
# include "xed-examples-util.h"
|
||||
|
||||
void
|
||||
|
@ -19,14 +19,14 @@ END_LEGAL */
|
||||
|
||||
//// ONLY COMPILES IF -mno-cygwin is thrown on to GCC compilations
|
||||
|
||||
#include "xed-build-defines.h" // for XED_DECODER
|
||||
#include "xed/xed-build-defines.h" // for XED_DECODER
|
||||
#if defined(XED_DECODER)
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "xed-portability.h" // for the XED_ macros used on next line
|
||||
#include "xed/xed-portability.h" // for the XED_ macros used on next line
|
||||
}
|
||||
#if defined(XED_MSVC8_OR_LATER) && !defined(XED_64B)
|
||||
// to enable the wow64 redirection function on MSVC8
|
||||
|
@ -21,7 +21,7 @@ END_LEGAL */
|
||||
#if !defined(_XED_DISAS_PECOFF_H_)
|
||||
# define _XED_DISAS_PECOFF_H_
|
||||
|
||||
# include "xed-interface.h"
|
||||
# include "xed/xed-interface.h"
|
||||
# include "xed-examples-util.h"
|
||||
|
||||
void xed_disas_pecoff(xed_disas_info_t* fi);
|
||||
|
@ -17,9 +17,8 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
/// @file disas-raw.c
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#if defined(XED_DECODER)
|
||||
#include "xed-portability.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-disas-raw.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
#if !defined(_XED_DISAS_RAW_H_)
|
||||
# define _XED_DISAS_RAW_H_
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
|
||||
void xed_disas_raw(xed_disas_info_t* fi);
|
||||
|
@ -34,7 +34,7 @@ END_LEGAL */
|
||||
your client's names.
|
||||
**************************************************************************/
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
|
||||
#if !defined(_XED_DOT_PREP_H_)
|
||||
# define _XED_DOT_PREP_H_
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-dot.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
#if !defined(_XED_DOT_H_)
|
||||
# define _XED_DOT_H_
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct xed_dot_node_s {
|
||||
|
@ -22,8 +22,7 @@ END_LEGAL */
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "xed-interface.h"
|
||||
#include "xed-portability.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-enc-lang.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@ END_LEGAL */
|
||||
#if !defined(_XED_ENC_LANG_H_)
|
||||
# define _XED_ENC_LANG_H_
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
|
||||
// decoder example with agen callbacks.
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
|
||||
// decoder example - cpuid-based defeaturing
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h" // xed_atoi_hex()
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -17,7 +17,7 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
@ -25,8 +25,8 @@ END_LEGAL */
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed-get-time.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed/xed-get-time.h"
|
||||
|
||||
#define BUFLEN 1024
|
||||
#define XDPRINT(x) printf("%23s = %d\n", #x , i-> x );
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
/// This is the place to start learning about the decoder APIs. It
|
||||
/// exercises most of the essential features of the decoder.
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
/// @file xed-ex3.c
|
||||
/// Encoder example
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-enc-lang.h"
|
||||
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
/// @file xed-ex4.c
|
||||
// decoder example. This is the "C" version of xed-ex2.cpp (which is C++).
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -20,7 +20,7 @@ END_LEGAL */
|
||||
|
||||
// encoder example. (uses decoder too)
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // malloc, etc.
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
|
||||
// decoder->encoder example.
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
|
||||
// decoder example - printing register operands
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
|
||||
// decoder example - finding mov to cr3
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -16,8 +16,8 @@ Copyright (c) 2016 Intel Corporation
|
||||
|
||||
END_LEGAL */
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed-get-time.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed/xed-get-time.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include <string.h> //strlen, memcmp, memset
|
||||
#if defined(XED_MAC) || defined(XED_LINUX) || defined(XED_BSD)
|
||||
@ -30,12 +30,10 @@ END_LEGAL */
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "xed-portability.h"
|
||||
#include "xed-util.h"
|
||||
#include "xed-dot-prep.h"
|
||||
|
||||
|
||||
#include "xed-ild.h"
|
||||
#include "xed/xed-ild.h"
|
||||
#if defined(PTI_XED_TEST)
|
||||
#include "pti-xed-test.h"
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@ END_LEGAL */
|
||||
# define _XED_EXAMPLES_UTIL_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
|
||||
extern xed_syntax_enum_t global_syntax;
|
||||
extern int client_verbose;
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
/// @file xed-min.c
|
||||
/// @brief a minimal toy example of using the decoder.
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
@ -18,7 +18,7 @@ END_LEGAL */
|
||||
/// @file xed-min.c
|
||||
/// @brief a minimal toy example of using the decoder.
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
@ -16,7 +16,7 @@ Copyright (c) 2016 Intel Corporation
|
||||
|
||||
END_LEGAL */
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
@ -17,8 +17,7 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed-portability.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "xed-symbol-table.h"
|
||||
|
||||
|
@ -19,7 +19,7 @@ END_LEGAL */
|
||||
#if !defined(_XED_SYMBOL_TABLE_H_)
|
||||
#define _XED_SYMBOL_TABLE_H_
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed-examples-util.h"
|
||||
#include "avltree.h"
|
||||
#include <stdlib.h>
|
||||
|
@ -20,7 +20,7 @@ END_LEGAL */
|
||||
/// @brief a minimal example of accessing the XED internal tables
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
|
||||
|
||||
void dump_operand(const xed_operand_t* op) {
|
||||
|
@ -17,7 +17,7 @@ Copyright (c) 2016 Intel Corporation
|
||||
END_LEGAL */
|
||||
/// @file xed-tester.c
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
@ -20,9 +20,8 @@ END_LEGAL */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "xed-interface.h"
|
||||
#include "xed-immdis.h"
|
||||
#include "xed-portability.h"
|
||||
#include "xed/xed-interface.h"
|
||||
#include "xed/xed-immdis.h"
|
||||
#include "xed-examples-util.h"
|
||||
#if defined(XED_ENCODER)
|
||||
# include "xed-enc-lang.h"
|
||||
|
@ -245,6 +245,9 @@ def init(env):
|
||||
env['xed_dir'] = '..'
|
||||
|
||||
fx = mbuild.join(env['xed_dir'], "include","public") # static headers
|
||||
if os.path.exists(fx):
|
||||
env.add_include_dir(fx)
|
||||
fx = mbuild.join(env['xed_dir'], "include","public",'xed')
|
||||
if os.path.exists(fx):
|
||||
env.add_include_dir(fx)
|
||||
env.add_include_dir( env['src_dir'] ) # examples dir
|
||||
|
@ -30,6 +30,7 @@ END_LEGAL */
|
||||
#endif
|
||||
|
||||
#include "xed-build-defines.h" /* generated */
|
||||
#include "xed-portability.h"
|
||||
|
||||
#include "xed-common-hdrs.h"
|
||||
#include "xed-types.h"
|
@ -18,11 +18,20 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
#END_LEGAL
|
||||
import sys, os, math, traceback, types, copy, re, stat
|
||||
import sys
|
||||
import os
|
||||
import math
|
||||
import traceback
|
||||
import types
|
||||
import copy
|
||||
import re
|
||||
import stat
|
||||
import platform
|
||||
|
||||
psystem = platform.system()
|
||||
if psystem == 'Microsoft' or psystem == 'Windows' or psystem.find('CYGWIN') != -1 :
|
||||
psystem = platform.system()
|
||||
if (psystem == 'Microsoft' or
|
||||
psystem == 'Windows' or
|
||||
psystem.find('CYGWIN') != -1) :
|
||||
on_windows = True
|
||||
else:
|
||||
on_windows = False
|
||||
@ -69,8 +78,8 @@ def check_python_version(argmaj, argmin):
|
||||
tuple = sys.version_info
|
||||
major = tuple[0]
|
||||
minor = tuple[1]
|
||||
if (major > argmaj ) or \
|
||||
(major == argmaj and minor >= argmin):
|
||||
if ( (major > argmaj ) or
|
||||
(major == argmaj and minor >= argmin) ):
|
||||
return
|
||||
die('Need Python version %d.%d or later.' % (argmaj, argmin))
|
||||
|
||||
@ -415,3 +424,4 @@ def uniqueify(values):
|
||||
k = s.keys()
|
||||
k.sort()
|
||||
return k
|
||||
|
||||
|
176
xed_mbuild.py
176
xed_mbuild.py
@ -34,6 +34,7 @@ import glob
|
||||
import types
|
||||
import optparse
|
||||
import collections
|
||||
import stat
|
||||
|
||||
def _fatal(m):
|
||||
sys.stderr.write("\n\nXED ERROR: %s\n\n" % (m) )
|
||||
@ -553,6 +554,8 @@ def mkenv():
|
||||
fma=True,
|
||||
dbghelp=False,
|
||||
install_dir='',
|
||||
prefix_dir='',
|
||||
prefix_lib_dir='lib',
|
||||
kit_kind='base',
|
||||
win=False,
|
||||
amd_enabled=True,
|
||||
@ -752,6 +755,14 @@ def xed_args(env):
|
||||
action="store_true",
|
||||
dest="dbghelp",
|
||||
help="Use dbghelp.dll on windows.")
|
||||
env.parser.add_option("--prefix",
|
||||
dest="prefix_dir",
|
||||
action="store",
|
||||
help="XED System install directory.")
|
||||
env.parser.add_option("--prefix-lib-dir",
|
||||
dest="prefix_lib_dir",
|
||||
action="store",
|
||||
help="library subdirectory name. Default: lib")
|
||||
env.parser.add_option("--install-dir",
|
||||
dest="install_dir",
|
||||
action="store",
|
||||
@ -895,6 +906,7 @@ def init(env):
|
||||
|
||||
env.add_include_dir(mbuild.join(env['src_dir'],"include","private"))
|
||||
env.add_include_dir(mbuild.join(env['src_dir'],"include","public"))
|
||||
env.add_include_dir(mbuild.join(env['src_dir'],"include","public",'xed'))
|
||||
|
||||
valid_targets = [ 'clean', 'just-gen',
|
||||
'skip-gen', 'install',
|
||||
@ -1642,8 +1654,121 @@ def apply_legal_header2(fn, legal_header):
|
||||
apply_legal_header.apply_header_to_source_file(legal_header,fn)
|
||||
else:
|
||||
apply_legal_header.apply_header_to_data_file(legal_header,fn)
|
||||
|
||||
|
||||
def _gen_lib_names(env):
|
||||
libnames_template = [ 'lib%(base_lib)s.a',
|
||||
'lib%(base_lib)s.so',
|
||||
'%(base_lib)s.lib',
|
||||
'%(base_lib)s.dll',
|
||||
'lib%(base_lib)s.dylib' ]
|
||||
libnames = []
|
||||
for base_lib in ['xed', 'xed-ild']:
|
||||
# use base_lib to trigger mbuild expansion
|
||||
env['base_lib']=base_lib
|
||||
libnames.extend(env.expand(libnames_template))
|
||||
|
||||
libs = map(lambda x: mbuild.join(env['build_dir'], x),
|
||||
libnames)
|
||||
libs = filter(lambda x: os.path.exists(x), libs)
|
||||
return libs
|
||||
|
||||
do_system_copy = True
|
||||
|
||||
def _copy_generated_headers(env, dest):
|
||||
global do_system_copy
|
||||
gen_inc = mbuild.join(mbuild.join(env['build_dir'],'*.h'))
|
||||
gincs= mbuild.glob(gen_inc)
|
||||
if len(gincs) == 0:
|
||||
xbc.cdie("No generated include headers found for install")
|
||||
for h in gincs:
|
||||
mbuild.msgb("COPY", "{} <- {}".format(dest,h))
|
||||
if do_system_copy:
|
||||
mbuild.copy_file(h,dest)
|
||||
|
||||
def _copy_nongenerated_headers(env, dest):
|
||||
global do_system_copy
|
||||
src_inc = mbuild.join(env['src_dir'],'include',"public",'xed','*.h')
|
||||
incs= mbuild.glob(src_inc)
|
||||
if len(incs) == 0:
|
||||
xbc.cdie("No standard include headers found for install")
|
||||
for h in incs:
|
||||
mbuild.msgb("COPY", "{} <- {}".format(dest,h))
|
||||
if do_system_copy:
|
||||
mbuild.copy_file(h,dest)
|
||||
|
||||
def _get_legal_header(env):
|
||||
if env['legal_header'] == 'default' or env['legal_header'] == None:
|
||||
env['legal_header'] = mbuild.join(env['src_dir'],
|
||||
'misc',
|
||||
'apache-header.txt')
|
||||
legal_header = file(env['legal_header']).readlines()
|
||||
return legal_header
|
||||
|
||||
def _apply_legal_header_to_headers(env,dest):
|
||||
"""apply legal header to all installed headers
|
||||
in the include directory."""
|
||||
|
||||
legal_header = _get_legal_header(env)
|
||||
|
||||
for h in mbuild.glob(mbuild.join(dest,'*.[Hh]')):
|
||||
if mbuild.verbose(2):
|
||||
mbuild.msgb("HEADER TAG", h)
|
||||
apply_legal_header2(h, legal_header)
|
||||
|
||||
|
||||
def system_install(env, work_queue):
|
||||
"""Build install in the prefix_dir. Use prefix_lib_dir as library name
|
||||
since some systems use lib, lib32 or lib64. non-windows only.
|
||||
"""
|
||||
global do_system_copy
|
||||
if env.on_windows():
|
||||
return
|
||||
|
||||
if not env['prefix_dir']:
|
||||
return
|
||||
|
||||
include = mbuild.join(env['prefix_dir'], 'include', 'xed')
|
||||
lib = mbuild.join(env['prefix_dir'], env['prefix_lib_dir'])
|
||||
|
||||
mbuild.msgb("Making install dirs (if they do not exist)")
|
||||
|
||||
def _set_perm(fn):
|
||||
"-rwx-r-xr-x"
|
||||
os.chmod(fn, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|
|
||||
stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH|
|
||||
stat.S_IWUSR)
|
||||
|
||||
|
||||
if not os.path.exists(include):
|
||||
mbuild.cmkdir(include)
|
||||
_set_perm(include)
|
||||
if not os.path.exists(lib):
|
||||
mbuild.cmkdir(lib)
|
||||
_set_perm(include)
|
||||
|
||||
|
||||
# copy the libraries
|
||||
libs = _gen_lib_names(env)
|
||||
if len(libs) == 0:
|
||||
xbc.cdie("No libraries found for install")
|
||||
for f in libs:
|
||||
mbuild.msgb("COPY", "{} <- {}".format(lib,f))
|
||||
if do_system_copy:
|
||||
mbuild.copy_file(f, lib)
|
||||
fn = mbuild.join(lib,os.path.basename(f))
|
||||
if env['shared']:
|
||||
__set_perm(fn)
|
||||
else:
|
||||
mbuild.make_read_only(fn)
|
||||
|
||||
|
||||
|
||||
_copy_generated_headers(env, include)
|
||||
_copy_nongenerated_headers(env, include)
|
||||
_apply_legal_header_to_headers(env, include)
|
||||
|
||||
for fn in glob.glob(mbuild.join(include,'*.h')):
|
||||
mbuild.make_read_only(fn)
|
||||
|
||||
def build_kit(env, work_queue):
|
||||
"Build the XED kit"
|
||||
@ -1652,11 +1777,7 @@ def build_kit(env, work_queue):
|
||||
|
||||
# add a default legal header if we are building a kit and none is
|
||||
# specified.
|
||||
|
||||
if env['legal_header'] == 'default' or env['legal_header'] == None:
|
||||
env['legal_header'] = mbuild.join(env['src_dir'],'misc',
|
||||
'apache-header.txt')
|
||||
legal_header = file(env['legal_header']).readlines()
|
||||
legal_header = _get_legal_header(env)
|
||||
|
||||
if env['install_dir'] == '':
|
||||
date = time.strftime("%Y-%m-%d")
|
||||
@ -1674,7 +1795,7 @@ def build_kit(env, work_queue):
|
||||
|
||||
if mbuild.verbose(2):
|
||||
mbuild.msgb("INSTALL DIR", dest)
|
||||
include = mbuild.join(dest,"include")
|
||||
include = mbuild.join(dest,"include",'xed')
|
||||
lib = mbuild.join(dest,"lib")
|
||||
examples = mbuild.join(dest,"examples")
|
||||
bin_dir = mbuild.join(dest,"bin")
|
||||
@ -1742,21 +1863,10 @@ def build_kit(env, work_queue):
|
||||
|
||||
|
||||
# copy the libraries. (DLL goes in bin)
|
||||
libnames_template = [ 'lib%(base_lib)s.a',
|
||||
'lib%(base_lib)s.so',
|
||||
'%(base_lib)s.lib',
|
||||
'%(base_lib)s.dll',
|
||||
'lib%(base_lib)s.dylib' ]
|
||||
libnames = []
|
||||
for base_lib in ['xed', 'xed-ild']:
|
||||
env['base_lib']=base_lib
|
||||
libnames.extend(env.expand(libnames_template))
|
||||
|
||||
libs = map(lambda x: mbuild.join(env['build_dir'], x),
|
||||
libnames)
|
||||
libs = filter(lambda x: os.path.exists(x), libs)
|
||||
libs = _gen_lib_names(env)
|
||||
if len(libs) == 0:
|
||||
xbc.cdie("No libraries found for install")
|
||||
|
||||
for f in libs:
|
||||
print f
|
||||
if f.find('.dll') != -1:
|
||||
@ -1772,13 +1882,6 @@ def build_kit(env, work_queue):
|
||||
if os.path.exists(pdb):
|
||||
mbuild.copy_file(pdb,lib)
|
||||
|
||||
# copy non-generated headers
|
||||
src_inc = mbuild.join(env['src_dir'],'include',"public",'*.h')
|
||||
incs= mbuild.glob(src_inc)
|
||||
if len(incs) == 0:
|
||||
xbc.cdie("No standard include headers found for install")
|
||||
for h in incs:
|
||||
mbuild.copy_file(h,include)
|
||||
|
||||
# copy examples source
|
||||
for ext in ['*.[Hh]', '*.c', '*.cpp', '*.py', 'README.txt']:
|
||||
@ -1794,21 +1897,9 @@ def build_kit(env, work_queue):
|
||||
if 'LICENSE' not in tgt:
|
||||
apply_legal_header2(tgt, legal_header)
|
||||
|
||||
# copy the generated headers
|
||||
gen_inc = mbuild.join(mbuild.join(env['build_dir'],'*.[Hh]'))
|
||||
gincs= mbuild.glob(gen_inc)
|
||||
if len(gincs) == 0:
|
||||
xbc.cdie("No generated include headers found for install")
|
||||
for h in gincs:
|
||||
mbuild.copy_file(h,include)
|
||||
|
||||
# apply legal header to all headers (generanted and nongenerated)
|
||||
# in the include directory.
|
||||
for h in mbuild.glob(mbuild.join(include,'*.[Hh]')):
|
||||
if mbuild.verbose(2):
|
||||
mbuild.msgb("HEADER TAG", h)
|
||||
apply_legal_header2(h, legal_header)
|
||||
|
||||
_copy_nongenerated_headers(env,include)
|
||||
_copy_generated_headers(env, include)
|
||||
_apply_legal_header_to_headers(env, include)
|
||||
|
||||
# After applying the legal header, create the doxygen from the kit
|
||||
# files, and place the output right in the kit.
|
||||
@ -2124,6 +2215,7 @@ def work(env):
|
||||
legal_header_tagging(env)
|
||||
build_examples(env)
|
||||
build_kit(env,work_queue)
|
||||
system_install(env,work_queue) # like in /usr/local/{lib,include/xed}
|
||||
make_doxygen_build(env,work_queue)
|
||||
retval = run_tests(env)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user