|
|
6b23ba |
#ifndef SLIBTOOL_H
|
|
|
6b23ba |
#define SLIBTOOL_H
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#include <stdint.h>
|
|
|
528799 |
#include <stddef.h>
|
|
|
9ca8c4 |
#include <stdio.h>
|
|
|
528799 |
#include <unistd.h>
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#include "slibtool_api.h"
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#ifdef __cplusplus
|
|
|
9ca8c4 |
extern "C" {
|
|
|
9ca8c4 |
#endif
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
/* pre-alpha */
|
|
|
9ca8c4 |
#ifndef SLBT_APP
|
|
|
9ca8c4 |
#ifndef SLBT_PRE_ALPHA
|
|
|
9ca8c4 |
#error libslibtool: pre-alpha: ABI is not final!
|
|
|
9ca8c4 |
#error to use the library, please pass -DSLBT_PRE_ALPHA to the compiler.
|
|
|
9ca8c4 |
#endif
|
|
|
9ca8c4 |
#endif
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
/* status codes */
|
|
|
9ca8c4 |
#define SLBT_OK 0x00
|
|
|
9ca8c4 |
#define SLBT_USAGE 0x01
|
|
|
0254df |
#define SLBT_ERROR 0x02
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
/* driver flags */
|
|
|
47b7ad |
#define SLBT_DRIVER_XFLAG(x) ((uint64_t)(x) << 32)
|
|
|
fbda3a |
|
|
|
9ca8c4 |
#define SLBT_DRIVER_VERBOSITY_NONE 0x0000
|
|
|
9ca8c4 |
#define SLBT_DRIVER_VERBOSITY_ERRORS 0x0001
|
|
|
9ca8c4 |
#define SLBT_DRIVER_VERBOSITY_STATUS 0x0002
|
|
|
9ca8c4 |
#define SLBT_DRIVER_VERBOSITY_USAGE 0x0004
|
|
|
9ca8c4 |
#define SLBT_DRIVER_CLONE_VECTOR 0x0008
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#define SLBT_DRIVER_VERSION 0x0010
|
|
|
9ca8c4 |
#define SLBT_DRIVER_DRY_RUN 0x0020
|
|
|
173b54 |
#define SLBT_DRIVER_CONFIG 0x0040
|
|
|
fea1b8 |
#define SLBT_DRIVER_DEBUG 0x0080
|
|
|
d03fbc |
#define SLBT_DRIVER_FEATURES 0x0100
|
|
|
40fabb |
#define SLBT_DRIVER_DEPS 0x0200
|
|
|
398419 |
#define SLBT_DRIVER_SILENT 0x0400
|
|
|
25956b |
#define SLBT_DRIVER_VERBOSE 0x0800
|
|
|
4f1b20 |
#define SLBT_DRIVER_PRO_PIC 0x1000
|
|
|
4f1b20 |
#define SLBT_DRIVER_ANTI_PIC 0x2000
|
|
|
9c25c7 |
#define SLBT_DRIVER_SHARED 0x4000
|
|
|
9c25c7 |
#define SLBT_DRIVER_STATIC 0x8000
|
|
|
9ca8c4 |
|
|
|
499a71 |
#define SLBT_DRIVER_HEURISTICS 0x010000
|
|
|
e4a8ce |
#define SLBT_DRIVER_STRICT 0x020000
|
|
|
93b62c |
#define SLBT_DRIVER_NO_UNDEFINED 0x040000
|
|
|
a943fc |
#define SLBT_DRIVER_MODULE 0x080000
|
|
|
68f313 |
#define SLBT_DRIVER_AVOID_VERSION 0x100000
|
|
|
bcd5af |
#define SLBT_DRIVER_IMAGE_ELF 0x200000
|
|
|
bcd5af |
#define SLBT_DRIVER_IMAGE_PE 0x400000
|
|
|
bcd5af |
#define SLBT_DRIVER_IMAGE_MACHO 0x800000
|
|
|
e4a8ce |
|
|
|
f7645c |
#define SLBT_DRIVER_ALL_STATIC 0x01000000
|
|
|
0e609b |
#define SLBT_DRIVER_DISABLE_STATIC 0x02000000
|
|
|
f5fa4c |
#define SLBT_DRIVER_DISABLE_SHARED 0x04000000
|
|
|
0a9bff |
#define SLBT_DRIVER_LEGABITS 0x08000000
|
|
|
f7645c |
|
|
|
2bc175 |
#define SLBT_DRIVER_ANNOTATE_ALWAYS 0x10000000
|
|
|
2bc175 |
#define SLBT_DRIVER_ANNOTATE_NEVER 0x20000000
|
|
|
2bc175 |
#define SLBT_DRIVER_ANNOTATE_FULL 0x40000000
|
|
|
2bc175 |
|
|
|
fbda3a |
#define SLBT_DRIVER_IMPLIB_IDATA SLBT_DRIVER_XFLAG(0x0001)
|
|
|
fbda3a |
#define SLBT_DRIVER_IMPLIB_DSOMETA SLBT_DRIVER_XFLAG(0x0002)
|
|
|
916050 |
#define SLBT_DRIVER_EXPORT_DYNAMIC SLBT_DRIVER_XFLAG(0x0010)
|
|
|
56f236 |
#define SLBT_DRIVER_STATIC_LIBTOOL_LIBS SLBT_DRIVER_XFLAG(0x0100)
|
|
|
fbda3a |
|
|
|
6dc887 |
/* error flags */
|
|
|
6dc887 |
#define SLBT_ERROR_TOP_LEVEL 0x0001
|
|
|
6dc887 |
#define SLBT_ERROR_NESTED 0x0002
|
|
|
6dc887 |
#define SLBT_ERROR_CHILD 0x0004
|
|
|
6dc887 |
#define SLBT_ERROR_CUSTOM 0x0008
|
|
|
6dc887 |
|
|
|
210852 |
enum slbt_custom_error {
|
|
|
210852 |
SLBT_ERR_FLOW_ERROR,
|
|
|
210852 |
SLBT_ERR_FLEE_ERROR,
|
|
|
210852 |
SLBT_ERR_ARCHIVE_IMPORT,
|
|
|
210852 |
SLBT_ERR_HOST_INIT,
|
|
|
210852 |
SLBT_ERR_INSTALL_FAIL,
|
|
|
210852 |
SLBT_ERR_INSTALL_FLOW,
|
|
|
210852 |
SLBT_ERR_INSTALL_REV,
|
|
|
210852 |
SLBT_ERR_LDRPATH_INIT,
|
|
|
210852 |
SLBT_ERR_LINK_FLOW,
|
|
|
210852 |
SLBT_ERR_LINK_FREQ,
|
|
|
62ed2e |
SLBT_ERR_BAD_DATA,
|
|
|
210852 |
SLBT_ERR_UNINSTALL_FAIL,
|
|
|
0801fe |
SLBT_ERR_LCONF_OPEN,
|
|
|
0801fe |
SLBT_ERR_LCONF_MAP,
|
|
|
0801fe |
SLBT_ERR_LCONF_PARSE,
|
|
|
210852 |
};
|
|
|
210852 |
|
|
|
ed069f |
/* execution modes */
|
|
|
ed069f |
enum slbt_mode {
|
|
|
ed069f |
SLBT_MODE_UNKNOWN,
|
|
|
3c1679 |
SLBT_MODE_INFO,
|
|
|
ed069f |
SLBT_MODE_CLEAN,
|
|
|
ed069f |
SLBT_MODE_COMPILE,
|
|
|
ed069f |
SLBT_MODE_EXECUTE,
|
|
|
ed069f |
SLBT_MODE_FINISH,
|
|
|
ed069f |
SLBT_MODE_INSTALL,
|
|
|
ed069f |
SLBT_MODE_LINK,
|
|
|
ed069f |
SLBT_MODE_UNINSTALL,
|
|
|
ed069f |
};
|
|
|
ed069f |
|
|
|
53f4ec |
enum slbt_tag {
|
|
|
53f4ec |
SLBT_TAG_UNKNOWN,
|
|
|
53f4ec |
SLBT_TAG_CC,
|
|
|
53f4ec |
SLBT_TAG_CXX,
|
|
|
6e6b0f |
SLBT_TAG_FC,
|
|
|
1bd7a3 |
SLBT_TAG_F77,
|
|
|
62b4bb |
SLBT_TAG_NASM,
|
|
|
4127b5 |
SLBT_TAG_RC,
|
|
|
53f4ec |
};
|
|
|
53f4ec |
|
|
|
6376f0 |
enum slbt_warning_level {
|
|
|
6376f0 |
SLBT_WARNING_LEVEL_UNKNOWN,
|
|
|
6376f0 |
SLBT_WARNING_LEVEL_ALL,
|
|
|
6376f0 |
SLBT_WARNING_LEVEL_ERROR,
|
|
|
6376f0 |
SLBT_WARNING_LEVEL_NONE,
|
|
|
6376f0 |
};
|
|
|
6376f0 |
|
|
|
9f24d2 |
struct slbt_source_version {
|
|
|
9f24d2 |
int major;
|
|
|
9f24d2 |
int minor;
|
|
|
9f24d2 |
int revision;
|
|
|
9f24d2 |
const char * commit;
|
|
|
9f24d2 |
};
|
|
|
9f24d2 |
|
|
|
a82cc2 |
struct slbt_fd_ctx {
|
|
|
16c8da |
int fdin;
|
|
|
16c8da |
int fdout;
|
|
|
16c8da |
int fderr;
|
|
|
16c8da |
int fdlog;
|
|
|
16c8da |
int fdcwd;
|
|
|
16c8da |
int fddst;
|
|
|
a82cc2 |
};
|
|
|
a82cc2 |
|
|
|
528799 |
struct slbt_exec_ctx {
|
|
|
16c8da |
char * program;
|
|
|
16c8da |
char * compiler;
|
|
|
16c8da |
char ** cargv;
|
|
|
16c8da |
char ** xargv;
|
|
|
16c8da |
char ** argv;
|
|
|
16c8da |
char ** envp;
|
|
|
16c8da |
char ** altv;
|
|
|
16c8da |
char ** dpic;
|
|
|
16c8da |
char ** fpic;
|
|
|
16c8da |
char ** cass;
|
|
|
16c8da |
char ** noundef;
|
|
|
16c8da |
char ** soname;
|
|
|
16c8da |
char ** lsoname;
|
|
|
16c8da |
char ** symdefs;
|
|
|
16c8da |
char ** symfile;
|
|
|
16c8da |
char ** lout[2];
|
|
|
16c8da |
char ** mout[2];
|
|
|
16c8da |
char ** rpath[2];
|
|
|
16c8da |
char ** sentinel;
|
|
|
16c8da |
char * csrc;
|
|
|
16c8da |
int ldirdepth;
|
|
|
16c8da |
char * ldirname;
|
|
|
16c8da |
char * lbasename;
|
|
|
16c8da |
char * lobjname;
|
|
|
16c8da |
char * aobjname;
|
|
|
16c8da |
char * ltobjname;
|
|
|
16c8da |
char * arfilename;
|
|
|
16c8da |
char * lafilename;
|
|
|
16c8da |
char * laifilename;
|
|
|
08f5f9 |
char * dsobasename;
|
|
|
16c8da |
char * dsofilename;
|
|
|
16c8da |
char * relfilename;
|
|
|
16c8da |
char * dsorellnkname;
|
|
|
16c8da |
char * deffilename;
|
|
|
16c8da |
char * rpathfilename;
|
|
|
16c8da |
char * dimpfilename;
|
|
|
16c8da |
char * pimpfilename;
|
|
|
16c8da |
char * vimpfilename;
|
|
|
16c8da |
char * exefilename;
|
|
|
16c8da |
char * sonameprefix;
|
|
|
16c8da |
pid_t pid;
|
|
|
16c8da |
int exitcode;
|
|
|
528799 |
};
|
|
|
528799 |
|
|
|
5a9161 |
struct slbt_version_info {
|
|
|
16c8da |
int major;
|
|
|
16c8da |
int minor;
|
|
|
16c8da |
int revision;
|
|
|
16c8da |
const char * verinfo;
|
|
|
16c8da |
const char * vernumber;
|
|
|
5a9161 |
};
|
|
|
5a9161 |
|
|
|
6dc887 |
struct slbt_error_info {
|
|
|
cacd3e |
const struct slbt_driver_ctx * edctx;
|
|
|
cacd3e |
int esyscode;
|
|
|
cacd3e |
int elibcode;
|
|
|
cacd3e |
const char * efunction;
|
|
|
cacd3e |
int eline;
|
|
|
cacd3e |
unsigned eflags;
|
|
|
cacd3e |
void * eany;
|
|
|
6dc887 |
};
|
|
|
6dc887 |
|
|
|
a2fcc0 |
struct slbt_host_params {
|
|
|
a2fcc0 |
const char * host;
|
|
|
a2fcc0 |
const char * flavor;
|
|
|
a2fcc0 |
const char * ar;
|
|
|
a2fcc0 |
const char * ranlib;
|
|
|
9a02e2 |
const char * windres;
|
|
|
a2fcc0 |
const char * dlltool;
|
|
|
fbda3a |
const char * mdso;
|
|
|
af7db9 |
const char * ldrpath;
|
|
|
a2fcc0 |
};
|
|
|
a2fcc0 |
|
|
|
a66d34 |
struct slbt_flavor_settings {
|
|
|
bcd5af |
const char * imagefmt;
|
|
|
a66d34 |
const char * arprefix;
|
|
|
a66d34 |
const char * arsuffix;
|
|
|
a66d34 |
const char * dsoprefix;
|
|
|
a66d34 |
const char * dsosuffix;
|
|
|
339022 |
const char * osdsuffix;
|
|
|
339022 |
const char * osdfussix;
|
|
|
a66d34 |
const char * exeprefix;
|
|
|
a66d34 |
const char * exesuffix;
|
|
|
a66d34 |
const char * impprefix;
|
|
|
a66d34 |
const char * impsuffix;
|
|
|
41790b |
const char * ldpathenv;
|
|
|
11e277 |
char * picswitch;
|
|
|
a66d34 |
};
|
|
|
a66d34 |
|
|
|
9ca8c4 |
struct slbt_common_ctx {
|
|
|
9ca8c4 |
uint64_t drvflags;
|
|
|
9ca8c4 |
uint64_t actflags;
|
|
|
9ca8c4 |
uint64_t fmtflags;
|
|
|
a2fcc0 |
struct slbt_host_params host;
|
|
|
a2fcc0 |
struct slbt_host_params cfgmeta;
|
|
|
a66d34 |
struct slbt_flavor_settings settings;
|
|
|
a313a4 |
struct slbt_host_params ahost;
|
|
|
a313a4 |
struct slbt_host_params acfgmeta;
|
|
|
a313a4 |
struct slbt_flavor_settings asettings;
|
|
|
5a9161 |
struct slbt_version_info verinfo;
|
|
|
667ce2 |
enum slbt_mode mode;
|
|
|
53f4ec |
enum slbt_tag tag;
|
|
|
6376f0 |
enum slbt_warning_level warnings;
|
|
|
36a4c5 |
char ** cargv;
|
|
|
36a4c5 |
char ** targv;
|
|
|
36a4c5 |
char * libname;
|
|
|
34988f |
const char * ccwrap;
|
|
|
4df790 |
const char * target;
|
|
|
b83b64 |
const char * output;
|
|
|
bfa8ca |
const char * shrext;
|
|
|
9c664d |
const char * rpath;
|
|
|
9aa1f4 |
const char * release;
|
|
|
873ecb |
const char * symfile;
|
|
|
73ca78 |
const char * regex;
|
|
|
9b5eec |
const char * user;
|
|
|
9ca8c4 |
};
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
struct slbt_driver_ctx {
|
|
|
9ca8c4 |
const char * program;
|
|
|
9ca8c4 |
const char * module;
|
|
|
9ca8c4 |
const struct slbt_common_ctx * cctx;
|
|
|
6dc887 |
struct slbt_error_info ** errv;
|
|
|
9ca8c4 |
void * any;
|
|
|
9ca8c4 |
};
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
/* driver api */
|
|
|
38c2e7 |
slbt_api int slbt_get_driver_ctx (char ** argv, char ** envp, uint32_t flags,
|
|
|
d48926 |
const struct slbt_fd_ctx *,
|
|
|
d48926 |
struct slbt_driver_ctx **);
|
|
|
d48926 |
|
|
|
38c2e7 |
slbt_api void slbt_free_driver_ctx (struct slbt_driver_ctx *);
|
|
|
9ca8c4 |
|
|
|
38c2e7 |
slbt_api int slbt_get_driver_fdctx (const struct slbt_driver_ctx *, struct slbt_fd_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_set_driver_fdctx (struct slbt_driver_ctx *, const struct slbt_fd_ctx *);
|
|
|
a82cc2 |
|
|
|
5e3f48 |
/* execution context api */
|
|
|
38c2e7 |
slbt_api int slbt_get_exec_ctx (const struct slbt_driver_ctx *, struct slbt_exec_ctx **);
|
|
|
38c2e7 |
slbt_api void slbt_free_exec_ctx (struct slbt_exec_ctx *);
|
|
|
d98877 |
slbt_api void slbt_reset_argvector (struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api void slbt_reset_arguments (struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api void slbt_reset_placeholders (struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api void slbt_disable_placeholders (struct slbt_exec_ctx *);
|
|
|
528799 |
|
|
|
5e3f48 |
/* core api */
|
|
|
38c2e7 |
slbt_api int slbt_exec_compile (const struct slbt_driver_ctx *, struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_exec_execute (const struct slbt_driver_ctx *, struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_exec_install (const struct slbt_driver_ctx *, struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_exec_link (const struct slbt_driver_ctx *, struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_exec_uninstall (const struct slbt_driver_ctx *, struct slbt_exec_ctx *);
|
|
|
36de3e |
|
|
|
38c2e7 |
slbt_api int slbt_set_alternate_host (const struct slbt_driver_ctx *, const char * host, const char * flavor);
|
|
|
38c2e7 |
slbt_api void slbt_reset_alternate_host (const struct slbt_driver_ctx *);
|
|
|
a313a4 |
|
|
|
1f2c01 |
slbt_api int slbt_get_flavor_settings (const char *, const struct slbt_flavor_settings **);
|
|
|
1f2c01 |
|
|
|
4a01cf |
/* helper api */
|
|
|
38c2e7 |
slbt_api int slbt_archive_import (const struct slbt_driver_ctx *, struct slbt_exec_ctx *,
|
|
|
38c2e7 |
char * dstarchive, char * srcarchive);
|
|
|
38c2e7 |
slbt_api int slbt_copy_file (const struct slbt_driver_ctx *, struct slbt_exec_ctx *,
|
|
|
38c2e7 |
char * src, char * dst);
|
|
|
38c2e7 |
slbt_api int slbt_dump_machine (const char * compiler, char * machine, size_t bufsize);
|
|
|
9ca35b |
slbt_api int slbt_realpath (int, const char *, int, char *, size_t);
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
/* utility api */
|
|
|
633f4e |
slbt_api int slbt_main (char **, char **,
|
|
|
a82cc2 |
const struct slbt_fd_ctx *);
|
|
|
d48926 |
|
|
|
38c2e7 |
slbt_api int slbt_output_config (const struct slbt_driver_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_features (const struct slbt_driver_ctx *);
|
|
|
89ace8 |
slbt_api int slbt_output_fdcwd (const struct slbt_driver_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_exec (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *, const char *);
|
|
|
38c2e7 |
slbt_api int slbt_output_compile (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_execute (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_install (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_link (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_uninstall (const struct slbt_driver_ctx *, const struct slbt_exec_ctx *);
|
|
|
38c2e7 |
slbt_api int slbt_output_error_record (const struct slbt_driver_ctx *, const struct slbt_error_info *);
|
|
|
38c2e7 |
slbt_api int slbt_output_error_vector (const struct slbt_driver_ctx *);
|
|
|
38c2e7 |
|
|
|
38c2e7 |
/* package info */
|
|
|
38c2e7 |
slbt_api const struct slbt_source_version * slbt_source_version(void);
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#ifdef __cplusplus
|
|
|
9ca8c4 |
}
|
|
|
9ca8c4 |
#endif
|
|
|
9ca8c4 |
|
|
|
9ca8c4 |
#endif
|