Hopefully more portable for Windows and MacOS X platforms (shared libraries)
This commit is contained in:
parent
2e744e268a
commit
c2d35a1b36
@ -372,6 +372,17 @@ String const * configure_get_config(Configure * configure,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* configure_get_soext */
|
||||||
|
String const * configure_get_soext(Configure * configure)
|
||||||
|
{
|
||||||
|
if(configure->os == HO_MACOSX)
|
||||||
|
return ".dylib";
|
||||||
|
else if(configure->os == HO_WIN32)
|
||||||
|
return ".dll";
|
||||||
|
return ".so";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* prefs_init */
|
/* prefs_init */
|
||||||
static void _prefs_init(Prefs * prefs)
|
static void _prefs_init(Prefs * prefs)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2006-2012 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Devel configure */
|
/* This file is part of DeforaOS Devel configure */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -134,6 +134,7 @@ typedef struct _Configure
|
|||||||
/* accessors */
|
/* accessors */
|
||||||
String const * configure_get_config(Configure * configure,
|
String const * configure_get_config(Configure * configure,
|
||||||
String const * section, String const * variable);
|
String const * section, String const * variable);
|
||||||
|
String const * configure_get_soext(Configure * configure);
|
||||||
|
|
||||||
/* useful */
|
/* useful */
|
||||||
int configure_error(char const * message, int ret);
|
int configure_error(char const * message, int ret);
|
||||||
|
162
src/makefile.c
162
src/makefile.c
@ -1,5 +1,5 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2006-2012 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Devel configure */
|
/* This file is part of DeforaOS Devel configure */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -241,6 +241,7 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
String const * p;
|
String const * p;
|
||||||
String * prints;
|
String * prints;
|
||||||
|
String const * soext;
|
||||||
String * q;
|
String * q;
|
||||||
size_t i;
|
size_t i;
|
||||||
char c;
|
char c;
|
||||||
@ -252,6 +253,7 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
return 0;
|
return 0;
|
||||||
if((prints = string_new(p)) == NULL)
|
if((prints = string_new(p)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
q = prints;
|
q = prints;
|
||||||
fputs("TARGETS\t=", fp);
|
fputs("TARGETS\t=", fp);
|
||||||
for(i = 0;; i++)
|
for(i = 0;; i++)
|
||||||
@ -280,7 +282,7 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
fprintf(fp, " %s%s", prints, ".la");
|
fprintf(fp, " %s%s", prints, ".la");
|
||||||
break;
|
break;
|
||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
fprintf(fp, " %s%s", prints, ".so");
|
fprintf(fp, " %s%s", prints, soext);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
@ -296,17 +298,19 @@ static int _variables_targets(Configure * configure, FILE * fp)
|
|||||||
static int _variables_targets_library(Configure * configure, FILE * fp,
|
static int _variables_targets_library(Configure * configure, FILE * fp,
|
||||||
char const * target)
|
char const * target)
|
||||||
{
|
{
|
||||||
|
String const * soext;
|
||||||
String * soname;
|
String * soname;
|
||||||
String const * p;
|
String const * p;
|
||||||
|
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
if((p = config_get(configure->config, target, "soname")) != NULL)
|
if((p = config_get(configure->config, target, "soname")) != NULL)
|
||||||
soname = string_new(p);
|
soname = string_new(p);
|
||||||
else
|
else
|
||||||
soname = string_new_append(target, ".so.0", NULL);
|
soname = string_new_append(target, soext, ".0", NULL);
|
||||||
if(soname == NULL)
|
if(soname == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
fprintf(fp, " %s%s%s%s%s%s%s%s", target, ".a ", soname, ".0 ", soname,
|
fprintf(fp, " %s%s%s%s%s%s%s%s", target, ".a ", soname, ".0 ", soname,
|
||||||
" ", target, ".so");
|
" ", target, soext);
|
||||||
string_delete(soname);
|
string_delete(soname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1035,6 +1039,7 @@ static void _flags_cxx(Configure * configure, FILE * fp, String const * target)
|
|||||||
static int _target_library(Configure * configure, FILE * fp,
|
static int _target_library(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
|
String const * soext;
|
||||||
String const * p;
|
String const * p;
|
||||||
String * q;
|
String * q;
|
||||||
String * soname;
|
String * soname;
|
||||||
@ -1045,13 +1050,14 @@ static int _target_library(Configure * configure, FILE * fp,
|
|||||||
return 0;
|
return 0;
|
||||||
if(_target_flags(configure, fp, target) != 0)
|
if(_target_flags(configure, fp, target) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
fprintf(fp, "\n%s%s%s%s", target, ".a: $(", target, "_OBJS)");
|
fprintf(fp, "\n%s%s%s%s", target, ".a: $(", target, "_OBJS)");
|
||||||
if((p = config_get(configure->config, target, "depends")) != NULL)
|
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||||
fprintf(fp, " %s", p);
|
fprintf(fp, " %s", p);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
fprintf(fp, "%s%s%s%s%s", "\t$(AR) -rc ", target, ".a $(", target,
|
fprintf(fp, "%s%s%s%s%s", "\t$(AR) -rc ", target, ".a $(", target,
|
||||||
"_OBJS)");
|
"_OBJS)");
|
||||||
if((q = malloc(strlen(target) + 4)) != NULL) /* for ".so" later */
|
if((q = malloc(strlen(target) + strlen(soext) + 3)) != NULL)
|
||||||
{
|
{
|
||||||
sprintf(q, "%s.a", target);
|
sprintf(q, "%s.a", target);
|
||||||
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
||||||
@ -1062,11 +1068,11 @@ static int _target_library(Configure * configure, FILE * fp,
|
|||||||
if((p = config_get(configure->config, target, "soname")) != NULL)
|
if((p = config_get(configure->config, target, "soname")) != NULL)
|
||||||
soname = string_new(p);
|
soname = string_new(p);
|
||||||
else
|
else
|
||||||
soname = string_new_append(target, ".so.0", NULL);
|
soname = string_new_append(target, soext, ".0", NULL);
|
||||||
if(soname == NULL)
|
if(soname == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
fprintf(fp, "\n%s%s%s%s%s%s%s%s", soname, ".0 ", soname, " ", target,
|
fprintf(fp, "\n%s%s%s%s%s%s%s%s%s", soname, ".0 ", soname, " ", target,
|
||||||
".so: $(", target, "_OBJS)");
|
soext, ": $(", target, "_OBJS)");
|
||||||
if((p = config_get(configure->config, target, "depends")) != NULL)
|
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||||
fprintf(fp, " %s", p);
|
fprintf(fp, " %s", p);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
@ -1078,7 +1084,7 @@ static int _target_library(Configure * configure, FILE * fp,
|
|||||||
"_LDFLAGS)");
|
"_LDFLAGS)");
|
||||||
if(q != NULL)
|
if(q != NULL)
|
||||||
{
|
{
|
||||||
sprintf(q, "%s.so", target);
|
sprintf(q, "%s%s", target, soext);
|
||||||
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
||||||
_binary_ldflags(configure, fp, p);
|
_binary_ldflags(configure, fp, p);
|
||||||
free(q);
|
free(q);
|
||||||
@ -1086,8 +1092,8 @@ static int _target_library(Configure * configure, FILE * fp,
|
|||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
fprintf(fp, "%s%s%s%s%s", "\t$(LN) -s -- ", soname, ".0 ", soname,
|
fprintf(fp, "%s%s%s%s%s", "\t$(LN) -s -- ", soname, ".0 ", soname,
|
||||||
"\n");
|
"\n");
|
||||||
fprintf(fp, "%s%s%s%s%s", "\t$(LN) -s -- ", soname, ".0 ", target,
|
fprintf(fp, "%s%s%s%s%s%s", "\t$(LN) -s -- ", soname, ".0 ", target,
|
||||||
".so\n");
|
soext, "\n");
|
||||||
string_delete(soname);
|
string_delete(soname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1176,6 +1182,7 @@ static int _target_object(Configure * configure, FILE * fp,
|
|||||||
static int _target_plugin(Configure * configure, FILE * fp,
|
static int _target_plugin(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
|
String const * soext;
|
||||||
String const * p;
|
String const * p;
|
||||||
String * q;
|
String * q;
|
||||||
|
|
||||||
@ -1185,15 +1192,16 @@ static int _target_plugin(Configure * configure, FILE * fp,
|
|||||||
return 0;
|
return 0;
|
||||||
if(_target_flags(configure, fp, target) != 0)
|
if(_target_flags(configure, fp, target) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
fprintf(fp, "\n%s%s%s%s", target, ".so: $(", target, "_OBJS)");
|
soext = configure_get_soext(configure);
|
||||||
|
fprintf(fp, "\n%s%s%s%s%s", target, soext, ": $(", target, "_OBJS)");
|
||||||
if((p = config_get(configure->config, target, "depends")) != NULL)
|
if((p = config_get(configure->config, target, "depends")) != NULL)
|
||||||
fprintf(fp, " %s", p);
|
fprintf(fp, " %s", p);
|
||||||
fputc('\n', fp);
|
fputc('\n', fp);
|
||||||
fprintf(fp, "%s%s%s%s%s%s%s", "\t$(CCSHARED) -o ", target, ".so $(",
|
fprintf(fp, "%s%s%s%s%s%s%s%s", "\t$(CCSHARED) -o ", target, soext,
|
||||||
target, "_OBJS) $(", target, "_LDFLAGS)");
|
" $(", target, "_OBJS) $(", target, "_LDFLAGS)");
|
||||||
if((q = malloc(strlen(target) + 4)) != NULL)
|
if((q = malloc(strlen(target) + 4)) != NULL)
|
||||||
{
|
{
|
||||||
sprintf(q, "%s.so", target);
|
sprintf(q, "%s%s", target, soext);
|
||||||
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
if((p = config_get(configure->config, q, "ldflags")) != NULL)
|
||||||
_binary_ldflags(configure, fp, p);
|
_binary_ldflags(configure, fp, p);
|
||||||
free(q);
|
free(q);
|
||||||
@ -1653,7 +1661,8 @@ static int _write_install(Configure * configure, FILE * fp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _install_target(Config * config, FILE * fp, String const * target);
|
static int _install_target(Configure * configure, FILE * fp,
|
||||||
|
String const * target);
|
||||||
static int _install_targets(Configure * configure, FILE * fp)
|
static int _install_targets(Configure * configure, FILE * fp)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -1674,7 +1683,7 @@ static int _install_targets(Configure * configure, FILE * fp)
|
|||||||
continue;
|
continue;
|
||||||
c = targets[i];
|
c = targets[i];
|
||||||
targets[i] = '\0';
|
targets[i] = '\0';
|
||||||
ret |= _install_target(configure->config, fp, targets);
|
ret |= _install_target(configure, fp, targets);
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
targets += i + 1;
|
targets += i + 1;
|
||||||
@ -1684,45 +1693,46 @@ static int _install_targets(Configure * configure, FILE * fp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_binary(Config * config, FILE * fp,
|
static void _install_target_binary(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static int _install_target_library(Config * config, FILE * fp,
|
static int _install_target_library(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_libtool(Config * config, FILE * fp,
|
static void _install_target_libtool(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_object(Config * config, FILE * fp,
|
static void _install_target_object(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_plugin(Config * config, FILE * fp,
|
static void _install_target_plugin(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static void _install_target_script(Config * config, FILE * fp,
|
static void _install_target_script(Configure * configure, FILE * fp,
|
||||||
String const * target);
|
String const * target);
|
||||||
static int _install_target(Config * config, FILE * fp, String const * target)
|
static int _install_target(Configure * configure, FILE * fp,
|
||||||
|
String const * target)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
String const * type;
|
String const * type;
|
||||||
TargetType tt;
|
TargetType tt;
|
||||||
|
|
||||||
if((type = config_get(config, target, "type")) == NULL)
|
if((type = config_get(configure->config, target, "type")) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
switch((tt = enum_string(TT_LAST, sTargetType, type)))
|
switch((tt = enum_string(TT_LAST, sTargetType, type)))
|
||||||
{
|
{
|
||||||
case TT_BINARY:
|
case TT_BINARY:
|
||||||
_install_target_binary(config, fp, target);
|
_install_target_binary(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
ret = _install_target_library(config, fp, target);
|
ret = _install_target_library(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_LIBTOOL:
|
case TT_LIBTOOL:
|
||||||
_install_target_libtool(config, fp, target);
|
_install_target_libtool(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_OBJECT:
|
case TT_OBJECT:
|
||||||
_install_target_object(config, fp, target);
|
_install_target_object(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
_install_target_plugin(config, fp, target);
|
_install_target_plugin(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_SCRIPT:
|
case TT_SCRIPT:
|
||||||
_install_target_script(config, fp, target);
|
_install_target_script(configure, fp, target);
|
||||||
break;
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
@ -1730,52 +1740,54 @@ static int _install_target(Config * config, FILE * fp, String const * target)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_binary(Config * config, FILE * fp,
|
static void _install_target_binary(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
fprintf(fp, "%s%s%s%s/%s\n", "\t$(INSTALL) -m 0755 -- ", target,
|
fprintf(fp, "%s%s%s%s/%s\n", "\t$(INSTALL) -m 0755 -- ", target,
|
||||||
" $(DESTDIR)", path, target);
|
" $(DESTDIR)", path, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _install_target_library(Config * config, FILE * fp,
|
static int _install_target_library(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
|
String const * soext;
|
||||||
String const * p;
|
String const * p;
|
||||||
String * soname;
|
String * soname;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0644 -- ", target,
|
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0644 -- ", target,
|
||||||
".a $(DESTDIR)", path, target, ".a\n");
|
".a $(DESTDIR)", path, target, ".a\n");
|
||||||
if((p = config_get(config, target, "soname")) != NULL)
|
if((p = config_get(configure->config, target, "soname")) != NULL)
|
||||||
soname = string_new(p);
|
soname = string_new(p);
|
||||||
else
|
else
|
||||||
soname = string_new_append(target, ".so.0", NULL);
|
soname = string_new_append(target, soext, ".0", NULL);
|
||||||
if(soname == NULL)
|
if(soname == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0755 -- ", soname,
|
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0755 -- ", soname,
|
||||||
".0 $(DESTDIR)", path, soname, ".0\n");
|
".0 $(DESTDIR)", path, soname, ".0\n");
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(LN) -s -- ", soname,
|
fprintf(fp, "%s%s%s%s/%s%s", "\t$(LN) -s -- ", soname,
|
||||||
".0 $(DESTDIR)", path, soname, "\n");
|
".0 $(DESTDIR)", path, soname, "\n");
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(LN) -s -- ", soname,
|
fprintf(fp, "%s%s%s%s/%s%s%s", "\t$(LN) -s -- ", soname,
|
||||||
".0 $(DESTDIR)", path, target, ".so\n");
|
".0 $(DESTDIR)", path, target, soext, "\n");
|
||||||
string_delete(soname);
|
string_delete(soname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_libtool(Config * config, FILE * fp,
|
static void _install_target_libtool(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(LIBTOOL) --mode=install $(INSTALL)"
|
fprintf(fp, "%s%s%s%s/%s%s", "\t$(LIBTOOL) --mode=install $(INSTALL)"
|
||||||
@ -1784,39 +1796,41 @@ static void _install_target_libtool(Config * config, FILE * fp,
|
|||||||
fprintf(fp, "%s/%s\n", "\t$(LIBTOOL) --mode=finish $(DESTDIR)", path);
|
fprintf(fp, "%s/%s\n", "\t$(LIBTOOL) --mode=finish $(DESTDIR)", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_object(Config * config, FILE * fp,
|
static void _install_target_object(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
fprintf(fp, "%s%s%s%s/%s\n", "\t$(INSTALL) -m 0644 -- ", target,
|
fprintf(fp, "%s%s%s%s/%s\n", "\t$(INSTALL) -m 0644 -- ", target,
|
||||||
" $(DESTDIR)", path, target);
|
" $(DESTDIR)", path, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_plugin(Config * config, FILE * fp,
|
static void _install_target_plugin(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
|
String const * soext;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
fprintf(fp, "%s%s\n", "\t$(MKDIR) $(DESTDIR)", path);
|
||||||
fprintf(fp, "%s%s%s%s/%s%s", "\t$(INSTALL) -m 0644 -- ", target,
|
fprintf(fp, "%s%s%s%s%s/%s%s%s", "\t$(INSTALL) -m 0644 -- ", target,
|
||||||
".so $(DESTDIR)", path, target, ".so\n");
|
soext, " $(DESTDIR)", path, target, soext, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _install_target_script(Config * config, FILE * fp,
|
static void _install_target_script(Configure * configure, FILE * fp,
|
||||||
String const * target)
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * path;
|
String const * path;
|
||||||
String const * script;
|
String const * script;
|
||||||
|
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return;
|
return;
|
||||||
if((script = config_get(config, target, "script")) == NULL)
|
if((script = config_get(configure->config, target, "script")) == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -P \"$(DESTDIR)$(PREFIX)",
|
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -P \"$(DESTDIR)$(PREFIX)",
|
||||||
*path ? "/" : "", *path ? path : "", "\" -i -- \"",
|
*path ? "/" : "", *path ? path : "", "\" -i -- \"",
|
||||||
@ -1937,7 +1951,8 @@ static int _dist_check(Configure * configure, char const * target,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _uninstall_target(Config * config, FILE * fp, String const * target);
|
static int _uninstall_target(Configure * configure, FILE * fp,
|
||||||
|
String const * target);
|
||||||
static int _uninstall_include(Config * config, FILE * fp,
|
static int _uninstall_include(Config * config, FILE * fp,
|
||||||
String const * include);
|
String const * include);
|
||||||
static int _uninstall_dist(Config * config, FILE * fp, String const * dist);
|
static int _uninstall_dist(Config * config, FILE * fp, String const * dist);
|
||||||
@ -1969,7 +1984,7 @@ static int _write_uninstall(Configure * configure, FILE * fp)
|
|||||||
continue;
|
continue;
|
||||||
c = targets[i];
|
c = targets[i];
|
||||||
targets[i] = '\0';
|
targets[i] = '\0';
|
||||||
ret = _uninstall_target(configure->config, fp, targets);
|
ret = _uninstall_target(configure, fp, targets);
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
targets += i + 1;
|
targets += i + 1;
|
||||||
@ -2019,21 +2034,24 @@ static int _write_uninstall(Configure * configure, FILE * fp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _uninstall_target_library(Config * config, FILE * fp,
|
static void _uninstall_target_library(Configure * configure, FILE * fp,
|
||||||
String const * target, String const * path);
|
String const * target, String const * path);
|
||||||
static void _uninstall_target_script(Config * config, FILE * fp,
|
static void _uninstall_target_script(Configure * configure, FILE * fp,
|
||||||
String const * target, String const * path);
|
String const * target, String const * path);
|
||||||
static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
static int _uninstall_target(Configure * configure, FILE * fp,
|
||||||
|
String const * target)
|
||||||
{
|
{
|
||||||
String const * type;
|
String const * type;
|
||||||
String const * path;
|
String const * path;
|
||||||
|
String const * soext;
|
||||||
TargetType tt;
|
TargetType tt;
|
||||||
const String * rm_destdir = "$(RM) -- $(DESTDIR)";
|
const String * rm_destdir = "$(RM) -- $(DESTDIR)";
|
||||||
|
|
||||||
if((type = config_get(config, target, "type")) == NULL)
|
if((type = config_get(configure->config, target, "type")) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if((path = config_get(config, target, "install")) == NULL)
|
if((path = config_get(configure->config, target, "install")) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
soext = configure_get_soext(configure);
|
||||||
tt = enum_string(TT_LAST, sTargetType, type);
|
tt = enum_string(TT_LAST, sTargetType, type);
|
||||||
switch(tt)
|
switch(tt)
|
||||||
{
|
{
|
||||||
@ -2041,7 +2059,7 @@ static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
|||||||
fprintf(fp, "\t%s%s/%s\n", rm_destdir, path, target);
|
fprintf(fp, "\t%s%s/%s\n", rm_destdir, path, target);
|
||||||
break;
|
break;
|
||||||
case TT_LIBRARY:
|
case TT_LIBRARY:
|
||||||
_uninstall_target_library(config, fp, target, path);
|
_uninstall_target_library(configure, fp, target, path);
|
||||||
break;
|
break;
|
||||||
case TT_LIBTOOL:
|
case TT_LIBTOOL:
|
||||||
fprintf(fp, "\t%s%s%s/%s%s", "$(LIBTOOL)"
|
fprintf(fp, "\t%s%s%s/%s%s", "$(LIBTOOL)"
|
||||||
@ -2053,10 +2071,10 @@ static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
|||||||
break;
|
break;
|
||||||
case TT_PLUGIN:
|
case TT_PLUGIN:
|
||||||
fprintf(fp, "\t%s%s/%s%s\n", rm_destdir, path, target,
|
fprintf(fp, "\t%s%s/%s%s\n", rm_destdir, path, target,
|
||||||
".so");
|
soext);
|
||||||
break;
|
break;
|
||||||
case TT_SCRIPT:
|
case TT_SCRIPT:
|
||||||
_uninstall_target_script(config, fp, target, path);
|
_uninstall_target_script(configure, fp, target, path);
|
||||||
break;
|
break;
|
||||||
case TT_UNKNOWN:
|
case TT_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
@ -2064,33 +2082,35 @@ static int _uninstall_target(Config * config, FILE * fp, String const * target)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _uninstall_target_library(Config * config, FILE * fp,
|
static void _uninstall_target_library(Configure * configure, FILE * fp,
|
||||||
String const * target, String const * path)
|
String const * target, String const * path)
|
||||||
{
|
{
|
||||||
|
String const * soext;
|
||||||
String const * soname;
|
String const * soname;
|
||||||
const String * format = "\t%s%s/%s%s";
|
const String * format = "\t%s%s/%s%s%s";
|
||||||
const String * rm_destdir = "$(RM) -- $(DESTDIR)";
|
const String * rm_destdir = "$(RM) -- $(DESTDIR)";
|
||||||
|
|
||||||
fprintf(fp, format, rm_destdir, path, target, ".a\n");
|
soext = configure_get_soext(configure);
|
||||||
if((soname = config_get(config, target, "soname")) == NULL)
|
fprintf(fp, format, rm_destdir, path, target, ".a\n", "");
|
||||||
|
if((soname = config_get(configure->config, target, "soname")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(fp, format, rm_destdir, path, target, ".so.0.0\n");
|
fprintf(fp, format, rm_destdir, path, target, soext, ".0.0\n");
|
||||||
fprintf(fp, format, rm_destdir, path, target, ".so.0\n");
|
fprintf(fp, format, rm_destdir, path, target, soext, ".0\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(fp, format, rm_destdir, path, soname, ".0\n");
|
fprintf(fp, format, rm_destdir, path, soname, ".0\n", "");
|
||||||
fprintf(fp, format, rm_destdir, path, soname, "\n");
|
fprintf(fp, format, rm_destdir, path, soname, "\n", "");
|
||||||
}
|
}
|
||||||
fprintf(fp, format, rm_destdir, path, target, ".so\n");
|
fprintf(fp, format, rm_destdir, path, target, soext, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _uninstall_target_script(Config * config, FILE * fp,
|
static void _uninstall_target_script(Configure * configure, FILE * fp,
|
||||||
String const * target, String const * path)
|
String const * target, String const * path)
|
||||||
{
|
{
|
||||||
String const * script;
|
String const * script;
|
||||||
|
|
||||||
if((script = config_get(config, target, "script")) == NULL)
|
if((script = config_get(configure->config, target, "script")) == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -P \"$(DESTDIR)$(PREFIX)",
|
fprintf(fp, "\t%s%s%s%s%s%s%s", script, " -P \"$(DESTDIR)$(PREFIX)",
|
||||||
*path ? "/" : "", *path ? path : "", "\" -u -- \"",
|
*path ? "/" : "", *path ? path : "", "\" -u -- \"",
|
||||||
|
Loading…
Reference in New Issue
Block a user