LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-31-2010, 03:49 PM   #1
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Cool SlackBuild to make both STATIC and SHARED wireless-tools package.


I don't use wireless tools myself currently, since I'm wired to the internet; but, I found that a package I wanted to build, required at the least, a shared version of libiw, if not both the shared AND static version.

Symptoms of when you are in this boat, are error messages during compiling, similar to:

Code:
/usr/lib64/libiw.a(iwlib.so): In function `iw_mwatt2dbm':
iwlib.c:(.text+0x1a77): undefined reference to `log10'
iwlib.c:(.text+0x1a84): undefined reference to `ceil'
/usr/lib64/libiw.a(iwlib.so): In function `iw_freq2float':
iwlib.c:(.text+0x1b11): undefined reference to `pow'
/usr/lib64/libiw.a(iwlib.so): In function `iw_dbm2mwatt':
iwlib.c:(.text+0x2254): undefined reference to `pow'
iwlib.c:(.text+0x2259): undefined reference to `trunc'
/usr/lib64/libiw.a(iwlib.so): In function `iw_float2freq':
iwlib.c:(.text+0x2272): undefined reference to `log10'
iwlib.c:(.text+0x2277): undefined reference to `floor'
iwlib.c:(.text+0x229a): undefined reference to `pow'
iwlib.c:(.text+0x22ac): undefined reference to `floor'
collect2: ld returned 1 exit status
make: *** [i3status] Error 1
make: *** Waiting for unfinished jobs....
Anyhow, here is a modified SlackBuild, based on the one I have here on my Slack64 DVD (from when 13/64 first came out) which I've modified to build both a static & a shared wireless-tools package.
You'll need these new slack-desc files too, since I adjusted the package name slightly.
Enjoy, I hope someone else can use these too.

Code:
#!/bin/sh

# Copyright 2008, 2009  Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# This is the Slack13-64 SlackBuild for wireless-tools version 29.0
# Modified by GrapefruiTgirl:
# modified 2010 Jan 30 or so, to build two packages, one static, one shared.
# Installing them in either order will overwrite the first one installed
# which is OK because they both contain exactly the same stuff, only the
# shared package contains the shared lib and symlink, instead of the libiw.a
# static lib. So, installing both packages results in both a static, and a
# shared, library installed.
# Why?? Some things want to build against libiw, but can't, if there's no
# shared library. Example: i3status, a tool associated with i3 window manager.
# Is there a better way to do this? Sure! But I wanted this _now_ and it works.

VERSION=29
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-5}

if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi

CWD=$(pwd)
TMP=${TMP:-/tmp}

main () {
  PKG=$TMP/package-wireless-tools-$1
  rm -rf $PKG
  mkdir -p $TMP $PKG
  cd $TMP

  rm -rf wireless_tools.$VERSION
  tar xvf $CWD/wireless_tools.$VERSION.tar.gz || exit 1
  cd wireless_tools.$VERSION
  zcat $CWD/wireless_tools.nowhine.diff.gz | patch -p1 --verbose --suffix=.orig --backup || exit 1
  if [ "$1" = "static" ]; then
     zcat $CWD/wireless_tools.static.diff.gz | patch -p1 --verbose --suffix=.orig --backup || exit 1
  fi;
  chown -R root:root .
  find . \
    \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
    -exec chmod 755 {} \; -o \
    \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
    -exec chmod 644 {} \;

  make || exit 1

  mkdir -p $PKG/sbin
  cp -a ifrename iwconfig iwevent iwgetid iwlist iwpriv iwspy $PKG/sbin
  chmod 755 $PKG/sbin/*
  # The library seems to be used by kdenetwork, but since the .soname in the shared library
  # doesn't seem to be forward-thinking we'll leave that out still:
  mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}

  [ -e libiw.a ] && cp -a libiw.a $PKG/usr/lib${LIBDIRSUFFIX}
  if [ -e libiw.so.29 ]; then
    cp -a libiw.so.29 $PKG/usr/lib${LIBDIRSUFFIX}
    ln -sf $PKG/usr/lib${LIBDIRSUFFIX}/libiw.so.29 $PKG/usr/lib${LIBDIRSUFFIX}/libiw.so
  fi;

  find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
    | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

  mkdir -p $PKG/usr/include
  cp -a iwlib.h wireless.h $PKG/usr/include
  chmod 644 $PKG/usr/include/*.h

  mkdir -p $PKG/usr/man/man5
  cat iftab.5 | gzip -9c > $PKG/usr/man/man5/iftab.5.gz
  mkdir -p $PKG/usr/man/man7
  cat wireless.7 | gzip -9c > $PKG/usr/man/man7/wireless.7.gz
  mkdir -p $PKG/usr/man/man8
  for file in *.8 ; do
    cat $file | gzip -9c > $PKG/usr/man/man8/$file.gz
  done

  mkdir -p $PKG/usr/doc/wireless-tools-$VERSION
  cp -a \
    COPYING INSTALL *.txt README* \
    $PKG/usr/doc/wireless-tools-$VERSION
  chmod 644 $PKG/usr/doc/wireless-tools-$VERSION/*

  # Add init scripts from Eric Hameleers:
  mkdir -p $PKG/etc/rc.d
  cat $CWD/scripts/rc.wireless > $PKG/etc/rc.d/rc.wireless.new
  chmod 755 $PKG/etc/rc.d/rc.wireless.new
  # This might contain a secret key, so we'll use chmod 600:
  cat $CWD/scripts/rc.wireless.conf > $PKG/etc/rc.d/rc.wireless.conf.new
  chmod 600 $PKG/etc/rc.d/rc.wireless.conf.new

  mkdir $PKG/install
  cat $CWD/slack-desc-$1 > $PKG/install/slack-desc
  zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
} # end of main()

# call function to build STATIC version
main static
cd $PKG
/sbin/makepkg -l y -c n $TMP/wirelesstools-static-$VERSION-$ARCH-$BUILD.txz

cd $CWD

# call function to build SHARED version
main shared
cd $PKG
/sbin/makepkg -l y -c n $TMP/wirelesstools-shared-$VERSION-$ARCH-$BUILD.txz
The slack-desc files:
Code:
root@reactor: cat slack-desc-static                
# HOW TO EDIT THIS FILE:                                                                 
# The "handy ruler" below makes it easier to edit a package description.  Line           
# up the first '|' above the ':' following the base package name, and the '|'            
# on the right side marks the last column you can put a character in.  You must          
# make exactly 11 lines for the formatting to be correct.  It's also                     
# customary to leave one space after the ':'.                                            

                    |-----handy-ruler------------------------------------------------------|
wirelesstools-static: wireless-tools (utilities for wireless networking)                    
wirelesstools-static: This package contains tools and a library used for configuring        
wirelesstools-static: wireless networking interfaces:
wirelesstools-static:   iwconfig (the main wireless tool),  iwlist (display more detailed
wirelesstools-static:   information than iwconfig),  iwspy (get stats per MAC address and
wirelesstools-static:   more),  iwpriv (set driver private ioctls),  iwgetid (show the
wirelesstools-static:   ESSID or NWID of a device),  iwevent (display wireless events),
wirelesstools-static:   ifrename (rename a network interface).
wirelesstools-static: Compiled as a static library.
wirelesstools-static: Wireless tools written by Jean Tourrilhes.
wirelesstools-static:
root@reactor:
root@reactor: cat slack-desc-shared
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

                    |-----handy-ruler------------------------------------------------------|
wirelesstools-shared: wireless-tools (utilities for wireless networking)
wirelesstools-shared: This package contains tools and a library used for configuring
wirelesstools-shared: wireless networking interfaces:
wirelesstools-shared:   iwconfig (the main wireless tool),  iwlist (display more detailed
wirelesstools-shared:   information than iwconfig),  iwspy (get stats per MAC address and
wirelesstools-shared:   more),  iwpriv (set driver private ioctls),  iwgetid (show the
wirelesstools-shared:   ESSID or NWID of a device),  iwevent (display wireless events),
wirelesstools-shared:   ifrename (rename a network interface).
wirelesstools-shared: Compiled as a shared library.
wirelesstools-shared: Wireless tools written by Jean Tourrilhes.
wirelesstools-shared:
root@reactor:

Last edited by GrapefruiTgirl; 01-31-2010 at 03:52 PM.
 
Old 01-31-2010, 05:06 PM   #2
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Useful, thanks :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make shared library form static libraries (pjsip) Rostfrei Programming 3 08-30-2011 11:01 AM
Any Interest in a SlackBuild for The Generic Mapping Tools tronayne Slackware 5 01-19-2010 07:39 PM
slackbuild vrs configure-make-make install garyg007 Slackware 12 12-21-2008 10:27 PM
wireless-tools package? brandonloserkid Linux - Wireless Networking 18 01-21-2004 05:39 PM
wireless tools package Indieguy Linux - Wireless Networking 3 03-08-2003 05:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration