summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-04-07 04:00:02 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-04-07 04:00:02 +0000
commita9830d54e63b5173f2ba62cdc962a0a53253979f (patch)
tree3e3031cabe628beecb9dcf98b560b9579cad18da /build
parentb3ef67687f3f9c9941b1e9d0c696a1133d3b370f (diff)
downloadlibapr-a9830d54e63b5173f2ba62cdc962a0a53253979f.tar.gz
- When linking a dll, automatically build an import library from the .def file
generated so we can link other modules against it. - Recognize install mode. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61470 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build')
-rw-r--r--build/aplibtool.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/build/aplibtool.c b/build/aplibtool.c
index c8f6bc3f6..a549294c7 100644
--- a/build/aplibtool.c
+++ b/build/aplibtool.c
@@ -66,13 +66,14 @@ typedef char bool;
bool silent = false;
bool shared = false;
bool export_all = false;
-enum mode_t { mCompile, mLink };
+enum mode_t { mCompile, mLink, mInstall };
enum output_type_t { otGeneral, otObject, otProgram, otStaticLibrary, otDynamicLibrary };
#ifdef __EMX__
# define SHELL_CMD "sh"
# define CC "gcc"
# define GEN_EXPORTS "emxexp"
+# define DEF2IMPLIB_CMD "emximp"
# define SHARE_SW "-Zdll -Zmtd"
# define USE_OMF true
# define TRUNCATE_DLL_NAME
@@ -197,9 +198,14 @@ bool parse_long_opt(char *arg, cmd_data_t *cmd_data)
cmd_data->mode = mCompile;
cmd_data->output_type = otObject;
}
+
if (strcmp(value, "link") == 0) {
cmd_data->mode = mLink;
}
+
+ if (strcmp(value, "install") == 0) {
+ cmd_data->mode = mInstall;
+ }
} else if (strcmp(var, "shared") == 0) {
shared = true;
} else if (strcmp(var, "export-all") == 0) {
@@ -641,6 +647,8 @@ void cleanup_tmp_dirs(cmd_data_t *cmd_data)
void generate_def_file(cmd_data_t *cmd_data)
{
char def_file[1024];
+ char implib_file[1024];
+ char *ext;
FILE *hDef;
char *export_args[1024];
int num_export_args = 0;
@@ -680,14 +688,36 @@ void generate_def_file(cmd_data_t *cmd_data)
export_args[num_export_args++] = NULL;
spawnvp(P_WAIT, export_args[0], export_args);
cmd_data->arglist[cmd_data->num_args++] = strdup(def_file);
+
+ /* Now make an import library for the dll */
+ num_export_args = 0;
+ export_args[num_export_args++] = DEF2IMPLIB_CMD;
+ export_args[num_export_args++] = "-o";
+
+ strcpy(implib_file, ".libs/");
+ strcat(implib_file, cmd_data->stub_name);
+ ext = strrchr(implib_file, '.');
+
+ if (ext)
+ *ext = 0;
+
+ strcat(implib_file, ".");
+ strcat(implib_file, STATIC_LIB_EXT);
+
+ export_args[num_export_args++] = implib_file;
+ export_args[num_export_args++] = def_file;
+ spawnvp(P_WAIT, export_args[0], export_args);
}
}
}
+/* returns just a file's name without path or extension */
char *nameof(char *fullpath)
{
+ char buffer[1024];
+ char *ext;
char *name = strrchr(fullpath, '/');
if (name == NULL) {
@@ -700,5 +730,13 @@ char *nameof(char *fullpath)
name++;
}
+ strcpy(buffer, name);
+ ext = strrchr(buffer, '.');
+
+ if (ext) {
+ *ext = 0;
+ return strdup(buffer);
+ }
+
return name;
}