Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- //#define DEF_DEBUG
- #define DEF_DEBUG2
- #define DEF_CROSSROOT 1
- #ifndef EMU_ARCH
- #define EMU_ARCH "arm"
- #endif /*EMU_ARCH*/
- #ifndef RUN_ARCH
- #define RUN_ARCH "x86_64"
- #endif /*RUN_ARCH*/
- #ifndef RUN_LIBSUFFIX
- #define RUN_LIBSUFFIX "64"
- #endif /*RUN_LIBSUFFIX*/
- #ifndef DEF_SYSROOT
- #define DEF_SYSROOT "/sr9"
- #endif /*DEF_SYSROOT*/
- //#define GCC_VERS "4.9.3"
- #ifndef GCC_VERS
- #define GCC_VERS "5.4.0"
- #endif /*GCC_VERS*/
- #ifndef PERL_VERS
- #define PERL_VERS "5.22.2"
- #endif /*PERL_VERS*/
- #ifndef MACHINE_PKSUFFIX
- #define MACHINE_PKSUFFIX "-pc-linux-gnueabihf"
- #endif /*MACHINE_PKSUFFIX*/
- #define MACHINE_TARGET EMU_ARCH MACHINE_PKSUFFIX
- //llvm: armv6-pc-linux-gnueabihf
- #ifndef MACHINE_LLVM_TARGET
- #define MACHINE_LLVM_TARGET "armv7-pc-linux-gnueabihf"
- #endif /*MACHINE_LLVM_TARGET*/
- #define MACHINE_QEMU_TARGET EMU_ARCH
- #define DEF_LD_LIBRARY_PATH_NAME "ZZ_LIBRARY_PATH"
- #define DEF_LD_LIBRARY_PATH_PATH \
- "\
- " DEF_SYSROOT "/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/local/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/X11R6/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/gnome/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/lib" RUN_LIBSUFFIX "/libc5-compat:\
- " DEF_SYSROOT "/usr/share/texmf/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/local/qt/lib" RUN_LIBSUFFIX ":\
- " DEF_SYSROOT "/usr/gnome/lib" RUN_LIBSUFFIX "/mozilla/lib:\
- " DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/perl5/" PERL_VERS "/" RUN_ARCH "-linux-thread-multi/CORE:\
- "
- #ifndef MACHINE_QEMU_SYSROOT
- #define MACHINE_QEMU_SYSROOT "/sr7"
- #endif /*MACHINE_QEMU_SYSROOT*/
- #ifndef JAVA_VERS
- #define JAVA_VERS "jdk8u-jdk8u102-b14"
- #endif /*JAVA_VERS*/
- #define JAVA_TRAP "/dosy/src/java/" JAVA_VERS "-" EMU_ARCH "/bin/"
- #define JAVA_OUTP "/dosy/src/java/" JAVA_VERS "-" RUN_ARCH "/bin/"
- //#define ICED_TRAP "/dosy/src/java/icedtea6-0-" EMU_ARCH "/bin/"
- //#define ICED_OUTP "/dosy/src/java/icedtea6-0-" RUN_ARCH "/bin/"
- #if !defined(GCC_BOLD) && 1
- #define GCC_BOLD "4.9.4"
- #endif /*GCC_BOLDS*/
- #if !defined(GCC_COLD) && 0
- #define GCC_COLD "4.8.5"
- #endif /*GCC_COLDS*/
- /*
- if [ "x86_64" = "`uname -m`" ]; then moddir="/usr/local/x86_64-pc-linux-gnu/lib/modules/`uname -r`";else moddir="/lib/modules/`uname -r`";fi;
- if lsmod | grep -q binfmt_misc; then true; else insmod "${moddir}/kernel/fs/binfmt_misc.ko";fi;
- if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc;fi;
- echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/lib64/bin/execproxy-$(uname -m):" \
- >/proc/sys/fs/binfmt_misc/register
- mount ant9:/ /sr7; #mount --bind /dosy/src/tmp/root-arm /sr7; ### /root/config/config-glibc-2.9.0 "" qemu-wrapper-glibc
- mount --bind /dosy /sr7/dosy;
- mount -t proc . /sr7/proc;mount -t sysfs . /sr7/sys;mount -r --bind / /sr7/sr9;mount --bind /dev/pts/ /sr7/dev/pts/
- #mkdir -p /sr7/lib64/;rm -f /sr7/lib64/ld-linux-x86-64.so.2;cp -dpR /dosy/pkg/high-pack/boot/ld-linux-x86-64.so.2.xz /sr7/lib64/; xz -dv /sr7/lib64/ld-linux-x86-64.so.2.xz; ### ZZ_LIBRARY_PATH compatible
- #mkdir -p /sr7/usr/local/x86_64-pc-linux-gnu;mount -r --bind /sr7/sr9/usr/local/x86_64-pc-linux-gnu /sr7/usr/local/x86_64-pc-linux-gnu;
- #mkdir -p /sr7/usr/local/arm-pc-linux-gnueabihf/lib; (for w in $(cd /sr7/usr/lib/; echo libstdc*); do cd /sr7/usr/local/arm-pc-linux-gnueabihf/lib;ln -snf ../../../lib/$w $w;done );
- #mkdir -p /sr7/usr/lib64;ln -snf /sr9/usr/lib64/perl5 /sr7/usr/lib64/perl5;ln -snf /sr9/usr/lib64/locale /sr7/usr/lib64/locale;ln -snf /sr9/usr/lib64/gconv /sr7/usr/lib64/gconv;
- mount -r --bind /dosz /sr7/dosz;
- #tar xvf /dosy/pkg/high-pack/qemu/qemu-2.5.0-arm_userstatic-x86_64-1.txz -C /sr7/ --transform="s,^./usr/local/bin/,lib64/," ./usr/local/bin/qemu-arm;cp -dpR /home/patrick/dev/system/execproxy /sr7/lib64/;
- chroot /sr7;
- . /etc/profile ; ldconfig; echo $ARCH
- #-
- cd /tmp;
- #rm -Rf /sr7/lib64/{ld-linux-x86-64.so.2,ld-2.22.so,execproxy,qemu-arm}; rmdir /sr7/lib64/bin /sr7/lib64/; rm -Rf /sr7/usr/lib64/; rm -R /sr7/usr/local/arm-pc-linux-gnueabihf/;
- umount /sr7/dev/pts/ /sr7/usr/local/x86_64-pc-linux-gnu /sr7/sr9 /sr7/dosy /sr7/proc /sr7/sys /sr7/dosz;
- umount /sr7/;
- */
- /*
- for f in $(file * | sed -r -n 's/:[ \t]+ELF 64-bit LSB executable, x86-64, version 1 .*$//p'); do cp /sr7/usr/bin/true $f;done
- */
- /* generate ld.so ZZ_ : #/root/config/config-glibc-2.9.0 "" zzglibc
- sed -r -i 's/"LD_LIBRARY_PATH"/"ZZ_LIBRARY_PATH"/' /dosy/src/glibc-2.22/elf/dl-load.c /dosy/src/glibc-2.22/elf/dl-support.c:
- sed -r -i "s/'L'/'Z'/; s/'D'/'Z'/;" /dosy/src/glibc-2.22/elf/dl-environ.c; #LD prefix -> ZZ prefix
- ( cd /dosy/src/glibc;make)
- cp -dpR /dosy/src/glibc/elf/ld.so /dosy/pkg/high-pack/boot/ld-linux-x86-64.so.2
- xz -9ev /dosy/pkg/high-pack/boot/ld-linux-x86-64.so.2
- ZZ_LIBRARY_PATH="/usr/X11R6/lib64" /dosy/src/glibc/elf/ld.so --inhibit-cache --list /usr/local/bin/octave
- */
- // rm -f /sr7/tmp/execproxy.log;touch /sr7/tmp/execproxy.log;chown nobody.users /sr7/tmp/execproxy.log;chmod 660 /sr7/tmp/execproxy.log;make execproxy_s; cp -dpR execproxy "/sr7/lib64/bin/"
- //
- // cat /sr7/tmp/execproxy.log | grep qemu-arm | gawk -F, '{printf("%s\n",$2);}' | sort | uniq
- static int s_execv(const char *const name, int afn, char *const argfirst[], const int argc, char *argv[]) {
- //sizeof(s_proxyprg)/sizeof(*s_proxyprg)
- int err, i;
- char *s_proxyarg[(argc-1) + afn + 1 ];
- for (i=0;i<afn;i++) { s_proxyarg[i]=argfirst[i]; }
- for (i=0;i<argc-1;i++) { s_proxyarg[i + afn]=argv[i+1]; }
- s_proxyarg[(sizeof(s_proxyarg)/sizeof(*s_proxyarg))-1] = NULL;
- #ifdef DEF_DEBUG
- { fprintf(stderr,">"); for (i=0;i<(sizeof(s_proxyarg)/sizeof(*s_proxyarg))-1;i++) { fprintf(stderr,"'%s',",s_proxyarg[i]); } fprintf(stderr,"\n"); }
- #endif /*DEF_DEBUG*/
- #ifdef DEF_DEBUG2
- { FILE *f=fopen("/tmp/execproxy.log","a"); fprintf(f,">'%s'>",name); for (i=0;i<(sizeof(s_proxyarg)/sizeof(*s_proxyarg))-1;i++) { fprintf(f,"'%s',",s_proxyarg[i]); } fprintf(f,"\n"); fclose(f); }
- #endif /*DEF_DEBUG2*/
- err = execv(name, s_proxyarg);
- //printf("error");
- return err;
- }
- static int s_execsubroot(const char *const name, int afn, char *const argfirst[],const int argc, char *argv[]) {
- // echo /sr9/lib64:/sr9/usr/lib64:$(cat /etc/ld.so.conf|grep 64|sed "/^#/ D;"|sed "s,^,/sr9,")|sed "s/ /:/g"
- setenv(DEF_LD_LIBRARY_PATH_NAME, DEF_LD_LIBRARY_PATH_PATH, 1);
- return s_execv(name, afn, argfirst, argc-1, &argv[1]);
- }
- #if 0
- static int s_execsubroot_noldpath(const char *const name, int afn, char *const argfirst[],const int argc, char *argv[]) {
- //setenv(DEF_LD_LIBRARY_PATH_NAME, "", 1);
- return s_execv(name, afn, argfirst, argc-1, &argv[1]);
- }
- #endif
- int main(const int argc, char *argv[], char *envp[]) {
- int err = 0;
- char *s_cmd=argv[1];
- #ifdef DEF_DEBUG
- { int i; fprintf(stderr,"#"); for (i=0;i<argc;i++) { fprintf(stderr,"'%s',",argv[i]); } fprintf(stderr,"\n"); }
- #endif
- #ifdef DEF_DEBUG2
- { int i; FILE *f=fopen("/tmp/execproxy.log","a"); fprintf(f,"#"); for (i=0;i<argc;i++) { fprintf(f,"'%s',",argv[i]); } fprintf(f,"\n"); fclose(f); }
- #endif
- if (argc<2) exit(-1);
- #ifdef DEF_CROSSROOT
- if (!strcmp(s_cmd, "/bin/ls") || !strcmp(s_cmd, "/usr/bin/ls") ||
- !strcmp(s_cmd, "/bin/sed") || !strcmp(s_cmd, "/usr/bin/sed") ||
- !strcmp(s_cmd, "/bin/grep") || !strcmp(s_cmd, "/usr/bin/grep") ||
- !strcmp(s_cmd, "/bin/gzip") || !strcmp(s_cmd, "/usr/bin/gzip") ||
- !strcmp(s_cmd, "/bin/cat") || !strcmp(s_cmd, "/usr/bin/cat") ||
- !strcmp(s_cmd, "/bin/cp") || !strcmp(s_cmd, "/usr/bin/cp") ||
- !strcmp(s_cmd, "/bin/ln") || !strcmp(s_cmd, "/usr/bin/ln") ||
- !strcmp(s_cmd, "/bin/mv") || !strcmp(s_cmd, "/usr/bin/mv") ||
- !strcmp(s_cmd, "/bin/ln") || !strcmp(s_cmd, "/usr/bin/ln") ||
- !strcmp(s_cmd, "/bin/rm") || !strcmp(s_cmd, "/usr/bin/rm") ||
- !strcmp(s_cmd, "/bin/du") || !strcmp(s_cmd, "/usr/bin/du") ||
- !strcmp(s_cmd, "/bin/pwd") || !strcmp(s_cmd, "/usr/bin/pwd") ||
- !strcmp(s_cmd, "/bin/echo") || !strcmp(s_cmd, "/usr/bin/echo") ||
- !strcmp(s_cmd, "/bin/rmdir") || !strcmp(s_cmd, "/usr/bin/rmdir") ||
- !strcmp(s_cmd, "/bin/mkdir") || !strcmp(s_cmd, "/usr/bin/mkdir") ||
- !strcmp(s_cmd, "/bin/chmod") || !strcmp(s_cmd, "/usr/bin/chmod") ||
- !strcmp(s_cmd, "/bin/true") || !strcmp(s_cmd, "/bin/false") || !strcmp(s_cmd, "/usr/bin/true") || !strcmp(s_cmd, "/usr/bin/false") ||
- !strcmp(s_cmd, "/usr/bin/grep") || !strcmp(s_cmd, "/usr/bin/egrep") || !strcmp(s_cmd, "/usr/bin/fgrep") || !strcmp(s_cmd, "/usr/bin/id") ||
- !strcmp(s_cmd, "/usr/bin/m4") || !strcmp(s_cmd, "/usr/bin/tar") || !strcmp(s_cmd, "/usr/bin/xz") || !strcmp(s_cmd, "/usr/bin/sort") || !strcmp(s_cmd, "/usr/bin/expr") ||
- !strcmp(s_cmd, "/usr/bin/tail") || !strcmp(s_cmd, "/usr/bin/lzma") || !strcmp(s_cmd, "/usr/bin/chown") || !strcmp(s_cmd, "/usr/bin/dirname") || !strcmp(s_cmd, "/usr/bin/cmp") ||
- !strcmp(s_cmd, "/usr/bin/wc") || !strcmp(s_cmd, "/usr/bin/xargs") || !strcmp(s_cmd, "/usr/bin/touch") || !strcmp(s_cmd, "/usr/bin/gawk") || !strcmp(s_cmd, "/usr/bin/awk") || !strcmp(s_cmd, "/usr/bin/cut") ||
- !strcmp(s_cmd, "/usr/bin/md5sum") || !strcmp(s_cmd, "/usr/bin/uniq") || !strcmp(s_cmd, "/usr/bin/od") || !strcmp(s_cmd, "/usr/bin/dd") || !strcmp(s_cmd, "/usr/bin/df") || !strcmp(s_cmd, "/usr/bin/find") ||
- !strcmp(s_cmd, "/usr/bin/comm") || !strcmp(s_cmd, "/usr/bin/mktemp") || !strcmp(s_cmd, "/usr/bin/diff") || !strcmp(s_cmd, "/usr/bin/sleep") || !strcmp(s_cmd, "/usr/bin/tr") ||
- !strcmp(s_cmd, "/usr/bin/less") || !strcmp(s_cmd, "/usr/bin/file") || !strcmp(s_cmd, "/usr/bin/patch") || !strcmp(s_cmd, "/usr/bin/date") || !strcmp(s_cmd, "/usr/bin/basename") || !strcmp(s_cmd, "/usr/bin/split") ||
- !strcmp(s_cmd, "/usr/bin/groff") || !strcmp(s_cmd, "/usr/bin/troff") || !strcmp(s_cmd, "/usr/bin/rev") || !strcmp(s_cmd, "/usr/bin/paste") || !strcmp(s_cmd, "/usr/bin/readlink") || !strcmp(s_cmd, "/usr/bin/numfmt") ||
- !strcmp(s_cmd, "/usr/bin/xzcat") || !strcmp(s_cmd, "/usr/bin/tput") || !strcmp(s_cmd, "/usr/bin/head") || !strcmp(s_cmd, "/usr/bin/env") || !strcmp(s_cmd, "/usr/bin/unlzma") || !strcmp(s_cmd, "/usr/bin/bzip2") ||
- !strcmp(s_cmd, "/usr/bin/msgfmt") || !strcmp(s_cmd, "/usr/bin/xgettext") || !strcmp(s_cmd, "/usr/bin/msgmerge") ||
- !strcmp(s_cmd, "/usr/bin/cpio") || !strcmp(s_cmd, "/usr/bin/join") || !strcmp(s_cmd, "/usr/bin/mkfifo") || !strcmp(s_cmd, "/usr/bin/printf") || !strcmp(s_cmd, "/usr/bin/chroot") ||
- !strcmp(s_cmd, "/usr/bin/seq") || !strcmp(s_cmd, "/usr/bin/test") || !strcmp(s_cmd, "/usr/bin/dircolors") || !strcmp(s_cmd, "/usr/bin/etags") ||
- !strcmp(s_cmd, "/bin/tee") || !strcmp(s_cmd, "/usr/bin/tee") || !strcmp(s_cmd, "/usr/gnome/bin/pkg-config") || !strcmp(s_cmd, "/usr/bin/time") || !strcmp(s_cmd, "/usr/bin/tbl") ||
- !strcmp(s_cmd, "/usr/local/bin/zip") || !strcmp(s_cmd, "/usr/local/bin/unzip") || !strcmp(s_cmd, "/usr/bin/gjar")
- ) {
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s));
- //char *const s_proxyprg[] = { s_cmd, "--inhibit-cache", "--library-path", DEF_LD_LIBRARY_PATH_PATH, s };
- //err = s_execsubroot_noldpath("/lib64/ld-linux-x86-64.so.2", sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/make") || !strcmp(s_cmd, "/bin/make") || !strcmp(s_cmd, "/bin/bash") || !strcmp(s_cmd, "/bin/sh") || !strcmp(s_cmd, "/usr/bin/bash")) {
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #if 1
- } else if (!strcmp(s_cmd, "/usr/gnome/bin/xsltproc") || !strcmp(s_cmd, "/usr/gnome/bin/xmllint")) { // required: /usr/lib64/gconv/*.so
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s));
- char *const s_proxyprg[] = { s_cmd };
- setenv("GCONV_PATH", DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/gconv", 1);
- err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif
- } else if (!strcmp(s_cmd, "/usr/bin/gcc") || !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gcc") || !strcmp(s_cmd, "/usr/bin/cc")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gcc", "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/g++") || !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-g++") || !strcmp(s_cmd, "/usr/bin/c++")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-g++", "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/gfortran") || !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gfortran")) { //octave
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gfortran", "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/gcj") || !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gcj")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gcj", "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/../libexec/gcc/" MACHINE_TARGET "/" GCC_VERS "/cc1")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/libexec/gcc/" MACHINE_TARGET "/" GCC_VERS "/cc1" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/../libexec/gcc/" MACHINE_TARGET "/" GCC_VERS "/cc1plus")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/libexec/gcc/" MACHINE_TARGET "/" GCC_VERS "/cc1plus" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/strip") ||
- !strcmp(s_cmd, "/usr/bin/as") ||
- !strcmp(s_cmd, "/usr/bin/nm") ||
- !strcmp(s_cmd, "/usr/bin/ar") ||
- !strcmp(s_cmd, "/usr/bin/ranlib") ||
- !strcmp(s_cmd, "/usr/bin/ld") ||
- !strcmp(s_cmd, "/usr/bin/objdump") ||
- !strcmp(s_cmd, "/usr/bin/objcopy") ||
- !strcmp(s_cmd, "/usr/bin/size") ||
- !strcmp(s_cmd, "/usr/bin/cpp") /*|| !strcmp(s_cmd, "/lib/cpp")*/) {
- char s[128]=DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-"; strncat(s, &s_cmd[strlen("/usr/bin/")], sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-strip") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-as") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-nm") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-ar") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-ranlib") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-ld") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-objdump") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-objcopy") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-size") ||
- !strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-cpp")) {
- char s[128]=DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-"; strncat(s, &s_cmd[strlen("/usr/bin/" MACHINE_TARGET "-")], sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/strip") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/as") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/nm") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/ar") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/ranlib") ||
- (!strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/ld") && !(argc>=4 && !strcmp(argv[2], "-plugin")) ) || //* gcc-5.3.0: -plugin arg requires local ld*/
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/objdump") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/objcopy") ||
- !strcmp(s_cmd, "/usr/" MACHINE_TARGET "/bin/cpp")) {
- char s[128]=DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-"; strncat(s, &s_cmd[strlen("/usr/" MACHINE_TARGET "/bin/")], sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if ((argc >= 3 && (!strcmp(s_cmd, "/usr/bin/perl") && (!strcmp(argv[2], "/usr/bin/makeinfo") || !strcmp(argv[2], "/usr/bin/autoheader") || !strcmp(argv[2], "/usr/bin/pod2man") ))) ||
- (argc >= 4 && (!strcmp(s_cmd, "/usr/bin/perl") && !strcmp(argv[2], "-w") &&
- (!strcmp(argv[3], "/usr/bin/aclocal") || !strcmp(argv[3], "/usr/bin/aclocal") || !strcmp(argv[3], "/usr/bin/autom4te") || !strcmp(argv[3], "/usr/bin/autoheader") ||
- !strcmp(argv[3], "/usr/bin/automake") || !strcmp(argv[3], "/usr/bin/aclocal") || !strcmp(argv[3], "/usr/bin/aclocal-1.15") || !strcmp(argv[3], "/usr/bin/automake-1.15") ||
- !strcmp(argv[3], "/usr/gnome/bin/intltool-merge") || !strcmp(argv[3], "/usr/gnome/bin/intltool-update") ))) // required: /usr/lib64/perl5
- ) { //process safe perl process only ////// fgrep "qemu-arm','/usr/bin/perl'" /sr7/tmp/execproxy.log | less
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s));
- char *const s_proxyprg[] = { s_cmd };
- setenv("PERL5LIB", DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/perl5/site_perl/" PERL_VERS "/x86_" RUN_LIBSUFFIX "-linux-thread-multi:" DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/perl5/site_perl/" PERL_VERS ":" DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/perl5/" PERL_VERS "/" RUN_ARCH "-linux-thread-multi:" DEF_SYSROOT "/usr/lib" RUN_LIBSUFFIX "/perl5/" PERL_VERS, 1);
- err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if ((argc >= 3 && (!strcmp(s_cmd, "/usr/bin/python") || !strcmp(s_cmd, "/usr/bin/python2.7")) &&
- ((!strcmp(argv[2], "/usr/bin/scons")) || !strcmp(argv[2], "/usr/local/bin/asciidoc")
- /*|| !strcmp(argv[2], "/usr/gnome/bin/g-ir-scanner")*/ /*|| !strcmp(argv[2], "/usr/gnome/bin/xml2po")*/) ) // 'scons': serf, 'asciidoc': git, 'xml2po': gnome-games-2.32.1
- ) { //process safe python process only ////// egrep "qemu-arm','/usr/bin/python.*'" /sr7/tmp/execproxy.log | less
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s)); setenv("PYTHONHOME", DEF_SYSROOT "/usr", 1);
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #if 0 // ./ruby: failed ruby required some .so libs...
- } else if ((argc >= 2 && (!strcmp(s_cmd, "/usr/local/bin/ruby") || !strcmp(s_cmd, "./ruby")))) {
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(DEF_SYSROOT "/usr/local/bin/ruby", sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif
- } else if (!strcmp(s_cmd, "/usr/local/bin/clang") || !strcmp(s_cmd, "/usr/bin/clang")) { //pkg: icu4c-56_1 (patch: +#LDFLAGSICUDT=-nodefaultlibs -nostdlib ### mandatory for arm)
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/clang", "-target", MACHINE_LLVM_TARGET,
- "--sysroot", "/", "-L/usr/lib/gcc/" MACHINE_TARGET "/" GCC_VERS, "-B/usr/lib/gcc/" MACHINE_TARGET "/" GCC_VERS, "-I/usr/include/c++/" GCC_VERS, "-I/usr/include/c++/" GCC_VERS "/" MACHINE_TARGET "" };
- err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/local/bin/clang++") || !strcmp(s_cmd, "/usr/bin/clang++")) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/clang++", "-target", MACHINE_LLVM_TARGET,
- "--sysroot", "/", "-L/usr/lib/gcc/" MACHINE_TARGET "/" GCC_VERS, "-B/usr/lib/gcc/" MACHINE_TARGET "/" GCC_VERS, "-I/usr/include/c++/" GCC_VERS, "-I/usr/include/c++/" GCC_VERS "/" MACHINE_TARGET "" };
- err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strcmp(s_cmd, "/usr/local/bin/opt")) { // pkg: libclc
- char *const s_proxyprg[] = { s_cmd };
- err = s_execsubroot(DEF_SYSROOT "/usr/local/bin/opt", sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else if (!strncmp(s_cmd, JAVA_TRAP, strlen(JAVA_TRAP))) { // openjdk
- char s[128]=JAVA_OUTP; strncat(s, &s_cmd[strlen(JAVA_TRAP)], sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #ifdef ICED_TRAP
- } else if (!strncmp(s_cmd, ICED_TRAP, strlen(ICED_TRAP))) { // icedtea
- char s[128]=ICED_OUTP; strncat(s, &s_cmd[strlen(ICED_TRAP)], sizeof(s));
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif /*ICED_TRAP*/
- #ifdef GCC_VERS
- } else if (!strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gcc-" GCC_VERS)) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gcc-" GCC_VERS, "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif /*GCC_VERS*/
- #ifdef GCC_BOLD
- } else if (!strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gcc-" GCC_BOLD)) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gcc-" GCC_BOLD, "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif /*GCC_BOLD*/
- #ifdef GCC_COLD
- } else if (!strcmp(s_cmd, "/usr/bin/" MACHINE_TARGET "-gcc-" GCC_COLD)) {
- char *const s_proxyprg[] = { DEF_SYSROOT "/usr/local/bin/" MACHINE_TARGET "-gcc-" GCC_COLD, "--sysroot", "/" }; err = s_execsubroot(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- #endif /*GCC_COLD*/
- } else if (!strcmp(s_cmd, "/usr/bin/git")) {
- char s[128]=DEF_SYSROOT; strncat(s, s_cmd, sizeof(s)); setenv("GIT_EXEC_PATH", DEF_SYSROOT "/usr/libexec/git-core", 1); // git --exec-path
- char *const s_proxyprg[] = { s_cmd }; err = s_execsubroot(s, sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- } else {
- char *const s_proxyprg[] = { "/lib" RUN_LIBSUFFIX "/bin/qemu-" MACHINE_QEMU_TARGET "-" RUN_ARCH, };
- //printf("error");
- err = s_execv(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- }
- #else /*DEF_CROSSROOT*/
- {
- char *const s_proxyprg[] = { "/lib" RUN_LIBSUFFIX "/bin/qemu-" MACHINE_QEMU_TARGET, "-L", MACHINE_QEMU_SYSROOT };
- setenv(DEF_LD_LIBRARY_PATH_NAME, "", 1);
- err = s_execv(s_proxyprg[0], sizeof(s_proxyprg)/sizeof(*s_proxyprg), s_proxyprg, argc, argv);
- }
- #endif /*DEF_CROSSROOT*/
- return err;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement