Browse Source

Clifford Wolf:


			
			
				rocklinux
			
			
		
Clifford Wolf 21 years ago
parent
commit
aad39b0e43
44 changed files with 1218 additions and 111 deletions
  1. +2
    -0
      misc/tools-source/fl_stparse.c
  2. +456
    -0
      misc/tools-source/pseudonative_daemon.c
  3. +423
    -0
      misc/tools-source/pseudonative_handler.c
  4. +1
    -0
      package/base/00-dirtree/data.txt
  5. +2
    -2
      package/base/bash/bash.conf
  6. +1
    -1
      package/base/bash/bash.desc
  7. +1
    -1
      package/base/bison/bison.desc
  8. +1
    -1
      package/base/bzip2/bzip2.desc
  9. +4
    -1
      package/base/coreutils/coreutils.conf
  10. +1
    -1
      package/base/coreutils/coreutils.desc
  11. +1
    -1
      package/base/diffutils/diffutils.desc
  12. +5
    -5
      package/base/findutils/findutils.conf
  13. +1
    -1
      package/base/findutils/findutils.desc
  14. +1
    -1
      package/base/flex/flex.desc
  15. +5
    -5
      package/base/gawk/gawk.conf
  16. +1
    -1
      package/base/gawk/gawk.desc
  17. +62
    -21
      package/base/gcc/gcc.conf
  18. +18
    -0
      package/base/gcc/parse-config
  19. +5
    -1
      package/base/gcc/wrappers.in
  20. +5
    -4
      package/base/glibc/glibc.conf
  21. +1
    -1
      package/base/grep/grep.desc
  22. +3
    -1
      package/base/gzip/gzip.conf
  23. +1
    -1
      package/base/gzip/gzip.desc
  24. +1
    -1
      package/base/make/make.desc
  25. +1
    -1
      package/base/mktemp/mktemp.desc
  26. +28
    -31
      package/base/ncompress/config.patch
  27. +1
    -1
      package/base/ncompress/ncompress.conf
  28. +6
    -1
      package/base/netkit-rsh/netkit-rsh.conf
  29. +3
    -3
      package/base/nvi/nvi.conf
  30. +4
    -1
      package/base/openssh/openssh.conf
  31. +1
    -1
      package/base/patch/patch.desc
  32. +4
    -1
      package/base/sed/sed.conf
  33. +1
    -1
      package/base/sed/sed.desc
  34. +1
    -1
      package/base/strace/strace.desc
  35. +1
    -0
      package/base/sysfiles/parse-config
  36. +5
    -2
      package/base/tar/tar.conf
  37. +1
    -1
      package/base/tar/tar.desc
  38. +1
    -1
      package/base/time/time.desc
  39. +47
    -3
      package/x11/xfree86/xfree86.conf
  40. +1
    -1
      package/x11/xfree86/xfree86.desc
  41. +80
    -6
      scripts/Build-Pkg
  42. +7
    -1
      scripts/Build-Tools
  43. +19
    -3
      scripts/config.in
  44. +4
    -0
      scripts/parse-config

+ 2
- 0
misc/tools-source/fl_stparse.c

@ -128,6 +128,8 @@ int main(int argc, char ** argv) {
}
do {
// ignore this line if syscall returned error
if ( strstr(line, " = -1 E") ) continue;
if ( sscanf(line, "%d fork() = %d", &pid, &newpid) == 2 ||
sscanf(line, "%d vfork() = %d", &pid, &newpid) == 2 ||

+ 456
- 0
misc/tools-source/pseudonative_daemon.c

@ -0,0 +1,456 @@
#include <stdint.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <string.h>
#include <fcntl.h>
#define TCPPORT 28336
#define CMD_EXEC 1
#define CMD_ADDARG 2
#define CMD_ADDENV 3
#define CMD_CHDIR 4
#define CMD_CHROOT 5
#define CMD_EXIT 6
#define CMD_BUILDID 7
#define CMD_WRITE0 1000
#define CMD_CLOSE0 2000
#define CMD_ENABLE0 3000
struct pn_pkg {
uint32_t len;
uint32_t type;
char data[];
};
struct sbuf;
struct sbuf {
struct sbuf *next;
int len, c;
struct pn_pkg *p;
char *d;
};
struct sbuf *recv4p = 0;
struct sbuf *send2p = 0;
int sbuf_c = 0;
void conn_send(int conn, int len, int type, char *data)
{
struct pn_pkg *p = malloc( sizeof(struct pn_pkg) + len );
int i, rc;
p->len = htonl(len);
p->type = htonl(type);
memcpy(p->data, data, len);
len += sizeof(struct pn_pkg);
for (i = 0; i < len; i += rc) {
rc = write(conn, (char*)p + i, len - i);
if ( rc <= 0 ) {
fprintf(stderr, "network write error: %s\n", strerror(errno));
exit(-1);
}
}
free(p);
}
int conn_read(int conn, char *buf, int len, int nonblock)
{
int f = -1;
if ( nonblock ) {
f = fcntl(conn, F_GETFL, 0);
fcntl(conn, F_SETFL, f | O_NONBLOCK);
}
while (len) {
int rc = read(conn, buf, len);
if ( rc < 0 ) {
if ( errno == EAGAIN ) break;
fprintf(stderr, "network read error: %s\n", strerror(errno));
exit(-1);
}
if ( rc == 0 ) {
fprintf(stderr, "connection closed by peer\n");
exit(-1);
}
if ( f != -1 )
fcntl(conn, F_SETFL, f);
len -= rc; buf += rc; f = -1;
}
if ( f != -1 )
fcntl(conn, F_SETFL, f);
return len;
}
struct pn_pkg *conn_recv(int conn, int nonblock)
{
struct pn_pkg *p = malloc( sizeof(struct pn_pkg) );
if ( conn_read(conn, (char*)p, 8, nonblock) ) {
free(p);
return 0;
}
p->len = ntohl(p->len);
p->type = ntohl(p->type);
p = realloc(p, sizeof(struct pn_pkg) + p->len);
conn_read(conn, p->data, p->len, 0);
return p;
}
void do_chroot(char *d, char *b)
{
char buf[1024];
char *e = malloc(strlen(d)+strlen(b)+2);
int i;
sprintf(e, "%s:%s", d, b);
for (i=0; e[i]; i++) if ( e[i] == '/' ) e[i] = '_';
snprintf(buf, 1024, "%s/pseudonative_handler", e);
if ( access(buf, F_OK) ) {
mkdir(e, 0700);
snprintf(buf, 1024, "mount -t nfs -o noac %s/build/%s %s", d, b, e);
system(buf);
snprintf(buf, 1024, "mount -t nfs -o noac %s %s/ROCK/loop", d, e);
system(buf);
snprintf(buf, 1024, "mount -t nfs -o noac %s/config %s/ROCK/config", d, e);
system(buf);
snprintf(buf, 1024, "mount -t nfs -o noac %s/download %s/ROCK/download", d, e);
system(buf);
snprintf(buf, 1024, "mount -t proc none %s/proc", e);
system(buf);
}
chdir(e);
chroot(".");
free(e);
}
void do_session(int conn)
{
char *argv[1024], *bid="", *exe = "/bin/true";
int f0[2], f1[2], f2[2], m, f, argc = 0;
int open_0 = 1, open_1 = 1, open_2 = 1;
int schedule_close_0 = 0, enable_0 = 0;
unsigned char retval;
struct timeval tv;
fd_set rfds, wfds;
struct pn_pkg *p;
clearenv();
signal(SIGCHLD, SIG_DFL);
signal(SIGPIPE, SIG_IGN);
while (1) {
if ( (p = conn_recv(conn, 0)) == 0 ) {
fprintf(stderr, "\nnetwork read error: EOF\n");
exit(-1);
}
switch (p->type) {
case CMD_EXEC:
printf("\nEXE: %s", p->data);
exe = strdup(p->data);
break;
case CMD_ADDARG:
printf(m == p->type ? " %s" : "\nARG: %s", p->data);
argv[argc++] = strdup(p->data);
break;
case CMD_ADDENV:
printf(m == p->type ? "." : "\nENV: .");
putenv(strdup(p->data));
break;
case CMD_CHDIR:
printf("\nCHD: %s", p->data);
chdir(p->data);
break;
case CMD_BUILDID:
bid = strdup(p->data);
break;
case CMD_CHROOT:
printf("\nMNT: %s %s", p->data, bid);
do_chroot(p->data, bid);
break;
}
if ((m=p->type) == CMD_EXEC) {
free(p);
break;
}
free(p);
}
pipe(f0);
pipe(f1);
pipe(f2);
printf("\n");
fflush(stderr);
fflush(stdout);
if (!fork()) {
dup2(f0[0], 0); close(f0[0]); close(f0[1]);
dup2(f1[1], 1); close(f1[0]); close(f1[1]);
dup2(f2[1], 2); close(f2[0]); close(f2[1]);
signal(SIGPIPE, SIG_DFL);
argv[argc] = 0;
execv(exe, argv);
fprintf(stderr, "Can't execute %s: %s\n", exe, strerror(errno));
exit(-1);
}
close(f0[0]);
close(f1[1]);
close(f2[1]);
/* This is usefull for reading strace dumps, etc. */
#if 0
printf("FDS: fd0=%d, fd1=%d, fd2=%d, conn=%d\n",
f0[1], f1[0], f2[0], conn);
#endif
f = fcntl(f0[1], F_GETFL, 0);
fcntl(f0[1], F_SETFL, f | O_NONBLOCK);
f = fcntl(f1[0], F_GETFL, 0);
fcntl(f1[0], F_SETFL, f | O_NONBLOCK);
f = fcntl(f2[0], F_GETFL, 0);
fcntl(f2[0], F_SETFL, f | O_NONBLOCK);
while (open_1 || open_2)
{
char buf[512];
int rc;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
m = f0[1];
if ( conn > m ) m = conn; FD_SET(conn, &rfds);
if ( open_1 ) { if ( f1[0] > m ) m = f1[0]; FD_SET(f1[0], &rfds); }
if ( open_2 ) { if ( f2[0] > m ) m = f2[0]; FD_SET(f2[0], &rfds); }
write(1, "?", 1);
tv.tv_sec = 1;
tv.tv_usec = 0;
if ( schedule_close_0 < 2 && (send2p || !enable_0) ){
FD_SET(f0[1], &wfds);
rc = select(m+1, &rfds, &wfds, 0, &tv);
} else
rc = select(m+1, &rfds, 0, 0, &tv);
if ( rc < 0 && errno != EINTR ) {
fprintf(stderr, "select error: %s\n", strerror(errno));
exit(-1);
}
/* FIXME: This should only be triggered if the proc is actually
* sleeping (read(), poll(), select(), etc) on input */
if ( !enable_0 && FD_ISSET(f0[1], &wfds) ) {
write(1, "E", 1);
conn_send(conn, 0, CMD_ENABLE0, 0);
enable_0 = 1;
}
nextread:
if ( schedule_close_0 == 2 )
goto skip_send2p;
while ( send2p )
{
struct sbuf *t;
while ( send2p->len > 0 ) {
rc = write(f0[1], send2p->d, send2p->len);
if ( rc <= 0 ) {
if ( errno == EAGAIN ) goto skip_send2p;
if ( errno == EPIPE ) {
write(1, "[P]", 3);
conn_send(conn, 0, CMD_CLOSE0, 0);
schedule_close_0 = 2;
goto skip_send2p;
}
fprintf(stderr, "write error (%d): %s\n", f0[1], strerror(errno));
exit(-1);
}
send2p->len -= rc;
send2p->d += rc;
fflush(stdout);
}
write(1, "X", 1);
send2p = (t = send2p)->next;
free(t->p); free(t);
}
if ( !send2p ) {
recv4p = 0;
if ( schedule_close_0 ) {
schedule_close_0 = 2;
write(1, "[X]", 3);
close(f0[1]);
}
}
skip_send2p:;
if ( (p = conn_recv(conn, 1)) ) {
if ( p->type == CMD_WRITE0 && open_0 ) {
struct sbuf *t = malloc(sizeof(struct sbuf));
t->next = 0;
t->p = p;
t->len = p->len;
t->d = p->data;
t->c = sbuf_c++;
if ( recv4p )
recv4p->next = t;
else
send2p = t;
recv4p = t;
write(1, "0", 1);
goto nextread;
}
if ( p->type == CMD_CLOSE0 ) {
write(1, "[0]", 3);
if ( !schedule_close_0 )
schedule_close_0 = 1;
open_0 = 0;
}
if ( p->type == CMD_CLOSE0+1 ) {
write(1, "[P1]", 4);
close(f1[0]);
open_1 = 0;
}
if ( p->type == CMD_CLOSE0+2 ) {
write(1, "[P2]", 4);
close(f2[0]);
open_2 = 0;
}
free(p);
goto nextread;
}
if( open_1 )
{
rc = read(f1[0], buf, 512);
if ( rc > 0 ) {
write(1, "1", 1);
conn_send(conn, rc, CMD_WRITE0+1, buf);
goto nextread;
} else if (rc == 0) {
write(1, "[1]", 3);
conn_send(conn, 0, CMD_CLOSE0+1, 0);
open_1 = 0;
} else if ( errno != EAGAIN ) {
perror("Error on read from f1:");
}
}
if( open_2 )
{
rc = read(f2[0], buf, 512);
if ( rc > 0 ) {
write(1, "2", 1);
conn_send(conn, rc, CMD_WRITE0+2, buf);
goto nextread;
} else if (rc == 0) {
write(1, "[2]", 3);
conn_send(conn, 0, CMD_CLOSE0+2, 0);
open_2 = 0;
} else if ( errno != EAGAIN ) {
perror("Error on read from f2:");
}
}
}
write(1, "\n", 1);
wait(&m);
retval = WEXITSTATUS(m);
conn_send(conn, 1, CMD_EXIT, &retval);
printf("RET: %d\n", retval);
}
int main(int argc, char **argv)
{
struct sockaddr_in addr;
int listenfd, fd;
printf("\n");
printf("**********************************************************************\n");
printf("* *\n");
printf("* ROCK Linux Pseudo-Native Daemon by Clifford Wolf *\n");
printf("* *\n");
printf("* This daemon will create subdirectories in the current working *\n");
printf("* directory and mount NFS shares there. There is no authentication *\n");
printf("* implemented - so everyone who can reach the TCP port can also *\n");
printf("* execute commands. So secure the port using iptables! *\n");
printf("* *\n");
printf("**********************************************************************\n");
printf("\n");
signal(SIGCHLD, SIG_IGN);
if ( (listenfd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ) {
fprintf(stderr, "socket: %s\n", strerror(errno));
return 1;
}
bzero(&addr,sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_ANY);
addr.sin_port = htons(TCPPORT);
if ( bind(listenfd, (struct sockaddr *)&addr, sizeof(addr)) == -1 ) {
fprintf(stderr, "bind: %s\n", strerror(errno));
return 1;
}
if ( listen(listenfd, 5) == -1 ) {
fprintf(stderr, "listen: %s\n", strerror(errno));
return 1;
}
printf("Listening on TCP port %d ...\n", TCPPORT);
while (1) {
if ( (fd=accept(listenfd, NULL, NULL)) == -1 ) {
fprintf(stderr, "accept: %s\n", strerror(errno));
return 1;
}
if ( !fork() ) {
fprintf(stderr, "\nconnection %d opened.", (int)getpid());
do_session(fd);
return 0;
} else close(fd);
}
return 0;
}

+ 423
- 0
misc/tools-source/pseudonative_handler.c

@ -0,0 +1,423 @@
#include <stdio.h>
#include <libgen.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <glob.h>
#include <signal.h>
extern char **environ;
#define LIBDIR "/ROCK/tools.cross/pseudonative.lib"
#define BINDIR_1 "/ROCK/tools.cross/pseudonative.bin"
#define BINDIR_2 "/ROCK/tools.cross/bin"
#define BINDIR_SIZE 100
#define TCPPORT 28336
#define CMD_EXEC 1
#define CMD_ADDARG 2
#define CMD_ADDENV 3
#define CMD_CHDIR 4
#define CMD_CHROOT 5
#define CMD_EXIT 6
#define CMD_BUILDID 7
#define CMD_WRITE0 1000
#define CMD_CLOSE0 2000
#define CMD_ENABLE0 3000
int config_debug = 0;
int config_remote = 0;
struct pn_pkg {
uint32_t len;
uint32_t type;
char data[];
};
int conn_open(const char *peer)
{
struct sockaddr_in sin;
int conn;
sin.sin_family = PF_INET;
sin.sin_port = htons(TCPPORT);
if ( !inet_aton(peer, &sin.sin_addr) ) {
fprintf(stderr, "pseudonative_handler: can't parse address '%s'\n", peer);
exit(-1);
}
conn = socket(PF_INET, SOCK_STREAM, 0);
if (conn < 0) {
fprintf(stderr, "pseudonative_handler: can't create socket: %s\n", strerror(errno));
exit(-1);
}
if (connect(conn, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
fprintf(stderr, "pseudonative_handler: can't connect to remote host: %s\n", strerror(errno));
exit(-1);
}
return conn;
}
void conn_send(int conn, int len, int type, char *data)
{
struct pn_pkg *p = malloc( sizeof(struct pn_pkg) + len );
int i, rc;
p->len = htonl(len);
p->type = htonl(type);
memcpy(p->data, data, len);
len += sizeof(struct pn_pkg);
for (i = 0; i < len; i += rc) {
rc = write(conn, (char*)p + i, len - i);
if ( rc <= 0 ) {
if ( errno == ECONNRESET && type == CMD_CLOSE0 ) break;
fprintf(stderr, "pseudonative_handler: network write error: %s\n", strerror(errno));
exit(-1);
}
}
free(p);
}
int conn_read(int conn, char *buf, int len, int nonblock)
{
int f = -1;
if ( nonblock ) {
f = fcntl(conn, F_GETFL, 0);
fcntl(conn, F_SETFL, f | O_NONBLOCK);
}
while (len) {
int rc = read(conn, buf, len);
if ( rc < 0 ) {
if ( errno == EAGAIN ) break;
fprintf(stderr, "pseudonative_handler: network read error: %s\n", strerror(errno));
exit(-1);
}
if ( rc == 0 ) {
fprintf(stderr, "pseudonative_handler: connection closed by peer\n");
exit(-1);
}
if ( f != -1 )
fcntl(conn, F_SETFL, f);
len -= rc; buf += rc; f = -1;
}
if ( f != -1 )
fcntl(conn, F_SETFL, f);
return len;
}
struct pn_pkg *conn_recv(int conn)
{
struct pn_pkg *p = malloc( sizeof(struct pn_pkg) );
if ( conn_read(conn, (char*)p, 8, 1) ) {
free(p);
return 0;
}
p->len = ntohl(p->len);
p->type = ntohl(p->type);
p = realloc(p, sizeof(struct pn_pkg) + p->len);
conn_read(conn, p->data, p->len, 0);
return p;
}
int exec_remote(char ** argv)
{
char buf[1024], *txt;
int ret = -1, open_0 = 1;
int enable_0 = 0;
int f, i, conn, rc;
struct timeval tv;
struct pn_pkg *p;
fd_set rfds;
/* connect */
txt = getenv("ROCKCFG_PSEUDONATIVE_NATIVEHOST");
if ( txt && *txt ) {
conn = conn_open(txt);
} else {
fprintf(stderr, "pseudonative_handler: no native host configured\n");
exit(-1);
}
/* send build id */
txt = getenv("ROCKCFG_ID");
if ( txt && *txt )
conn_send(conn, strlen(txt)+1, CMD_BUILDID, txt);
/* mount and chroot */
txt = getenv("ROCKCFG_PSEUDONATIVE_NFSROOT");
if ( txt && *txt )
conn_send(conn, strlen(txt)+1, CMD_CHROOT, txt);
/* current directory */
if ( getcwd(buf, 1024) )
conn_send(conn, strlen(buf)+1, CMD_CHDIR, buf);
/* send environment */
for (i=0; environ[i]; i++)
conn_send(conn, strlen(environ[i])+1, CMD_ADDENV, environ[i]);
/* send arguments */
for (i=0; argv[i]; i++)
conn_send(conn, strlen(argv[i])+1, CMD_ADDARG, argv[i]);
/* execute command */
conn_send(conn, strlen(argv[0])+1, CMD_EXEC, argv[0]);
/* we pass sigpipe's to peer */
signal(SIGPIPE, SIG_IGN);
while (1)
{
FD_ZERO(&rfds);
if ( open_0 && enable_0 ) FD_SET(0, &rfds);
FD_SET(conn, &rfds);
nextselect:
tv.tv_sec = 1;
tv.tv_usec = 0;
rc = select(conn+1, &rfds, 0, 0, &tv);
if ( rc < 0 ) {
if ( errno == EINTR ) goto nextselect;
fprintf(stderr, "pseudonative_handler: select error: %s\n", strerror(errno));
exit(-1);
}
nextread:
if ( (p = conn_recv(conn)) != 0 ) {
char *d = p->data;
switch (p->type) {
case CMD_WRITE0+1:
while ( p->len ) {
rc = write(1, d, p->len);
if ( rc <= 0 ) {
if ( errno == EPIPE ) {
conn_send(conn, 0, CMD_CLOSE0+1, 0);
break;
}
fprintf(stderr, "pseudonative_handler: write error on fd1: %s\n", strerror(errno));
exit(-1);
}
d += rc; p->len -= rc;
}
break;
case CMD_WRITE0+2:
while ( p->len ) {
rc = write(2, d, p->len);
if ( rc <= 0 ) {
if ( errno == EPIPE ) {
conn_send(conn, 0, CMD_CLOSE0+2, 0);
break;
}
fprintf(stderr, "pseudonative_handler: write error on fd2: %s\n", strerror(errno));
exit(-1);
}
d += rc; p->len -= rc;
}
break;
case CMD_CLOSE0:
close(0);
open_0 = 0;
break;
case CMD_CLOSE0+1:
close(1);
break;
case CMD_CLOSE0+2:
close(2);
break;
case CMD_ENABLE0:
enable_0 = 1;
break;
case CMD_EXIT:
ret = (unsigned char)p->data[0];
free(p);
goto finish;
}
free(p);
goto nextread;
}
if( open_0 && enable_0 )
{
f = fcntl(0, F_GETFL, 0);
fcntl(0, F_SETFL, f | O_NONBLOCK);
rc = read(0, buf, 512);
fcntl(0, F_SETFL, f);
if ( rc > 0 ) {
conn_send(conn, rc, CMD_WRITE0, buf);
goto nextread;
} else if (rc == 0) {
conn_send(conn, 0, CMD_CLOSE0, 0);
open_0 = 0;
} else if ( errno != EAGAIN ) {
perror("Error on read from f2:");
}
}
}
finish:
close(conn);
if (ret == -1)
fprintf(stderr, "pseudonative_handler: sometimes everything goes wrong\n");
return ret;
}
void set_ld_lib_path()
{
FILE *f = fopen("/etc/ld.so.conf", "r");
char ld_lib_path[1024] = "/lib";
int written = 4, len, i;
char line[1024], *l;
glob_t globbuf;
l = getenv("LD_LIBRARY_PATH_PSEUDONATIVE_BACKUP");
if (l) {
l = strdup(l);
l = strtok(l, ":");
while ( l ) {
if ( strcmp(l, LIBDIR) && written < 1024)
written += snprintf(ld_lib_path+written, 1024-written, ":%s", l);
l = strtok(0, ":");
}
unsetenv("LD_LIBRARY_PATH_PSEUDONATIVE_BACKUP");
}
if (f) {
while ( (l=fgets(line, 1024, f)) ) {
while ( *l == ' ' || *l == '\t' || *l == '\n' ) l++;
if ( *l == '#' || !*l ) continue;
len = strcspn(l, "\t\n ");
if (len) {
l[len] = 0;
glob(l, GLOB_ONLYDIR, 0, &globbuf);
for (i=0; i<globbuf.gl_pathc && written < 1024; i++)
written += snprintf(ld_lib_path+written, 1024-written, ":%s", globbuf.gl_pathv[i]);
globfree (&globbuf);
}
}
fclose(f);
}
if (config_debug)
fprintf(stderr, "pseudonative_handler: setting LD_LIBRARY_PATH: %s\n", ld_lib_path);
setenv("LD_LIBRARY_PATH", ld_lib_path, 1);
}
void write_log(char *type, char **argv)
{
int written = 0;
char line[120] = "";
FILE *f;
if ( (f = fopen("/var/adm/rock-debug/pseudonative.log", "a")) ) {
written += snprintf(line+written, 1024-written, "%s: %s=%s",
type, getenv("ROCK_PKG"), getenv("ROCK_XPKG"));
while (*argv && written < 120)
written += snprintf(line+written, 120-written, " %s", *(argv++));
strcpy(line+100, " ..");
fprintf(f, "%s\n", line);
fclose(f);
}
}
int main(int argc, char **argv)
{
char *cmd, *mycmd, *t;
while ( *argv[1] == '-' && argc > 1 ) {
if ( !strcmp(argv[1], "-d") ) config_debug = 1;
else if ( !strcmp(argv[1], "-r") ) config_remote = 1;
else {
fprintf(stderr, "pseudonative_handler: unknown option %s.\n", argv[1]);
return -1;
}
argv++; argc--;
}
if (argc < 2) {
fprintf(stderr, "pseudonative_handler: arguments missing.\n");
return -1;
}
cmd = basename(argv[1]);
mycmd = malloc(BINDIR_SIZE+strlen(cmd)+10);
t = getenv("LD_LIBRARY_PATH");
if ( t && strcmp(t, LIBDIR) )
setenv("LD_LIBRARY_PATH_PSEUDONATIVE_BACKUP", t, 1);
setenv("LD_LIBRARY_PATH", LIBDIR, 1);
/* The target ld.so.cache would confuse bins for the build host. So
* we unlink it here and generate a LD_LIBRARY_PATH from ld.so.conf
* for bins executed on the remote machine. */
unlink("/etc/ld.so.cache");
sprintf(mycmd, "%s/%s", BINDIR_1, cmd);
if ( !access(mycmd, X_OK) && !config_remote ) {
if (config_debug)
fprintf(stderr, "pseudonative_handler: local: %s\n", mycmd);
argv[1] = mycmd;
write_log("local", argv+1);
execv(mycmd, argv+1);
goto goterror;
}
sprintf(mycmd, "%s/%s", BINDIR_2, cmd);
if ( !access(mycmd, X_OK) && !config_remote ) {
if (config_debug)
fprintf(stderr, "pseudonative_handler: local: %s\n", mycmd);
argv[1] = mycmd;
write_log("local", argv+1);
execv(mycmd, argv+1);
goto goterror;
}
/* FIXME: CMD_ENABLE0 doesn't work correctly yet (see pseudonative_daemon.c).
* So we close fd0 explicitely for some programs here. */
#if 0
if ( !strcmp(cmd, "tput") ) { close(0); open("/dev/null", O_RDONLY); }
#endif
set_ld_lib_path();
if (config_debug)
fprintf(stderr, "pseudonative_handler: remote: %s\n", argv[1]);
write_log("remote", argv+1);
return exec_remote(argv+1);
goterror:
fprintf(stderr, "pseudonative_handler: error calling '%s': %s\n", mycmd, strerror(errno));
return -1;
}

+ 1
- 0
package/base/00-dirtree/data.txt

@ -119,6 +119,7 @@ l usr/opt ../opt
l usr/spool ../var/spool
l usr/spool/locks ../../var/lock
l usr/tmp ../var/tmp
l usr/var ../var
l var/spool/mail ../mail
l var/state/pkgtool ../adm

+ 2
- 2
package/base/bash/bash.conf

@ -24,7 +24,7 @@ pkg_bash_postmake() {
echo "Creating 'usr/bin/which' and 'bin/sh' ..."
echo -e '#!/bin/bash\ntype -p "$@"' > $root/usr/bin/which
chmod +x $root/usr/bin/which
[ -f $root/usr/bin/bash ] && \
[ -f $root/usr/bin/bash -a $stagelevel != 0 ] && \
mv -v $root/usr/bin/bash $root/bin/bash
ln -sfv bash $root/bin/sh
@ -37,7 +37,7 @@ pkg_bash_postmake() {
premake="cat /dev/null > lib/malloc/malloc.c"
confopt="$confopt --without-gnu-malloc"
[ $stagelevel -le 1 ] && confopt="$confopt --disable-readline"
[ $stagelevel -eq 1 ] && confopt="$confopt --disable-readline"
[ "$ROCKCFG_PKG_BASH_PROGCOMP" = 0 ] && confopt="$confopt --disable-progcomp"
[ "$ROCKCFG_PKG_BASH_HELP_CMD" = 0 ] && confopt="$confopt --disable-help-builtin"

+ 1
- 1
package/base/bash/bash.desc

@ -46,7 +46,7 @@
[L] GPL
[S] Stable
[V] 2.05b
[P] X -1-3-----9 106.500
[P] X X1-3-----9 106.500
[D] 3731831200 bash-2.05b.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/
[D] 4042888190 bash-doc-2.05b.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/

+ 1
- 1
package/base/bison/bison.desc

@ -46,7 +46,7 @@
[L] GPL
[S] Stable
[V] 1.875
[P] X -1-3-----9 109.400
[P] X X1-3-----9 109.400
[D] 610787436 bison-1.875.tar.bz2 ftp://ftp.gnu.org/pub/gnu/bison/

+ 1
- 1
package/base/bzip2/bzip2.desc

@ -40,7 +40,7 @@
[L] GPL
[S] Stable
[V] 1.0.2
[P] X -1---5---9 108.600
[P] X X1---5---9 108.600
[CV-URL] ftp://sources.redhat.com/pub/bzip2/
[CV-PAT] ^v[0-9]

+ 4
- 1
package/base/coreutils/coreutils.conf

@ -50,5 +50,8 @@ if [ $stagelevel -ge 3 -a -f $root/var/adm/flists/acl ]; then
fi
premake="coreutils_premake"
postmake="coreutils_postmake"
if [ $stagelevel -gt 0 ]; then
postmake="coreutils_postmake"
fi

+ 1
- 1
package/base/coreutils/coreutils.desc

@ -41,7 +41,7 @@
[L] GPL
[S] Stable
[V] 5.0
[P] X -1-3-5---9 107.100
[P] X X1-3-5---9 107.100
[D] 2154791780 coreutils-5.0.tar.bz2 ftp://ftp.gnu.org/pub/gnu/coreutils/

+ 1
- 1
package/base/diffutils/diffutils.desc

@ -54,7 +54,7 @@
[L] GPL
[S] Stable
[V] 2.8.1
[P] X -1---5---9 107.500
[P] X X1---5---9 107.500
[D] 4010806712 diffutils-2.8.1.tar.gz ftp://ftp.gnu.org/pub/gnu/diffutils/

+ 5
- 5
package/base/findutils/findutils.conf

@ -24,13 +24,13 @@ fu_pm() {
# INSTALL_WRAPPER_FILTER needs to be empty to not filter the symlink
INSTALL_WRAPPER_FILTER="" ln -sfv ../../bin/find $root/usr/bin/find
INSTALL_WRAPPER_FILTER="" ln -sfv ../../bin/xargs $root/usr/bin/xargs
rmdir $root/usr/var || true
}
var_append INSTALL_WRAPPER_FILTER "|" \
"sed -e 's,usr/bin/find,bin/find,' -e 's,usr/bin/xargs,bin/xargs,'"
hook_add postmake 3 "fu_pm"
if [ $stagelevel -gt 0 ]; then
var_append INSTALL_WRAPPER_FILTER "|" \
"sed -e 's,usr/bin/find,bin/find,' -e 's,usr/bin/xargs,bin/xargs,'"
hook_add postmake 3 "fu_pm"
fi
export CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
export CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"

+ 1
- 1
package/base/findutils/findutils.desc

@ -37,7 +37,7 @@
[L] GPL
[S] Stable
[V] 4.1.20
[P] X -1---5---9 107.200
[P] X X1---5---9 107.200
[D] 1934889974 findutils-4.1.20.tar.gz ftp://alpha.gnu.org/gnu/findutils/

+ 1
- 1
package/base/flex/flex.desc

@ -36,7 +36,7 @@
[L] GPL
[S] Stable
[V] 2.5.31
[P] X -1---5---9 108.500
[P] X X1---5---9 108.500
[D] 2154487592 flex-2.5.31.tar.bz2 http://download.sourceforge.net/lex/

+ 5
- 5
package/base/gawk/gawk.conf

@ -20,10 +20,10 @@
#
# --- ROCK-COPYRIGHT-NOTE-END ---
var_append INSTALL_WRAPPER_FILTER "|" \
'sed -e "s,usr/bin/gawk$,bin/gawk,"'
# INSTALL_WRAPPER_FILTER needs to be empty to not filter the symlink ...
hook_add postmake 3 "INSTALL_WRAPPER_FILTER="" ; ln -sfv ../../bin/gawk \
$root/usr/bin/gawk ; ln -sfv gawk $root/bin/awk"
if [ $stagelevel -gt 0 ]; then
var_append INSTALL_WRAPPER_FILTER "|" 'sed -e "s,usr/bin/gawk$,bin/gawk,"'
hook_add postmake 3 "INSTALL_WRAPPER_FILTER="" ; ln -sfv ../../bin/gawk $root/usr/bin/gawk"
fi
hook_add postmake 3 "INSTALL_WRAPPER_FILTER="" ; ln -sfv gawk $root/bin/awk"

+ 1
- 1
package/base/gawk/gawk.desc

@ -36,7 +36,7 @@
[L] GPL
[S] Stable
[V] 3.1.3
[P] X -1---5---9 108.400
[P] X X1---5---9 108.400
[D] 4076627112 gawk-3.1.3.tar.gz ftp://ftp.gnu.org/pub/gnu/gawk/

+ 62
- 21
package/base/gcc/gcc.conf

@ -58,6 +58,34 @@ create_links() {
done
}
genrockspecs() {
# Hint for the reader:
# The options are listed in _inverse_ order here.
x="$base/build/$ROCKCFG_ID"
tr '\n' '@' < specs | sed \
-e "s|@\\*link:@|@*link:@-L $x/usr/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/local/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/ROCK/tools.cross/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-rpath-link $x/lib:$x/usr/lib |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
| tr '@' '\n' > specs.cross
tr '\n' '@' < specs | sed \
-e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /ROCK/tools.cross/$arch_target/lib |" \
-e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/$arch_target/lib |" \
-e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/local/lib |" \
-e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /usr/lib |" \
-e "s|@\\*link_libgcc:@|@*link_libgcc:@-L /lib |" \
-e "s|@\\*link:@|@*link:@-rpath-link /lib:/usr/lib |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
| tr '@' '\n' > specs.chroot
}
custmain() {
# Apply the respective gcc-2 or gcc-3 stack protector patch.
. $base/package/base/gcc/apply-protector.sh $base gcc${pkg_gcc_version} "$desc_D"
@ -347,6 +375,20 @@ custmain() {
( cd $root/$prefix/lib ; ln -vfs ${gcc_lib_dir}/*.so.* . ; )
rm -fv $base/build/$ROCKCFG_ID/ROCK/$toolsdir/.lastupdate
fi
if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
echo "Adapting gcc specs file..."
cd $root/$prefix/lib/${gcc_lib_dir}
genrockspecs
# echo "Linking gcc libs to tools.cross..."
# cd $root/ROCK/tools.cross/lib/${gcc_lib_dir}/
# ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.a .
# ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.la .
# ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so .
# ln -sf ../../../../../../$prefix/lib/${gcc_lib_dir}/*.so.* .
fi
true
}
@ -369,8 +411,13 @@ gcc_cross() {
mkdir -p $root/$prefix/crosscc
fi
[ "$pkg_gcc_version" != "2" ] && \
confopt="$confopt --enable-languages=c"
if [ "$pkg_gcc_version" != "2" ]; then
if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
confopt="$confopt --enable-languages=c,c++"
else
confopt="$confopt --enable-languages=c"
fi
fi
mkdir objdir ; cd objdir ; hook_eval preconf
eval ../configure --program-prefix=${pkg_gcc_target}- --disable-cpp \
@ -406,6 +453,7 @@ gcc_cross() {
if [ "$stagelevel" -eq 0 ]; then
x="$root/$prefix/crosscc/${arch_target}"
ln -svf ${arch_target}-gcc $x-gcc-${pkg_gcc_version}
ln -svf ${arch_target}-g++ $x-g++-${pkg_gcc_version}
ln -svf ${arch_target}-gcc $x-kcc-${pkg_gcc_version}
ln -svf ${arch_target}-gcc $x-kcc
ln -svf ${arch_target}-gcc $x-cc
@ -415,32 +463,25 @@ gcc_cross() {
cd $root/$prefix/$arch_target/lib
for x in Mcrt1.o crt1.o crti.o crtn.o gcrt1.o \
libc.a libc.so libc_nonshared.a
do ln -fvs $root/../../usr/lib/$x $x ; done
do
if [ ! -e $x ]; then
ln -fvs $root/../../usr/lib/$x $x
fi
done
for x in ld-linux{,-$arch_machine}.so.2 ld.so.1 libc.so.{6,6.1}
do ln -fvs $root/../../lib/$x $x ; done
rm -f $root/$prefix/.lastupdate
fi
if [ "$stagelevel" -eq 0 -o "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
echo "Adapting gcc specs file..."
cd $root/$prefix/lib/${gcc_lib_dir}
mv specs specs.orig
# Hint for the reader:
# The options are listed in _inverse_ order here.
x="$base/build/$ROCKCFG_ID"
tr '\n' '@' < specs.orig | sed \
-e "s|@\\*link:@|@*link:@-L $x/../tools.cross/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/$arch_target/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/local/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/usr/lib |" \
-e "s|@\\*link:@|@*link:@-L $x/lib |" \
-e "s|@\\*link:@|@*link:@-rpath-link $x/lib |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/$arch_target/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/local/include |" \
-e "s|@\\*cpp:@|@*cpp:@-I $x/usr/include |" \
| tr '@' '\n' > specs
rm -f $root/$prefix/.lastupdate
genrockspecs
fi
true
}
if [ "$stagelevel" -eq 0 -o -n "$pkg_gcc_cross" ]

+ 18
- 0
package/base/gcc/parse-config

@ -20,6 +20,10 @@
#
# --- ROCK-COPYRIGHT-NOTE-END ---
if [ $stagelevel -gt 0 ]
then
# ---- NOT IN STAGE 0 ---
# Use the GCC-[23] stack protector patch
#
if [ $pkg != glibc23 -a $pkg != glibc22 -a \
@ -123,3 +127,17 @@ if [ -f architecture/$arch/gcc-options ] ; then
. architecture/$arch/gcc-options
fi
# Use our cross specs file for stage 1
#
if [ $stagelevel -eq 1 ]; then
var_insert GCC_WRAPPER_INSERT " " "--specs=specs.cross"
fi
# Use our chroot specs file for pseudonative
#
if [ $stagelevel -gt 1 -a "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
var_insert GCC_WRAPPER_INSERT " " "--specs=specs.chroot"
fi
# ---- NOT IN STAGE 0 ---
fi

+ 5
- 1
package/base/gcc/wrappers.in

@ -43,10 +43,14 @@ gcc_build_wrapper() {
gcc_build_wrapper CC ${arch_target}-cc ${arch_target}-gcc{-2,-32,-33,-34,}
gcc_build_wrapper KCC ${arch_target}-kcc{-2,-32,-33,-34,}
if [ $stagelevel -gt 1 -o "$ROCKCFG_USE_CROSSCC" = 0 ] ; then
if [ $stagelevel -gt 1 -o "$ROCKCFG_USE_CROSSCC" = 0 ]; then
gcc_build_wrapper CC cc gcc{-2,-32,-33,-34,}
gcc_build_wrapper CXX {c,g}++{-2,-32,-33,-34,}
gcc_build_wrapper F77 {g,f}77{-2,-32,-33,-34,}
gcc_build_wrapper KCC kcc{-2,-32,-33,-34,}
fi
if [ $stagelevel -le 1 ]; then
build_wrapper BUILDCC cc gcc
fi

+ 5
- 4
package/base/glibc/glibc.conf

@ -186,10 +186,11 @@ glibc_custmain() {
# No wrong absolute path in *.so linker scripts
#
if [ $stagelevel -le 1 ]
then
sed -i 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so
sed -i 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so
if [ -d $root/ROCK/tools.cross ]; then
rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so
rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
fi
# Install ld.so.conf

+ 1
- 1
package/base/grep/grep.desc

@ -40,7 +40,7 @@
[L] GPL
[S] Stable
[V] 2.5.1
[P] X -1---5---9 107.900
[P] X X1---5---9 107.900
[D] 3632094843 grep-2.5.1.tar.bz2 ftp://ftp.gnu.org/pub/gnu/grep/

+ 3
- 1
package/base/gzip/gzip.conf

@ -31,5 +31,7 @@ pm_move_to_bin() {
sed -i 's,"/usr/bin"/gzip,"/bin"/gzip,g' $root/usr/bin/gzexe
}
hook_add postmake 5 "pm_move_to_bin"
if [ $stagelevel -gt 0 ]; then
hook_add postmake 5 "pm_move_to_bin"
fi

+ 1
- 1
package/base/gzip/gzip.desc

@ -41,7 +41,7 @@
[L] GPL
[S] Stable
[V] 1.2.4a
[P] X -1---5---9 102.040
[P] X X1---5---9 102.040
[D] 2285515917 gzip-1.2.4a.tar.gz ftp://ftp.gnu.org/pub/gnu/gzip/

+ 1
- 1
package/base/make/make.desc

@ -38,7 +38,7 @@
[L] GPL
[S] Stable
[V] 3.80
[P] X -1---5---9 107.700
[P] X X1---5---9 107.700
[D] 2828886308 make-3.80.tar.gz ftp://ftp.gnu.org/pub/gnu/make/

+ 1
- 1
package/base/mktemp/mktemp.desc

@ -35,7 +35,7 @@
[L] BSD
[S] Stable
[V] 1.5
[P] X -1-3-5---9 107.400
[P] X X1-3-5---9 107.400
[D] 143280685 mktemp-1.5.tar.gz ftp://ftp.mktemp.org/pub/mktemp/

+ 28
- 31
package/base/ncompress/config.patch

@ -1,33 +1,30 @@
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/ncompress/config.patch
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
ncompress uses a really nice build script with a few evil bugs ...
- Clifford
--- ./build Wed Oct 28 12:10:53 1992
+++ ./build.new Mon Aug 31 21:25:22 1998
@@ -278,8 +278,6 @@
--- ./build.orig 1992-10-28 12:10:53.000000000 +0100
+++ ./build 2004-08-06 22:38:17.586220888 +0200
@@ -1,4 +1,3 @@
-:
#!/bin/sh
#
version="4.2.4"
@@ -19,6 +18,7 @@
trap 'set +x ; exit 1' 1 2 15
[ -f compress.def ] && . ./compress.def
+x=1
while true
do
@@ -70,7 +70,9 @@
done
) >compress.def
- read choice var1 var2 var3 var4 varr
+ read choice var1 var2 var3 var4 varr < /dev/null
+ if [ $x = 1 ]; then choice=genmake; x=2
+ else choice=q; fi
echo ""
else
choice=D
@@ -278,8 +280,6 @@
[ -f /usr/include/sys/dir.h ] && { SYSDIR=yes; }
[ -f /usr/include/dirent.h ] && { DIRENT=yes; }
[ -f /usr/include/utime.h ] && { UTIME_H=yes; }
@ -36,7 +33,7 @@ ncompress uses a really nice build script with a few evil bugs ...
[ -f /usr/bin/compress ] && { BINDIR=/usr/bin; }
if [ ".${CC}" = . ]
@@ -790,7 +788,7 @@
@@ -790,7 +790,7 @@
compress: Makefile compress42.c patchlevel.h

+ 1
- 1
package/base/ncompress/ncompress.conf

@ -21,7 +21,7 @@
# --- ROCK-COPYRIGHT-NOTE-END ---
nc_main() {
echo -en 'genmake\nq\n' | ./build
./build
eval $MAKE compress
rm -f /usr/bin/compress /usr/bin/uncompress
cp compress /usr/bin/compress

+ 6
- 1
package/base/netkit-rsh/netkit-rsh.conf

@ -21,4 +21,9 @@
# --- ROCK-COPYRIGHT-NOTE-END ---
prepatch="rm -rf */*,v */RCS"
confopt="--prefix=/usr"
confopt="--prefix=$root/$prefix"
if [ $stagelevel -eq 0 ]; then
confopt="$confopt --without-pam"
fi

+ 3
- 3
package/base/nvi/nvi.conf

@ -25,15 +25,15 @@ patch_all_c() {
for x in `find -name '[Mm]akefile' -type f`
do
echo -n " $x"
sed -i 's|/usr/local|/usr|' $x
sed -i "s|/usr/local|$root/usr|" $x
done
echo "done."
}
premake="patch_all_c && eval $MAKE realclean"
makeinstopt="CATMANDIR='/var/catman/cat1' install"
makeinstopt="CATMANDIR='$root/var/catman/cat1' install"
if [ "$ROCKCFG_PKG_VIM_IS_VI_REPLACEMENT" != 1 ] ; then
postmake="ln -sf nvi /usr/bin/vi"
postmake="ln -sf nvi $root/usr/bin/vi"
fi

+ 4
- 1
package/base/openssh/openssh.conf

@ -41,5 +41,8 @@ if [ -f $root/var/adm/flists/tcp_wrappers ]; then
fi
makeinstopt="install-nokeys"
postmake="pm_openssh"
if [ $stagelevel -gt 0 ]; then
postmake="pm_openssh"
fi

+ 1
- 1
package/base/patch/patch.desc

@ -36,7 +36,7 @@
[L] GPL
[S] Stable
[V] 2.5.4
[P] X -1---5---9 107.600
[P] X X1---5---9 107.600
[D] 3374538926 patch-2.5.4.tar.gz ftp://ftp.gnu.org/pub/gnu/patch/

+ 4
- 1
package/base/sed/sed.conf

@ -22,5 +22,8 @@
# workaround for sed configure getline disabling in stage 1
preconf="echo am_cv_func_working_getline=yes >> config.cache"
postmake="mv -v $root/usr/bin/sed $root/bin/sed"
if [ $stagelevel -gt 0 ]; then
postmake="mv -v $root/usr/bin/sed $root/bin/sed"
fi

+ 1
- 1
package/base/sed/sed.desc

@ -41,7 +41,7 @@
[L] GPL
[S] Stable
[V] 4.1
[P] X -1---5---9 108.000
[P] X X1---5---9 108.000
[D] 2387309981 sed-4.1.tar.gz ftp://ftp.gnu.org/pub/gnu/sed/

+ 1
- 1
package/base/strace/strace.desc

@ -40,7 +40,7 @@
[L] OpenSource
[S] Stable
[V] 4.5.6
[P] X -?-3-----9 104.200
[P] X X1-3-----9 104.200
[D] 1560610483 strace-4.5.6.tar.bz2 http://dl.sourceforge.net/sourceforge/strace/

+ 1
- 0
package/base/sysfiles/parse-config

@ -27,6 +27,7 @@ fi
if [ -f $confdir/postsysfiles.in -a $stagelevel -gt 1 ] ; then
var_append flistdel "|" "etc/passwd"
var_append flistdel "|" "etc/group"
var_append flistdel "|" "etc/shadow"
var_append flistdel "|" "etc/gshadow"
hook_add preconf 2 ". $confdir/postsysfiles.in"

+ 5
- 2
package/base/tar/tar.conf

@ -21,6 +21,9 @@
# --- ROCK-COPYRIGHT-NOTE-END ---
var_append confopt ' ' '-C'
postmake="mv -v $root/usr/bin/tar $root/bin/tar ; \
install -m 0644 -o root -g root ${builddir}/$pkg-$ver/tar.1 $root/usr/man/man1/"
if [ $stagelevel -gt 0 ]; then
postmake="mv -v $root/usr/bin/tar $root/bin/tar ; \
install -m 0644 -o root -g root ${builddir}/$pkg-$ver/tar.1 $root/usr/man/man1/"
fi

+ 1
- 1
package/base/tar/tar.desc

@ -38,7 +38,7 @@
[L] GPL
[S] Stable
[V] 1.14
[P] X -1---5---9 108.300
[P] X X1---5---9 108.300
[D] 328428970 tar-1.14.tar.bz2 ftp://ftp.gnu.org/gnu/tar/

+ 1
- 1
package/base/time/time.desc

@ -37,7 +37,7 @@
[L] GPL
[S] Stable
[V] 1.7
[P] X -1---5---9 105.700
[P] X X1---5---9 105.700
[D] 3952622611 time-1.7.tar.gz ftp://ftp.gnu.org/pub/gnu/time/

+ 47
- 3
package/x11/xfree86/xfree86.conf

@ -37,7 +37,51 @@ x11base_main() {
xf_install
}
custmain=x11base_main
autoextract=0
createdocs=0
x11base_stage0() {
touch config/cf/host.def
touch config/cf/version.def
touch config/cf/date.def
cd config/imake
mv imakemdep.h imakemdep.h.bak
cat <<EOT > imakemdep.h
#define ARGUMENTS 50
char *cpp_argv[50] = {
"cc",
"-I.",
"-Uunix",
"-D__${arch_machine}__",
"-m$(( arch_sizeof_long * 8 ))",
"-traditional",
"-D${arch_machine}",
"-Dlinux",
};
EOT
make -f Makefile.ini
cp -v imake $root/bin/
mv imakemdep.h.bak imakemdep.h
make -f Makefile.ini clean
make -f Makefile.ini
cd ../util
../imake/imake -I../cf -DTOPDIR=../.. -DCURDIR=config/util
make
cd ../makedepend
../imake/imake -I../cf -DTOPDIR=../.. -DCURDIR=config/makedepend
make
cd ../..
cp -v config/util/rman $root/bin/
cp -v config/makedepend/makedepend $root/bin/
}
if [ $stagelevel -gt 0 ]; then
custmain=x11base_main
autoextract=0
createdocs=0
else
custmain=x11base_stage0
fi

+ 1
- 1
package/x11/xfree86/xfree86.desc

@ -39,7 +39,7 @@
[L] OpenSource
[S] Stable
[V] 4.4.99.1
[P] X -?---5---9 112.600
[P] X X?---5---9 112.600
[O] mga_version=3.0
[O] xf_files="XFree86-4.4.99.1.tar.bz2"

+ 80
- 6
scripts/Build-Pkg

@ -169,6 +169,9 @@ builddir="$base/src.$xpkg.$id"
# get real pkg name for mapped packages
. build/$ROCKCFG_ID/ROCK/$toolsdir/lib/pkgmapper
export ROCK_PKG=$pkg
export ROCK_XPKG=$xpkg
if [ "$chroot" = 1 ] ; then
cd "$xroot" || exit 1
@ -194,6 +197,62 @@ if [ "$chroot" = 1 ] ; then
ln -s /proc/self/fd dev/fd
fi
if [ "$ROCKCFG_PSEUDONATIVE" = 1 -a ! -f pseudonative_handler ]
then
echo_header "Preparing chroot dir for pseudonative build:"
echo_status "Building pseudonative_handler."
cc -static -o pseudonative_handler \
$base/misc/tools-source/pseudonative_handler.c
if [ ! -f /proc/sys/fs/binfmt_misc/register ] ; then
echo_status "Mounting /proc/sys/fs/binfmt_misc."
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
fi
echo_status "Registering pseudonative_handler."
sign="$( hexdump bin/bash | head -n2 | cut -f2- -d' ' | tr -d ' \n' | \
cut -c 1-40 | sed -e 's,\(..\)\(..\),\\x\2\\x\1,g' )"
echo ":${arch_machine}_rock_bin:M::$sign::/pseudonative_handler:" > /proc/sys/fs/binfmt_misc/register
sign="$( hexdump lib/libc.so.[0-9] | head -n2 | cut -f2- -d' ' | tr -d ' \n' | \
cut -c 1-40 | sed -e 's,\(..\)\(..\),\\x\2\\x\1,g' )"
echo ":${arch_machine}_rock_lib:M::$sign::/pseudonative_handler:" > /proc/sys/fs/binfmt_misc/register
echo_status "Creating pseudonative bindir."
rm -rf ROCK/tools.cross/pseudonative.bin
mkdir -p ROCK/tools.cross/pseudonative.bin
cd ROCK/tools.cross
while read f
do
b=$(basename $f)
a=${b#$arch_target-}
ln -sf ../$f pseudonative.bin/$b
if [ "$a" != "$b" ]; then
ln -sf ../$f pseudonative.bin/$a
fi
done < <(
find crosscc lib libexec $arch_target wrapper -xtype f -perm +111 | \
xargs file -L | grep ELF.*executable | cut -f1 -d:
)
echo_status "Applying some bin hotfixes."
ln -s ../bin/true pseudonative.bin/umount
ln -s ../bin/true pseudonative.bin/mount
rm -f bin/uname pseudonative.bin/uname
echo_status "Creating pseudonative libdir."
rm -rf pseudonative.lib; mkdir -p pseudonative.lib
cp /lib/ld-linux.so.* /lib/libc.so.* pseudonative.lib/
cp /lib/libnss_compat.so.* pseudonative.lib/
cp /lib/libnss_files.so.* pseudonative.lib/
cd ../..
echo_status "Creating fake rootdir-symlink."
mkdir -p $( dirname ${xroot#/} )
rm -f ${xroot#/}; ln -s / ${xroot#/}
fi
realconf=$(cd $base/config; pwd -P)
realdown=$(cd $base/download; pwd -P)
realbase=$(dirname $(cd $base/scripts; pwd -P))
@ -316,6 +375,7 @@ mkdir -p $root/var/adm/dep-debug
mkdir -p $root/var/adm/parse-config
mkdir -p $root/var/adm/cache
mkdir -p $root/var/adm/descs
mkdir -p $root/var/adm/rock-debug
[ "$root" ] && chmod 700 $root
rm -f $root/var/adm/logs/$stagelevel-$xpkg.out
@ -402,6 +462,10 @@ flistroot="bin boot etc lib sbin usr var opt"
flistrfilter="ldconfig\..*: .*|.*: /var/adm/.*|.*/pkgconfig/.*\.pc"
flistdel="etc/ld.so.cache|var/tmp/.*|usr/tmp/.*|var/adm/logs/.*|.*\\.old"
if [ "$pkg" != rock-debug ]; then
flistdel="$flistdel|var/adm/rock-debug/.*"
fi
if [ $stagelevel -le 1 ]
then
makeopt='CC="$CC" CXX="$CXX" CC_FOR_BUILD="$BUILDCC"'
@ -493,6 +557,7 @@ fi
if [ $stagelevel -eq 0 ]; then
flistroot="$flistroot include share doc info man"
flistroot="$flistroot crosscc wrapper $arch_target"
createdocs=0
fi
if [ $stagelevel -gt 1 ]; then
@ -506,6 +571,14 @@ fi
set_confopt
if [ $stagelevel -eq 0 -a "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
echo_status "Building this package statically for pseudo native build."
var_insert extraconfopt " " "--enable-static --disable-shared"
for x in BUILDCC_WRAPPER_INSERT LDFLAGS LD CFLAGS CC; do
var_append $x " " "-static"
done
fi
eval "$desc_O"
# include package pre config - if any
@ -677,7 +750,7 @@ abort() {
exec 200>> $builddir/build.pid
echo "Command Wrapper Debug: running '${CC} --version' .."
type ${CC}; CMD_WRAPPER_DEBUG=1 ${CC} --version
type ${CC%% *}; CMD_WRAPPER_DEBUG=1 ${CC} --version
echo "[ writing debug log to $builddir/cmd_wrapper.log ]"
if [ "$debug" = 1 ] ; then
@ -744,11 +817,11 @@ abort() {
if [ "$stagelevel" -le 1 ]
then
xbase="$( cd $xroot/ 2> /dev/null ; pwd -P )"
if egrep -qv "($base|$xbase|/tmp|/proc|/dev)/" \
if egrep -qv "[ ]($base|$xbase|/tmp|/proc|/dev)(/|$)" \
$builddir/fl_wrapper.wlog
then
x="Created file outside basedir: "
egrep -v "($base|$xbase|/tmp|/proc|/dev)/" \
egrep -v "[ ]($base|$xbase|/tmp|/proc|/dev)(/|$)" \
$builddir/fl_wrapper.wlog | \
cut -f2- | sort -u | sed "s,^,$x,"
echo "base #1: $base"
@ -826,11 +899,9 @@ abort() {
# add debug info for known false positives
if egrep -q "^[^#].*[ ]$xpkg([ ]|$)" $base/scripts/dep_fixes.txt; then
mkdir -p $root/var/adm/rock-debug
echo "--- $xpkg [$stagelevel] ---" >> $root/var/adm/rock-debug/falsedeps.txt
fi
while read x; do
mkdir -p $root/var/adm/rock-debug
grep "^$x: " $builddir/dependencies.debug | sort -u | \
sed "s,:, -> $xpkg [$stagelevel]:," >> $root/var/adm/rock-debug/falsedeps.txt
done < <( egrep "^$xpkg[ ]+del[ ]+" $base/scripts/dep_fixes.txt | \
@ -1011,7 +1082,6 @@ umount -r -d -f $builddir/* 2> /dev/null
umount -r -d -f -l $builddir/* 2> /dev/null
if [ "$ROCKCFG_SRC_TMPFS_LOG" = 1 -a -n "$( type -p df )" ]; then
mkdir -p $root/var/adm/rock-debug
if [ ! -f $root/var/adm/rock-debug/tmpfslog.txt ] ; then
echo -e "# Config\tPackage\tInodes\tKB" | \
expand -t20 > $root/var/adm/rock-debug/tmpfslog.txt
@ -1026,6 +1096,10 @@ fi
umount -r -d -f $builddir 2> /dev/null
umount -r -d -f -l $builddir 2> /dev/null
if [ "$ROCKCFG_PSEUDONATIVE" = 1 -a $stagelevel -eq 0 ]; then
rm -f $base/build/$ROCKCFG_ID/pseudonative_handler
fi
if [ -f $root/var/adm/logs/$stagelevel-$xpkg.log ] ; then
if [ $clear_src = 1 ] ; then
rm -rf $builddir/* $builddir

+ 7
- 1
scripts/Build-Tools

@ -87,7 +87,13 @@ if [ "$x" ] ; then
echo_header Re-running configuration:
while read line ; do
echo_status $line
done < <( ./scripts/Config -cfg $config -oldconfig )
done < <(
if [ "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
./scripts/Config -cfg $config -oldconfig -nobashmod
else
./scripts/Config -cfg $config -oldconfig
fi
)
fi
fi
fi

+ 19
- 3
scripts/config.in

@ -87,14 +87,27 @@ block_begin 7
comment '-- WARNING: Test-building packages which are not known to cross build'
comment '-- might cause damage on your build system if it is not read-only. So'
comment '-- only run this if your /{bin,lib,usr,..} is somehow write-protected.'
pkgfilter sed -e 's,^\(. .\)[1X?][^ ]*,\11--------,; s,\(. .\)[-][^ ]*,\1---------,;'
pkgfilter sed -e 's,^\(. ..\)[^ ]*,\1--------,; s,^\(. .\)[1X?],\11,; s,^\(. \)X,\1-,;'
else
pkgfilter sed -e 's,^\(. .\)[1X][^ ]*,\11--------,; s,\(. .\)[?-][^ ]*,\1---------,;'
pkgfilter sed -e 's,^\(. ..\)[^ ]*,\1--------,; s,^\(. .\)[1X],\11,; s,^\(. .\)?,\1-,; s,^\(. \)X,\1-,;'
fi
ROCKCFG_ID="$ROCKCFG_ID-cross" ; ROCKCFGSET_USE_CROSSCC=1
const ROCKCFG_PSEUDONATIVE 0
block_end
else
pkgfilter sed -e 's,\(. .\)[?X],\1-,;'
bool 'This is a pseudo-native cross-build' ROCKCFG_PSEUDONATIVE 0
if [ "$ROCKCFG_PSEUDONATIVE" = 1 ] ; then
comment '-- WARNING: Doing pseudo native builds is a tricky thing.'
comment '-- Better write the documentation first... ;-)'
text 'IP of native host for command forwarding' ROCKCFG_PSEUDONATIVE_NATIVEHOST ''
text 'NFSROOT to be mounted on native host' ROCKCFG_PSEUDONATIVE_NFSROOT "$HOSTNAME:$PWD"
pkgfilter sed -e 's,^\(. .\)[?X],\1-,; s,^\(. \)X,\10,;'
ROCKCFG_ID="$ROCKCFG_ID-pseudonative" ; ROCKCFGSET_USE_CROSSCC=1
else
pkgfilter sed -e 's,^\(. .\)[?X],\1-,; s,^\(. \)X,\1-,;'
fi
fi
block_end
@ -311,6 +324,9 @@ break packages!'
flwrapper 'Use the flist wrapper library for flist creation' \
strace 'Use strace to get the file list' \
find 'Use find on timestamp-file for flist creation'
if [ "$ROCKCFG_FLIST" = strace ]; then
pkgenable strace
fi
block_end
comment ' '

+ 4
- 0
scripts/parse-config

@ -142,3 +142,7 @@ export NM="${archprefix}nm" KCC="${archprefix}kcc"
export F77="${archprefix}f77" MAKE="make"
export AWK="gawk" SED="sed"
if [ $stagelevel -le 1 -a "$ROCKCFG_PSEUDONATIVE" = 1 ]; then
export BUILDCC="$BUILDCC -static" BUILDLD="$BUILDLD -static"
fi

Loading…
Cancel
Save