#!/bin/sh -x # build script for lsof # built on tc-7.x set -o nounset set -o errexit . /etc/init.d/tc-functions ################################################################################################### ################################################################################################### # Downloads # ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.89.tar.bz2 # download the above src file, extract and run this script from the src directory ################################################################################################### kerarch=$(uname -m) kerbuild=$(uname -r) arch=$(getBuild) ## load build deps tcepath="/etc/sysconfig/tcedir/optional" tceinstalled=/usr/local/tce.installed echo -e "\n\nFetching build dependencies... " deps="compiletc.tcz \ intltool.tcz \ glib2-dev.tcz \ autogen-dev.tcz \ libtool-dev.tcz \ automake.tcz \ pkg-config.tcz \ gzip.tcz \ bzip2-lib.tcz \ xdg-utils.tcz" for i in `echo $deps`; do pkgname=`basename "$i" .tcz` # check if tcz installed already if [ -f ${tceinstalled}/"$pkgname" ]; then echo "${WHITE}"$i" ${GREEN}Already loaded${NORMAL}" else if [ ! -f ${tceinstalled}/"$pkgname" ]; then # tcz not installed, then install from local path if [ -f ${tcepath}/"$i" ]; then while [ ! -f ${tceinstalled}/"$pkgname" ]; do tce-load -i "$pkgname"; sleep 0.5 done if [ -f ${tceinstalled}/"$pkgname" ]; then echo "${CYAN}"$i" ${BLUE}loaded locally${NORMAL}" fi # tcz not downloaded, install from repo elif [ ! -f ${tcepath}/"$i" ]; then tce-load -wil "$pkgname"; sleep 0.5 if [ -f ${tceinstalled}/"$pkgname" ]; then echo "${MAGENTA}"$i" ${YELLOW}downloaded from repo${NORMAL}" fi fi fi fi if [ ! -f "${tceinstalled}/$pkgname" ]; then echo "${RED}$i failed to load, exiting..${NORMAL}"; exit 1 fi done ################################################################################################### arch=$(getBuild) set +x; echo -e "\n\n ${BLUE}Export compiler flags... ${NORMAL}"; set -x if [ "x$arch" == xx86_64 ]; then # x86_64 echo "compile flags for $kerarch" export CFLAGS="-mtune=generic -Os -pipe" export CXXFLAGS="-mtune=generic -Os -pipe -fno-exceptions -fno-rtti" else # x86 echo "compile flags for $kerarch" export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe" fi find . -name Makefile -type f -exec sed -i 's/-O2//g' {} \; ./Configure linux make -j3 sudo strip --strip-debug --strip-unneeded lsof exit 2