home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / linux / 9922 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  12.2 KB

  1. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!klaava!liljeber
  2. From: liljeber@klaava.Helsinki.FI (Mika Pekka Liljeberg)
  3. Newsgroups: comp.os.linux
  4. Subject: Re: WANT GCC? FORGET FAQ.GCC AND README??  lets end this, plz!
  5. Message-ID: <LILJEBER.92Sep5100751@klaava.Helsinki.FI>
  6. Date: 5 Sep 92 08:07:51 GMT
  7. References: <1992Sep4.225554.2416@novell.com> <1992Sep4.102532.4493@fys.ruu.nl>
  8.     <186a86INNcsb@usenet.INS.CWRU.Edu> <1880h6INNfoh@usenet.INS.CWRU.Edu>
  9.     <188sooINNc6f@usenet.INS.CWRU.Edu>
  10. Sender: liljeber@klaava.Helsinki.FI (Mika Pekka Liljeberg)
  11. Organization: Department of Computer Science, University of Helsinki, Finland
  12. Lines: 527
  13. In-Reply-To: mal11@po.CWRU.Edu's message of 4 Sep 92 23: 50:48 GMT
  14.  
  15. In article <188sooINNc6f@usenet.INS.CWRU.Edu> mal11@po.CWRU.Edu (Matthew A. Lewis) wrote:
  16.  
  17. > again....my apologies to anyone I offended. i guess I was a little too
  18. > excited. BUT LINUX IS WORTH GETTING EXCITED ABOUT. thanx to all the
  19. > testers, ftp admins, and linus himself.
  20. > later......and any help would be appreciated......I'm still stuck with gcc
  21.  
  22. Sigh. Ok, here's a modified install script I used. I needed to modify it,
  23. because I installed gcc from a DOS partition, where the filename conflict
  24. was a real problem. Just copy all the gcc .tar.Z files into a single directory
  25. along with this install script (use any names you like), configure the file
  26. names at the start of the script and run it. If you still can't get it to work,
  27. please don't flame me. HLU's script was ok, and so is this one. If you get a
  28. mangled file system, your problem is probably somewhere else. Any one of the
  29. utilities used in the script could be broken.
  30.  
  31. > -- 
  32. > MaThiEu a. LeWis      "There is no middle ground/Or that's how it seems/For 
  33. > Thieves Like Us        us to walk or to take/Instead we tumble down/Either
  34. > mal11@po.cwru.edu      side left or right/To love or to hate."
  35. >                     -A Strange Kind of Love
  36.  
  37.     Mika
  38.  
  39. ----- install.2x --------------------------------------------------------------
  40. #!/bin/sh
  41. # installation of gcc 2.xxx
  42.  
  43. # Configure these filenames to suit you
  44. MISCFILE=222dmisc.tz
  45. LIBFILE=222dlib.tz
  46. DBFILE=222ddb.tz
  47. KERNELINC=097p1inc.tz
  48. BINUTILS=binutils.tz
  49.  
  50. # do something to kernel souce
  51. kernelstuff ()
  52. {
  53.   workdir=$1
  54.   srcdir=$2
  55.  
  56. # we may have something in there.
  57.  
  58.   for d in asm linux; do
  59.     if [ -d /usr/include/${d} ]; then
  60.       for f in /usr/include/${d}/*.h; do
  61.     if [ -f $f ]; then 
  62.       mv $f ${srcdir}/include/$d
  63.     fi
  64.       done
  65.       /bin/rm -rf /usr/include/${d}
  66.     fi
  67.   done
  68. }
  69.  
  70. # install jump table
  71. jumptable ()
  72. {
  73.   DIR=$1
  74.   VER=$2
  75.   REL=$3
  76.   M=$4
  77.  
  78.   mv $DIR/libc.so.${REL} /lib
  79.   mv $DIR/lib${M}.so.${REL} /lib/libm.so.${REL}
  80.  
  81.   ln -s -f /lib/libc.so.${REL} /lib/libc.so.${VER}
  82.   ln -s -f /lib/libm.so.${REL} /lib/libm.so.${VER}
  83. }
  84.  
  85. checkreturn ()
  86. {
  87.   if [ $? != 0 ]
  88.   then
  89.     echo Failed to $1.
  90.     exit 1
  91.   fi
  92. }
  93.  
  94. fixfiles ()
  95. {
  96.   VERBOSE=$1
  97.   VER=$2
  98.   BINS=$3
  99.  
  100.   if [ $VERBOSE = yes ]; then set -x; fi
  101.  
  102.   cd /usr/bin
  103.   chown bin:bin $BINS
  104.   chmod 755 $BINS
  105.  
  106.   chown -R bin:bin /usr/include /usr/g++-include /lib /usr/lib/gcc-lib
  107.   chmod -R 755 /lib /usr/lib/gcc-lib
  108.  
  109.   # this is for the header files
  110.   chmod 755 /usr/include /usr/g++-include
  111.   # Yes, 'find' would be cleaner and faster, but it is not on rootdisk
  112.   cd /usr/include
  113.   chmod 775 *
  114.   chmod 664 *.h
  115.   chmod 664 */*
  116.   cd /usr/g++-include
  117.   chmod 775 *
  118.   chmod 664 *.h
  119.   chmod 664 */*
  120.  
  121.   chmod 664 /usr/lib/gcc-lib/i386-linux/${VER}/*.?
  122.   chmod 664 /usr/lib/gcc-lib/i386-linux/${VER}/shared/*.?
  123. }
  124.  
  125. # check if it is a directory.
  126. checkdir ()
  127. {
  128.   if [ x${1}x = xx ]
  129.   then
  130.     echo No directory to check.
  131.     return 1
  132.   fi
  133.  
  134.   for f in $*
  135.   do
  136.     if [ ! -d $f ]; then
  137.       echo There is no such a directory, $f.
  138.       echo Please make sure there is one and it has right stuffs in it.
  139.       exit 1
  140.     fi
  141.   done
  142.   return 0
  143. }
  144.  
  145. checkbinfile ()
  146. {
  147.   for f in $*
  148.   do
  149.     if [ ! -f /bin/$f -a ! -f /usr/bin/$f ]; then
  150.       echo There is no such a file, $f.
  151.       return 1
  152.     fi
  153.   done
  154.   return 0
  155. }
  156.  
  157. checkfile ()
  158. {
  159.   if [ x${1}x = xx ]
  160.   then
  161.     echo No file to check.
  162.     return 1
  163.   fi
  164.  
  165.   for f in $*
  166.   do
  167.     if [ ! -f $f ]; then
  168.       echo There is no such a file, $f.
  169.       echo Please make sure there is one and it has right stuffs in it.
  170.       exit 1
  171.     fi
  172.   done
  173.   return 0
  174. }
  175.  
  176. checkroot ()
  177. {
  178.   uid=`id | sed -e 's/uid=\([0-9]*\)/\1/' -e 's/[^a-z0-9=].*//'`
  179.   if [ $? != 0 ]
  180.   then
  181.     echo Fail to get \"root\" id. You may need a working \"id\" and
  182.     echo \"sed\".
  183.     exit 1
  184.   fi
  185.  
  186.   if [ x${uid}x != x0x ]
  187.   then
  188.     echo You have to be root to run this script.
  189.     exit 1
  190.   fi
  191. }
  192.  
  193. usage ()
  194. {
  195.   echo Usage: sh $1 [-v] version {kernel src dir}
  196.   echo Note: \"sh\" must be zsh or bash.
  197.   exit 1
  198. }
  199.  
  200. checkroot
  201.  
  202. VERBOSE=no
  203.  
  204. if [ $# != 2 -a $# != 3 ]
  205. then
  206.   usage $0
  207. fi
  208.  
  209. case $1 in
  210. -v)
  211.   shift
  212.   set -x
  213.   VERBOSE=yes
  214.   ;;
  215. esac
  216.  
  217. if [ $# != 2 ]
  218. then
  219.   usage $0
  220. fi
  221.  
  222. VERSION=$1
  223. echo Installing gcc ${VERSION} ......
  224.  
  225. # kernel src dir
  226. KERNELSRCDIR=$2
  227.  
  228. #ln is not on rootdisk, let's use cp
  229. #LN="cp -s"
  230. #HDLN="cp -l"
  231. LN="ln -s"
  232. HDLN="ln"
  233. MV="mv -f"
  234. RM=/bin/rm
  235. PREFIX=/usr
  236. #LN="echo ln"
  237. #MV="echo mv"
  238. #PREFIX=/local
  239. LIBDIR=${PREFIX}/lib/gcc-lib/i386-linux/${VERSION}
  240. SHAREDLIBDIR=${LIBDIR}/shared
  241. JUMPLIBDIR=${LIBDIR}/jump
  242. SHIMAGEDIR=/lib
  243.  
  244. # change it by hand
  245. JUMP_VERSION=2
  246. JUMP_RELEASE=${JUMP_VERSION}.2
  247.  
  248. #create directories first
  249.  
  250. if [ -f $SHIMAGEDIR ]
  251. then
  252.   echo $SHIMAGEDIR should be directory. Remove it first!
  253.   exit 1
  254. fi
  255.  
  256. if [ ! -d $SHIMAGEDIR ]
  257. then
  258.   mkdir $SHIMAGEDIR
  259.  if [ $? != 0 ]
  260.  then
  261.    echo Unable to create directory: $SHIMAGEDIR. You may have to create
  262.    echo some paths in $SHIMAGEDIR first by hand.
  263.    exit 1
  264.   fi
  265. fi
  266.  
  267. echo gcc ${VERSION} will only work with a 387 or the kernel above 0.95.
  268. # ask if there is a 387.
  269. echo "Do you have a 387? [y/n] "
  270. read MATH
  271. if [ x${MATH}x = "xyx" ]
  272. then
  273.   MATH=hard
  274. else
  275.   MATH=soft
  276. fi
  277.  
  278. echo Check if we get the files.
  279. #WORKDIR=`echo ${VERSION}*`
  280. WORKDIR=yeah
  281. if [ "${WORKDIR}" = "${VERSION}""*" ]
  282. then
  283.   echo No files to install. You need at least
  284.   echo "1. ${MISCFILE}"
  285.   echo "2. ${DBFILE}"
  286.   echo "3. ${LIBFILE}"
  287.   if [ ${VERSION} = 2.2.2d ]; then
  288.     echo "4. ${BINUTILS}"
  289.   else
  290.     echo "4. ${BINUTILS} (optional)"
  291.   fi
  292.   echo "5. ${KERNELINC} (header files also used by kernel source)"
  293.   exit 1
  294. fi
  295.  
  296. #KERNELINC=`echo *inc.ta*`
  297. if [ ! -f ${KERNELINC} ]
  298. then
  299.   echo You need ${KERNELINC} for the whole set of the header files
  300.   echo to use gcc ${VERSION}.
  301.   exit 1
  302. fi
  303.  
  304. echo Check ${DBFILE} and ${MISCFILE}
  305. checkfile ${DBFILE} ${MISCFILE}
  306.  
  307. # check those
  308. BINS="as86 ld86 ar as gprof ld nm objdump ranlib size strip"
  309. echo Check binaries.
  310. checkbinfile "${BINS}"
  311. if [ $? != 0 -o ${VERSION} = 2.2.2d ]
  312. then
  313.   checkfile ${BINUTILS}
  314. fi
  315.  
  316. #LIBFILE=
  317.  
  318. # optional in gcc 2.2.2d. false.
  319. if [ ${VERSION} != xxxxxxx ]
  320. then
  321.   checkfile ${LIBFILE}
  322. else
  323.   # maybe it has gcc 2.2.2 file.
  324.   if [ -f 2.2.2lib.tar.Z ]; then
  325.     BBFILE=2.2.2lib.tar.Z
  326.   else
  327.     OLDLIBDIR=/usr/lib/gcc-lib/i386-linux/2.2.2
  328.     # it neens gcc 2.2.2d file.
  329.     if [ ! -d ${OLDLIBIR} ]; then
  330.       checkfile ${VERSION}lib.tar.Z
  331.       LIBFILE=${VERSION}lib.tar.Z
  332.     else
  333.       # can I use gcc 2.2.2
  334.       if [ ! -f ${OLDLIBDIR}/cc1 -o ! -f ${OLDLIBDIR}/cc1plus ]
  335.       then
  336.     checkfile ${VERSION}lib.tar.Z
  337.     LIBFILE=${VERSION}lib.tar.Z
  338.       fi
  339.     fi
  340.   fi
  341. fi
  342.  
  343. # double check the kernel sources
  344. checkdir $KERNELSRCDIR
  345. checkdir $KERNELSRCDIR/include/linux $KERNELSRCDIR/include/asm
  346.  
  347. WORKDIR=`pwd`
  348.  
  349. cd /usr
  350.  
  351. # optional
  352. if [ -f ${WORKDIR}/${BINUTILS} ]
  353. then
  354.   echo installing ${BINUTILS}
  355. #  tar xvvofz ${WORKDIR}/binutils.tar.Z
  356. #  zcat ${WORKDIR}/binutils.tar.Z | tar xvvof -
  357.   compress -d < ${WORKDIR}/${BINUTILS} | tar xvvof -
  358. fi
  359.  
  360. # optional
  361. if [ x${LIBFILE}x != xx ]
  362. then
  363.   echo installing ${LIBFILE}
  364. #  tar xvvofz ${WORKDIR}/${LIBFILE}
  365. #  zcat ${WORKDIR}/${LIBFILE} | tar xvvof -
  366.   compress -d < ${WORKDIR}/${LIBFILE} | tar xvvof -
  367. fi
  368.  
  369. echo installing ${DBFILE}.
  370. #tar xvvofz ${WORKDIR}/${VERSION}db.tar.Z
  371. #zcat ${WORKDIR}/${VERSION}db.tar.Z | tar xvvof -
  372. compress -d < ${WORKDIR}/${DBFILE} | tar xvvof -
  373.  
  374. echo installing ${MISCFILE}.
  375. #tar xvvofz ${WORKDIR}/${VERSION}misc.tar.Z
  376. #zcat ${WORKDIR}/${VERSION}misc.tar.Z | tar xvvof -
  377. compress -d < ${WORKDIR}/${MISCFILE} | tar xvvof -
  378.  
  379. $RM -rf /usr/include/const.h /usr/include/asm /usr/include/linux
  380.  
  381. echo installing ${KERNELINC}
  382. #tar xvvofz ${WORKDIR}/${KERNELINC}
  383. #zcat ${WORKDIR}/${KERNELINC} | tar xvvof -
  384. compress -d < ${WORKDIR}/${KERNELINC} | tar xvvof -
  385.  
  386. $RM -rf /usr/include/sys/asy.h
  387.  
  388. if [ ${VERSION} = xxxxx ]
  389. then
  390.   if [ ! -f ${LIBDIR}/cc1 -o ! -f ${LIBDIR}/cc1plus ]
  391.   then
  392.     if [ x${OLDLIBDIR}x = xx ]
  393.     then
  394.       echo While installing gcc 2.2.2d, you don't have cc1/cc1plus
  395.       echo and you don't have gcc 2.2.2. This installation script is
  396.       echo wrong. Please use
  397.       echo "    sh $0 -v verson [kernel src dir]"
  398.       echo "    Note: \"sh\" must be zsh or bash."
  399.       echo to see what is wrong and report it to hlu@eecs.wsu.edu.
  400.       echo Thanks.
  401.       exit 1
  402.     else
  403.       $HDLN ${OLDLIBDIR}/cc1 ${OLDLIBDIR}/cc1plus ${LIBDIR}
  404.     fi
  405.   fi
  406. fi
  407.  
  408. #checkfile $LIBDIR/lib$MATH.a
  409. checkfile $LIBDIR/lib$MATH.a \
  410.     $LIBDIR/cpp $JUMPLIBDIR/libc.so.${JUMP_RELEASE} \
  411.     $JUMPLIBDIR/lib${MATH}.so.${JUMP_RELEASE}
  412.  
  413. # not used
  414. #    $SHAREDLIBDIR/libc.${VERSION} 
  415. #    $SHAREDLIBDIR/lib${MATH}.${VERSION}
  416.  
  417. if [ -f $SHIMAGEDIR/libc.${VERSION} -o -f $SHIMAGEDIR/libm.${VERSION} ]
  418. then
  419.   echo There is a libc.${VERSION} or libm.${VERSION} in $SHIMAGEDIR.
  420.   echo Do you want to deleted them? [y/n]
  421.   read answer
  422.   if [ x${answer}x = "xyx" ]
  423.   then
  424.     $RM -f $SHIMAGEDIR/libc.${VERSION} $SHIMAGEDIR/libm.${VERSION}
  425.   else
  426.     echo Give up.
  427.     exit 1
  428.   fi
  429. fi
  430.  
  431. if [ -f $SHIMAGEDIR/libc.so.${JUMP_RELEASE} -o -f $SHIMAGEDIR/libm.so.${JUMP_RELEASE} ]
  432. then
  433.   echo There is a libc.so.${JUMP_RELEASE} or libm.so.${JUMP_RELEASE} in $SHIMAGEDIR.
  434.   echo Do you want to deleted them? [y/n]
  435.   read answer
  436.   if [ x${answer}x = "xyx" ]; then
  437.     $RM -f $SHIMAGEDIR/libc.so.${JUMP_RELEASE} $SHIMAGEDIR/libm.so.${JUMP_RELEASE}
  438.   else
  439.     echo Give up.
  440.     exit 1
  441.   fi
  442. fi
  443.  
  444. #echo moving the shared image.
  445. #$MV $SHAREDLIBDIR/libc.${VERSION} $SHIMAGEDIR
  446. #$MV $SHAREDLIBDIR/lib${MATH}.${VERSION} $SHIMAGEDIR/libm.${VERSION}
  447.  
  448. $RM -f $LIBDIR/libm.a
  449. $HDLN $LIBDIR/lib$MATH.a $LIBDIR/libm.a
  450. checkreturn "$HDLN $LIBDIR/lib$MATH.a $LIBDIR/libm.a"
  451.  
  452. #$HDLN $SHAREDLIBDIR/lib$MATH.a $SHAREDLIBDIR/libm.a
  453. #checkreturn "$HDLN $SHAREDLIBDIR/lib$MATH.a $SHAREDLIBDIR/libm.a"
  454.  
  455. echo install jump table.
  456. jumptable $JUMPLIBDIR $JUMP_VERSION $JUMP_RELEASE $MATH
  457.  
  458. $RM -rf /usr/lib/cpp /lib/cpp
  459.  
  460. $LN $LIBDIR/cpp /usr/lib/cpp
  461. checkreturn "$LN $LIBDIR/cpp /usr/lib/cpp"
  462. $LN $LIBDIR/cpp /lib/cpp
  463. checkreturn "$LN $LIBDIR/cpp /lib/cpp"
  464.  
  465. if [ -f /usr/include/stddef.h -o -f /usr/include/stdarg.h ]
  466. then
  467.   echo The version-dependent stddef.h and stdarg.h should not be in
  468.   echo /usr/include. Please take a look at
  469.   echo "    /usr/lib/gcc-lib/i386-linux/${VERSION}/include"
  470.   exit 1
  471. fi
  472.  
  473. if [ ! -f /usr/include/time.h ]
  474. then
  475.   echo You have to install ${KERNELINC} first!
  476.   exit 1
  477. fi
  478.  
  479. echo "Do you have kernel source on line? [y/n] "
  480. read MATH
  481. if [ $MATH = "n" ]
  482. then
  483.    echo Oops. gcc ${VERSION} needs at least the header files from
  484.    echo the kernel source, i.e. linux/include/linux.
  485.    exit 1
  486. fi
  487.  
  488. echo Ignore the error message.
  489.  
  490. $RM -rf ${KERNELSRCDIR}/include/*.h  ${KERNELSRCDIR}/include/sys
  491. if [ -f ${KERNELSRCDIR}/include/a.out.h ]
  492. then
  493.   echo 'Fail to clean ${KERNELSRCDIR}/include/*.h and'
  494.   echo '${KERNELSRCDIR}/include/sys.'
  495.   exit 1
  496. fi
  497.  
  498. checkdir ${KERNELSRCDIR}/include/asm ${KERNELSRCDIR}/include/linux
  499.  
  500. kernelstuff $WORKDIR $KERNELSRCDIR
  501.  
  502. $LN  ${KERNELSRCDIR}/include/asm /usr/include
  503. if [ $? != 0 ]
  504. then
  505.    echo Fail to make a link from ${KERNELSRCDIR}/include/asm to
  506.    echo /usr/include/asm.
  507.    exit 1
  508. fi
  509.  
  510. $LN ${KERNELSRCDIR}/include/linux /usr/include
  511. if [ $? != 0 ]
  512. then
  513.    echo Fail to make a link from ${KERNELSRCDIR}/include/linux to
  514.    echo /usr/include/linux.
  515.    exit 1
  516. fi
  517.  
  518. echo No more error messages.
  519.  
  520. echo Fixing the files.
  521. fixfiles ${VERBOSE} ${VERSION} "${BINS}"
  522.  
  523. # for future use
  524. # gcc -V 2.xxx will read this file.
  525. cd $LIBDIR
  526. chmod 755 /usr/bin/gcc
  527. /usr/bin/gcc -dumpspecs > specs
  528.  
  529. if [ $? != 0 ]
  530. then
  531.   echo Error during the installation of gcc ${VERSION}
  532.   exit 1
  533. fi
  534.  
  535. echo Done! gcc ${VERSION} has been installed.
  536. echo Please get rid of all the \"-nostdinc -I\" from Makefiles in
  537. echo kernel source and then do a fresh "make dep".
  538. --
  539. Mika Liljeberg            Email:    liljeber@kruuna.Helsinki.FI
  540. Helsinki University            Mika.Liljeberg@Helsinki.FI
  541. Dept. of Computer Science
  542.