Changeset 23b6afb for scripts/funcs


Ignore:
Timestamp:
Feb 21, 2006, 12:15:50 AM (19 years ago)
Author:
Jim Gifford <clfs@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
12ba0a4
Parents:
eec901a
Message:

r564@server (orig r562): jim | 2005-06-07 20:12:28 -0700
Mirrored from jg555.com on Tue Jun 7 20:12:17 PDT 2005
----------------------------------------------------------------------


File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/funcs/multiarch-funcs.sh

    reec901a r23b6afb  
    5151                    sed -e "s@lib[36][124]@lib@g"  -e "s@lib@${libdirname}@g" `
    5252
    53    if [ "${MULTIARCH}" = "Y" ]; then
    54       export PERL=`which_func perl-${BUILDENV}`
    55       export PYTHON=`which_func python-${BUILDENV}`
    56    else
    57       export PERL=`which_func perl`
    58       export PYTHON=`which_func python`
    59    fi
    60 
    6153}
    6254
     
    156148   if [ ! -d ${wrapperdir} ]; then mkdir -p ${wrapperdir} ; fi
    157149
    158    cat > ${wrapper} <<EOF
    159 #!/bin/sh
    160 
    161 # Set to default if BUILDENV not set
    162 if [ -z \${BUILDENV} ]; then BUILDENV=${DEFAULTENV} ; fi
    163 export BUILDENV
    164 exec \${0}-\${BUILDENV} \${@}
     150   cat > wrapper.c <<"EOF"
     151/*
     152
     153   wrapper.c - c wrapper for cross-lfs multiarch handling
     154   ------------------------------------------------------
     155   Created By:  Ryan Oliver <ryan.oliver@pha.com.au> 20050606
     156
     157   $LastChangedBy$
     158   $LastChangedDate$
     159   $LastChangedRevision$
     160   $HeadURL$
     161
     162 */
     163
     164#include <unistd.h>
     165#include <stdlib.h>
     166#include <errno.h>
     167
     168/* TODO: should check for __x86_64__ , __powerpc64__ etc and set accordingly */
     169#ifndef DEFAULTENV
     170#define DEFAULTENV "64"
     171#endif
     172
     173int main(int argc, char **argv) {
     174
     175        char *filename;
     176        char *buildenv;
     177
     178        if(!(buildenv = getenv("BUILDENV")))
     179                buildenv = DEFAULTENV;
     180
     181        filename = (char *) malloc(strlen(argv[0]) + strlen(buildenv) + 2);
     182        strcpy(filename, argv[0]);
     183        strcat(filename, "-");
     184        strcat(filename, buildenv);
     185
     186        execvp(filename, argv);
     187        perror(argv[0]);
     188        free(filename);
     189
     190}
    165191EOF
    166192
     193   OLD_BUILDENV="${BUILDENV}"
     194   BUILDENV="${DEFAULTENV}"
     195   setup_multiarch
     196
     197   ${CC-gcc} ${ARCH_CFLAGS} -DDEFAULTENV=\"${DEFAULTENV}\" \
     198       wrapper.c -o ${wrapper}
    167199   chmod 755 ${wrapper}
     200
     201   BUILDENV="${OLD_BUILDENV}"
    168202
    169203}
Note: See TracChangeset for help on using the changeset viewer.