diff options
author | joerg <joerg@pkgsrc.org> | 2014-11-29 22:19:55 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2014-11-29 22:19:55 +0000 |
commit | 62ea548ef084be41459eef3b1f1eca3d8560b46c (patch) | |
tree | 299055b3373836c04dc727ffd1faab80438e3c93 /pkgtools | |
parent | 92d5b8f2f7f75f1e7f8b102d0f1d34700ea27bea (diff) | |
download | pkgsrc-62ea548ef084be41459eef3b1f1eca3d8560b46c.tar.gz |
cwrappers-20141129:
- Export path to the wrapper via config file and use that to replace the
libtool call in the relink command.
- Do not drop rpath entries when processing the relink command, they are
still needed.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/cwrappers/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/common.c | 10 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/common.h | 3 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/fixup-libtool.c | 60 |
4 files changed, 55 insertions, 22 deletions
diff --git a/pkgtools/cwrappers/Makefile b/pkgtools/cwrappers/Makefile index 78db6cec176..edb2040ff02 100644 --- a/pkgtools/cwrappers/Makefile +++ b/pkgtools/cwrappers/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.5 2014/11/27 20:36:43 joerg Exp $ +# $NetBSD: Makefile,v 1.6 2014/11/29 22:19:55 joerg Exp $ -PKGNAME= cwrappers-20141127 +PKGNAME= cwrappers-20141129 CATEGORIES= pkgtools sysutils MAINTAINER= joerg@NetBSD.org diff --git a/pkgtools/cwrappers/files/bin/common.c b/pkgtools/cwrappers/files/bin/common.c index 5a72eb6be37..279e562cadc 100644 --- a/pkgtools/cwrappers/files/bin/common.c +++ b/pkgtools/cwrappers/files/bin/common.c @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.2 2014/11/27 20:36:43 joerg Exp $ */ +/* $NetBSD: common.c,v 1.3 2014/11/29 22:19:55 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -40,6 +40,7 @@ static char *worklog_path; static char *real_path; +char *exec_path; char *exec_name; char *wrksrc; int debug; @@ -199,6 +200,11 @@ parse_config(const char *wrapper) real_path = xstrdup(line + 5); continue; } + if (strncmp(line, "exec_path=", 10) == 0) { + free(exec_path); + exec_path = xstrdup(line + 10); + continue; + } if (strncmp(line, "exec=", 5) == 0) { free(exec_name); exec_name = xstrdup(line + 5); @@ -243,6 +249,8 @@ parse_config(const char *wrapper) errx(255, "worklog path has not been set"); if (exec_name == NULL) errx(255, "executable name has not been set"); + if (exec_path == NULL) + errx(255, "executable path has not been set"); } FILE * diff --git a/pkgtools/cwrappers/files/bin/common.h b/pkgtools/cwrappers/files/bin/common.h index aa1b7465423..24c81b8c9b4 100644 --- a/pkgtools/cwrappers/files/bin/common.h +++ b/pkgtools/cwrappers/files/bin/common.h @@ -1,4 +1,4 @@ -/* $NetBSD: common.h,v 1.1 2014/09/17 12:40:56 joerg Exp $ */ +/* $NetBSD: common.h,v 1.2 2014/11/29 22:19:55 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -38,6 +38,7 @@ #include <stdio.h> extern const char library_name_chars[]; +extern char *exec_path; extern char *exec_name; extern char *wrksrc; extern int debug; diff --git a/pkgtools/cwrappers/files/bin/fixup-libtool.c b/pkgtools/cwrappers/files/bin/fixup-libtool.c index 18418c2f6db..3ed949e749d 100644 --- a/pkgtools/cwrappers/files/bin/fixup-libtool.c +++ b/pkgtools/cwrappers/files/bin/fixup-libtool.c @@ -1,4 +1,4 @@ -/* $NetBSD: fixup-libtool.c,v 1.1 2014/09/17 12:40:56 joerg Exp $ */ +/* $NetBSD: fixup-libtool.c,v 1.2 2014/11/29 22:19:55 joerg Exp $ */ /*- * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -92,7 +92,8 @@ struct processing_option { }; static void -process_option(struct processing_option *opt, const char *line, size_t len) +process_option(struct processing_option *opt, const char *line, size_t len, + int in_relink) { struct unwrap_rule *r; struct argument *arg; @@ -103,10 +104,16 @@ process_option(struct processing_option *opt, const char *line, size_t len) if (opt->in_lai && opt->last_opt && opt->last_len == len && strncmp(opt->last_opt, line, len) == 0) return; - if (len >= 11 && strncmp(line, "-Wl,-rpath,", 11) == 0) - return; /* No rpath... */ - if (len >= 15 && strncmp(line, "-Wl,-rpath-link,", 15) == 0) - return; /* Still no rpath... */ + if (len >= 11 && strncmp(line, "-Wl,-rpath,", 11) == 0) { + if (in_relink) + goto print_option; + return; + } + if (len >= 15 && strncmp(line, "-Wl,-rpath-link,", 15) == 0) { + if (in_relink) + goto print_option; + return; + } if (len > 2 && strncmp(line, "-D", 2) == 0) return; /* No preprocessor options */ if (len > 2 && strncmp(line, "-I", 2) == 0) @@ -126,7 +133,8 @@ process_option(struct processing_option *opt, const char *line, size_t len) len -= r->src_len + 2; tmp = xasprintf("-L%s%*.*s", r->dst, (int)len, (int)len, line); - process_option(opt, tmp, strlen(tmp)); + process_option(opt, tmp, strlen(tmp), + in_relink); free(tmp); return; } @@ -179,16 +187,18 @@ process_option(struct processing_option *opt, const char *line, size_t len) if (strncmp(eol + 1, "lib", 3) == 0) { tmp = xasprintf("-L%s%*.*s", r->dst, (int)(eol - line), (int)(eol - line), line); - process_option(opt, tmp, strlen(tmp)); + process_option(opt, tmp, strlen(tmp), + in_relink); free(tmp); eol += 4; len = line + len - eol - 3; - fprintf(opt->output, " -l%*.*s", (int)len, (int)len, - eol); + fprintf(opt->output, " -l%*.*s", (int)len, + (int)len, eol); } else { tmp = xasprintf("%s%*.*s", r->dst, (int)len, (int)len, line); - process_option(opt, tmp, strlen(tmp)); + process_option(opt, tmp, strlen(tmp), + in_relink); free(tmp); } return; @@ -203,14 +213,14 @@ process_option(struct processing_option *opt, const char *line, size_t len) goto print_option; if (*line != '/' && line == eol) { - process_option(opt, "-L./.libs", 9); + process_option(opt, "-L./.libs", 9, in_relink); goto print_option; } if (*line != '/') { tmp = xasprintf("-L%*.*s/.libs", (int)(eol - line), (int)(eol - line), line); - process_option(opt, tmp, strlen(tmp)); + process_option(opt, tmp, strlen(tmp), in_relink); free(tmp); goto print_option; } @@ -226,7 +236,7 @@ process_option(struct processing_option *opt, const char *line, size_t len) tmp = xasprintf("-L%*.*s/.libs", (int)(eol - line), (int)(eol - line), line); - process_option(opt, tmp, strlen(tmp)); + process_option(opt, tmp, strlen(tmp), in_relink); free(tmp); print_option: @@ -263,7 +273,7 @@ process_variable(FILE *output, const char *lafile, const char *line, errx(255, "Unrecognizable relink format"); ++command; fwrite(line, command - line, 1, output); - fputs(" libtool", output); /* XXX Use full path here? */ + fprintf(output, " %s", exec_path); /* XXX document this logic */ line = command + 1; @@ -292,7 +302,7 @@ process_variable(FILE *output, const char *lafile, const char *line, len = strcspn(line, " \t"); if (len == 0) break; - process_option(&opt, line, len); + process_option(&opt, line, len, in_relink); } for (i = 0; i < LIBPATH_HASH; ++i) { @@ -306,11 +316,12 @@ fixup_libtool_la(const char *lafile, int in_lai) { static const char dep_lib[] = "dependency_libs='"; static const char relink_cmd[] = "relink_command=\""; + static const char relink_marker_cmd[] = "# buildlink modification\n"; struct stat st; FILE *fp, *output; char *line, *opt_start, *tmp_name; const char *pass_lafile, *cur_option; - int in_relink; + int in_relink, ignore_relink; char delimiter; size_t len; ssize_t cur; @@ -333,20 +344,33 @@ fixup_libtool_la(const char *lafile, int in_lai) line = NULL; len = 0; while ((cur = getline(&line, &len, fp)) > 0) { + if (strcmp(line, relink_marker_cmd) == 0) { + fwrite(line, 1, cur, output); + ignore_relink = 1; + continue; + } if (strncmp(line, relink_cmd, sizeof(relink_cmd) - 1) == 0) { + if (ignore_relink) { + fwrite(line, 1, cur, output); + ignore_relink = 0; + continue; + } cur_option = relink_cmd; opt_start = line + sizeof(relink_cmd) - 1; pass_lafile = lafile; delimiter='\"'; in_relink = 1; + ignore_relink = 0; } else if (strncmp(line, dep_lib, sizeof(dep_lib) - 1) == 0) { cur_option = dep_lib; opt_start = line + sizeof(dep_lib) - 1; pass_lafile = NULL; delimiter='\''; in_relink = 0; + ignore_relink = 0; } else { fwrite(line, 1, cur, output); + ignore_relink = 0; continue; } @@ -357,7 +381,7 @@ fixup_libtool_la(const char *lafile, int in_lai) output); fwrite(line, 1, cur, output); } else { - fputs("# buildlink modification\n", output); + fputs(relink_marker_cmd, output); } fputs(cur_option, output); line[cur - 2] = '\0'; |