scconfig (configure) and windows install updates
This commit is contained in:
parent
80b2d88caf
commit
43d3374c80
File diff suppressed because it is too large
Load Diff
|
|
@ -470,6 +470,12 @@
|
|||
<Component Id="cmp95428DF15E67AEA42FEFB38AD8DB0C25" Guid="{DE0C3032-D210-4988-BF0D-7B957109F99F}">
|
||||
<File Id="filB14DF2131B0544A28F996AFC0F045234" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\osc.sym" />
|
||||
</Component>
|
||||
<Component Id="cmp610744DE0532E5584ABD8617C8865B35" Guid="{2C578998-34F4-4E28-977C-699BE6E4C8F9}">
|
||||
<File Id="filFA561903106047F046FCAD46E46E2747" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\plot_manipulation.sch" />
|
||||
</Component>
|
||||
<Component Id="cmp11D3F0063EABB6D6807243D2674493C0" Guid="{16C46BD2-2BC4-48E5-A1BB-796338E21800}">
|
||||
<File Id="fil531E58684F5EAF05CA24194A538D4217" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\plot_manipulation.sym" />
|
||||
</Component>
|
||||
<Component Id="cmpDA0059CD9B0B7597A1C2A158F52D6018" Guid="{62A2236D-9531-45A7-85A5-C03EDD6DA3C5}">
|
||||
<File Id="fil84F2584FB007DEFBC4C629DC49C7A263" KeyPath="yes" Source="$(var.xschemLibrarySrcDir)\examples\poweramp.sch" />
|
||||
</Component>
|
||||
|
|
@ -5259,6 +5265,8 @@
|
|||
<ComponentRef Id="cmpADFA933DEFE494D671DF34FA0879E9BA" />
|
||||
<ComponentRef Id="cmp5E27A15539EC756122E1540FA28AB1A1" />
|
||||
<ComponentRef Id="cmp95428DF15E67AEA42FEFB38AD8DB0C25" />
|
||||
<ComponentRef Id="cmp610744DE0532E5584ABD8617C8865B35" />
|
||||
<ComponentRef Id="cmp11D3F0063EABB6D6807243D2674493C0" />
|
||||
<ComponentRef Id="cmpDA0059CD9B0B7597A1C2A158F52D6018" />
|
||||
<ComponentRef Id="cmp8F4AD0DB3284F789679B6E780DF7616A" />
|
||||
<ComponentRef Id="cmp09E02BBAEBC12A661A112103F3DF3185" />
|
||||
|
|
|
|||
|
|
@ -798,7 +798,7 @@ static int try_dynlib(int logdepth, const char *cflags, char *concated_ldflags,
|
|||
libname_dyn = libname = (char *)get("sys/ext_dynlib");
|
||||
if ((compile_code(logdepth, test_lib, &oname, NULL, cflags_c, NULL) != 0) ||
|
||||
(compile_file(logdepth, oname, &libname_dyn, NULL, NULL, concated_ldflags) != 0)) {
|
||||
report("FAILED (compiling dynlib)\n");
|
||||
report("('%s': nope) ", concated_ldflags);
|
||||
}
|
||||
else {
|
||||
sprintf(test_host_app, test_host, ld_include, libname_dyn);
|
||||
|
|
@ -833,6 +833,7 @@ int find_ldflags_dynlib(const char *name, int logdepth, int fatal)
|
|||
|
||||
if (try_dynlib(logdepth, NULL, concat_nodes("-dynamic -shared", "cc/rdynamic", "libs/ldl", NULL), "cc/ldflags_dynlib", "-dynamic -shared", NULL, get("libs/ldl"))) return 0;
|
||||
if (try_dynlib(logdepth, NULL, concat_nodes("-shared", "cc/rdynamic", "libs/ldl", NULL), "cc/ldflags_dynlib", "-shared", NULL, get("libs/ldl"))) return 0;
|
||||
if (try_dynlib(logdepth, NULL, concat_nodes("-G", "libs/ldl", NULL), "cc/ldflags_dynlib", "-G", NULL, get("libs/ldl"))) return 0; /* xlc (on AIX) */
|
||||
report("Not found.\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ int find_io_fileno(const char *name, int logdepth, int fatal)
|
|||
char *test_c_ =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main() {"
|
||||
NL no_implicit(int, "%s", "%s")
|
||||
/* NOTE: can not check for implicit declaration as fileno() may be a macro (e.g. on MINIX3) */
|
||||
NL " if (%s(stdout) >= 0)"
|
||||
NL " puts(\"OK\"); "
|
||||
NL " return 0;"
|
||||
|
|
@ -138,20 +138,26 @@ int find_io_fileno(const char *name, int logdepth, int fatal)
|
|||
logdepth++;
|
||||
|
||||
/* UNIX */
|
||||
sprintf(test_c, test_c_, "fileno", "fileno", "fileno");
|
||||
sprintf(test_c, test_c_, "fileno");
|
||||
if (try_icl(logdepth, "libs/io/fileno", test_c, NULL, NULL, NULL)) {
|
||||
put("libs/io/fileno/call", "fileno");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(test_c, test_c_, "fileno");
|
||||
if (try_icl(logdepth, "libs/io/fileno", test_c, "#include <unistd.h>\n", NULL, NULL)) {
|
||||
put("libs/io/fileno/call", "fileno");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(test_c, test_c_, "fileno", "fileno", "fileno");
|
||||
sprintf(test_c, test_c_, "fileno");
|
||||
if (try_icl(logdepth, "libs/io/fileno", test_c, "#define _XOPEN_SOURCE\n#include <unistd.h>\n", NULL, NULL)) {
|
||||
put("libs/io/fileno/call", "fileno");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* windows */
|
||||
sprintf(test_c, test_c_, "_fileno", "_fileno", "_fileno");
|
||||
sprintf(test_c, test_c_, "_fileno");
|
||||
if (try_icl(logdepth, "libs/io/fileno", test_c, "#include <stdio.h>\n", NULL, NULL)) {
|
||||
put("libs/io/fileno/call", "_fileno");
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ uname_t unames[] = {
|
|||
{"[Bb][Ss][Dd]", "BSD", "UNIX", sys_unix},
|
||||
{"SunOS", "SunOS", "UNIX", sys_unix},
|
||||
{"OSF1", "OSF", "UNIX", sys_unix}, /* TODO: note the difference in cflags for debugging ("-ms -g") */
|
||||
{"AIX", "AIX", "UNIX", sys_unix},
|
||||
{"IRIX", "IRIX", "UNIX", sys_unix},
|
||||
{"SunOS", "SunOS", "UNIX", sys_unix},
|
||||
{"[Mm]inix", "Minix", "UNIX", sys_unix},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
scconfig - sccbox: portable copy, link, mkdir and remove
|
||||
Copyright (C) 2016, 2017 Tibor Palinkas
|
||||
scconfig - sccbox: portable copy, link, mkdir, remove, etc.
|
||||
Copyright (C) 2016, 2017, 2020 Tibor Palinkas
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
/*********************** DOCUMENTATION **************************/
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ static void help_generic(const char *prg)
|
|||
printf(" error error handling\n");
|
||||
printf(" rm remove files (e.g. for make clean)\n");
|
||||
printf(" mkdir create directories (e.g. for make *install)\n");
|
||||
printf(" mktemp create a temporary file/directory\n");
|
||||
printf(" ln create symlink (e.g. for make *install)\n");
|
||||
printf(" install copy-install files (e.g. for make install)\n");
|
||||
printf(" linstall symlink-install files (e.g. for make linstall)\n");
|
||||
|
|
@ -105,6 +107,18 @@ static void help_mkdir(const char *prg)
|
|||
printf(" -r do not do anyhting, exit 0\n\n");
|
||||
}
|
||||
|
||||
static void help_mktemp(const char *prg)
|
||||
{
|
||||
printf("sccbox mktemp [switches]\n\n");
|
||||
printf("Create a temporary file or directory and print its path to stdout\n\n");
|
||||
printf("Switches:\n");
|
||||
printf(" --quiet don't print error messages and set exit status to 0\n");
|
||||
printf(" --force ignored (there's nothing to force)\n");
|
||||
printf(" -d create a directory, not a file\n");
|
||||
printf(" -p tmp path to tmpdir\n");
|
||||
printf(" -t tpl use tpl as file name template\n\n");
|
||||
}
|
||||
|
||||
static void help_ln_common(void)
|
||||
{
|
||||
printf(" --quiet don't print error messages and set exit status to 0\n");
|
||||
|
|
@ -183,6 +197,7 @@ static int help(const char *prg, const char *topic)
|
|||
else if (strcmp(topic, "error") == 0) help_error(prg);
|
||||
else if (strcmp(topic, "rm") == 0) help_rm(prg);
|
||||
else if (strcmp(topic, "mkdir") == 0) help_mkdir(prg);
|
||||
else if (strcmp(topic, "mktemp") == 0) help_mktemp(prg);
|
||||
else if (strcmp(topic, "ln") == 0) help_ln(prg);
|
||||
else if (strcmp(topic, "install") == 0) help_install(prg);
|
||||
else if (strcmp(topic, "linstall") == 0) help_linstall(prg);
|
||||
|
|
@ -212,12 +227,15 @@ typedef enum {
|
|||
} scc_mode_t;
|
||||
|
||||
#define kill_flag argv[n] = NULL
|
||||
#define kill_flag2 do { argv[n] = NULL; n++; argv[n] = NULL; } while(0)
|
||||
|
||||
#define load_flags(code) \
|
||||
do { \
|
||||
int n, flags = 1; \
|
||||
for(n = 1; n < argc; n++) { \
|
||||
char *arg = argv[n]; \
|
||||
char *payload = argv[n+1]; \
|
||||
(void)payload; \
|
||||
if ((*arg == '-') && (flags)) { \
|
||||
if ((arg[1] == '-') && (arg[2] == '\0')) { \
|
||||
kill_flag; \
|
||||
|
|
@ -794,6 +812,100 @@ int cmd_mkdir(int argc, char *argv[])
|
|||
return err;
|
||||
}
|
||||
|
||||
int rand_chr(void)
|
||||
{
|
||||
static int seeded = 0;
|
||||
static const char map[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
|
||||
|
||||
if (!seeded) {
|
||||
FILE *f;
|
||||
long seed;
|
||||
|
||||
f = fopen("/dev/urandom", "rb");
|
||||
if (f != NULL) {
|
||||
int n;
|
||||
for(n = 0; n < 4; n++) {
|
||||
seed <<= 8;
|
||||
seed |= fgetc(f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
seed = time(NULL);
|
||||
srand(seed);
|
||||
seeded = 1;
|
||||
}
|
||||
return map[(int)((double)rand() / (double)RAND_MAX * (sizeof(map)-1))];
|
||||
}
|
||||
|
||||
int cmd_mktemp(int argc, char *argv[])
|
||||
{
|
||||
int want_dir = 0, err = 0, quiet = 0, retry;
|
||||
const char *template = "scctmp.^^^^^^^^";
|
||||
const char *tmpdir = "."; /* assume . is the safe place to create temp files the unsafe way */
|
||||
char path[MY_PATH_MAX];
|
||||
|
||||
load_flags(
|
||||
switch(*arg) {
|
||||
case 'q': /* --quiet */
|
||||
quiet = 1; kill_flag; break;
|
||||
case 'd': /* --quiet */
|
||||
want_dir = 1; kill_flag; break;
|
||||
case 't': /* --template */
|
||||
template = payload; kill_flag2; break;
|
||||
case 'p': /* --path */
|
||||
tmpdir = payload; kill_flag2; break;
|
||||
case 'f':
|
||||
kill_flag; break; /* ignore */
|
||||
}
|
||||
);
|
||||
|
||||
for(retry = 0; retry < 8; retry++) {
|
||||
int dlen = strlen(tmpdir), rc = 0;
|
||||
const char *t;
|
||||
char *end;
|
||||
|
||||
/* generate a path */
|
||||
memcpy(path, tmpdir, dlen);
|
||||
end = path+dlen;
|
||||
for(*end++ = '/', t = template; *t != '\0'; end++, t++) {
|
||||
if (*t == '^') {
|
||||
*end = rand_chr();
|
||||
rc++;
|
||||
}
|
||||
else
|
||||
*end = *t;
|
||||
}
|
||||
while(rc < 8) { /* make sure there are at least 8 random characters */
|
||||
*end++ = rand_chr();
|
||||
rc++;
|
||||
}
|
||||
*end = '\0';
|
||||
|
||||
if (want_dir) {
|
||||
if (mkdir(path, 0755) == 0) {
|
||||
printf("%s\n", path);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
FILE *f = fopen(path, "w");
|
||||
if (f != NULL) {
|
||||
fclose(f);
|
||||
printf("%s\n", path);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quiet)
|
||||
return 0;
|
||||
|
||||
fprintf(stderr, "sccbox: failed to create temporary %s\n", want_dir ? "directory" : "file");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int cmd_touch(int argc, char *argv[], int only_new)
|
||||
{
|
||||
int n, res = 0;
|
||||
|
|
@ -829,6 +941,7 @@ int main(int argc, char *argv[])
|
|||
if (strcmp(argv[0], "linstall") == 0) return cmd_install(argc, argv, LINSTALL, 1);
|
||||
if (strcmp(argv[0], "uninstall") == 0) return cmd_install(argc, argv, UNINSTALL, 1);
|
||||
if (strcmp(argv[0], "mkdir") == 0) return cmd_mkdir(argc, argv);
|
||||
if (strcmp(argv[0], "mktemp") == 0) return cmd_mktemp(argc, argv);
|
||||
if (strcmp(argv[0], "ln") == 0) return cmd_install(argc, argv, LINSTALL, 0);
|
||||
if (strcmp(argv[0], "touch") == 0) return cmd_touch(argc, argv, 0);
|
||||
if (strcmp(argv[0], "touchnew") == 0) return cmd_touch(argc, argv, 1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue