aboutsummaryrefslogtreecommitdiff
path: root/patches/lm_sensors/lm_sensors.SlackBuild
blob: 3bb6073a024fdc18ce430a9090272566e9e801a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
#
#  lm_sensors.SlackBuild is free software; you can redistribute it and/or modify it under the
#  terms of the GNU General Public License as published by the Free Software
#  Foundation; either version 2 of the License, or any later version.
#
#  lm_sensors.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
#  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License along with
#  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
#  Place - Suite 330, Boston, MA 02111-1307, USA
#
# slackbuild for lm_sensors
#

if [ -s "slack-required" ]; then
  echo Recomended and required packages for building lm_sensors are:
  cat slack-required | sed -e 's/^/\t/'
  if [ "$INTERACT" != "no" ]; then
    echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER.
    read crap
#  else
#    echo Sleeping 3 seconds...
#    sleep 3
  fi
fi

CWD=`pwd`

if [ -f ~/.slackbuildrc ]; then
  source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
  source /etc/slackbuildrc
fi

# default settings
PRGNAM="lm_sensors"
PACKAGE="$PRGNAM"
ARCH=${ARCH:=i486}
VERSION=${VERSION:=3.0.0}
BUILD=${BUILD:=3rha}
SRC_DIR=${SRC:=$CWD}
TMP=${TMP:=/tmp}
REPOS=${REPOS:=$TMP}

# -------  error codes for createpkg  --------------
ERROR_WGET=31;      ERROR_MAKE=32;      ERROR_INSTALL=33
ERROR_MD5=34;       ERROR_CONF=35;      ERROR_HELP=36
ERROR_TAR=37;       ERROR_MKPKG=38;     ERROR_GPG=39
ERROR_PATCH=40

PACKAGE_EXT="gz"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
URL="http://dl.lm-sensors.org/lm-sensors/releases/$SRC"

RTOOL="wget"

gpg --import << EOPGP
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 5.0i for non-commercial use

mQCNAzaeL3sAAAEEAL7roqireHxJ43Xo1oOWAUbba5DVfQX8Cnv99I1VQ1suFxVn
HWpWjlI0BUaMZzP9JF9F/xZhpd9dyjj3giuFReyj8Qk5e6Q0eSWSL+0CADi9Pesm
zQQt4GmPpDfLKbzFUWCUNbB5vAC8p9Fj2frHBqcF7z3AR3u+3h8uYrXvyThJAAUR
tCVQaGlsaXAgRWRlbGJyb2NrIDxwaGlsQG5ldHJvZWRnZS5jb20+iQCVAwUQNp4v
ex8uYrXvyThJAQEJFwP+IED7wi0Spa1KpVp9ywK9r7Fu7WLUhv0stD2GlFL+USa7
UTB0XuFXuOFVVNtBauj5a1morjVGIcwYkJ4prTLYe+ok+AjfeCjodPxzrSqPgf3n
xbQqRg0vMCxIHHBP8dv2guEBii06GhvculveSvvyOZGEKLAV6btKXvIxJI7yRHU=
=Mzd5
-----END PGP PUBLIC KEY BLOCK-----

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 5.0i for non-commercial use

mQGiBDfK4agRBADvyYYefBEaVxx7plH0qJayzZIEjJOjBwsDZl5HWfx+XbZrtGzg
ouhbw+a9vcA5birNt7GhlM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YlLIhkmuquiXsNV6TILOwACAgf/YDv43LHUBX4wGkVbLJ2DU8tOAp5Od0pxXaUF
FMGzTuR3W5IdS9YjTo9NdE6DlsX34yU1iLTyjnqApDfu2Uz2oeM1RULYmK9srA2M
LZoDAiVtwsqRX5x0QlkdrDn6ngZMnfe9n8d3fxxqC6wtI+EpXUEk+G4hafowyM2j
ogibnD8TGwjCFD5OQSG50yRCEykZez3thX2jRrlZLRhhtU1eb2GbJ7NMoFoAH079
me+8kspMvYaPAQg/vpml89BNWmdu3OdtR7qFO9vNbDRFJMZLIucC6sWWMPSXltcI
rOHdFtnux8OxY+57juMgkOR5JsyY1WizxmWgIAptLv7KlLYkiokAPwMFGDfK4ajg
olc3ZSNq1REC58kAoLyb4jp4/9/QUEQrFFmyy4M/65xuAKCnpPd37PhwQn0kLIlo
BP7wPk2BgQ==
=l+kY
-----END PGP PUBLIC KEY BLOCK-----
EOPGP

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
 wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET
 wget "$URL.asc" -O "$SRC_DIR/$SRC.asc" || exit $ERROR_WGET
fi

gpg --verify $SRC_DIR/$SRC.asc $SRC_DIR/$SRC || exit $ERROR_GPG

TMP="$TMP/$PACKAGE"
rm -rf $TMP
mkdir -p $TMP
cd $TMP

rm -rf $PACKAGE-$VERSION $PACKAGE-$VERSION-$ARCH-$BUILD.tgz

tar xvf $SRC_DIR/$PACKAGE-$VERSION.tar.$PACKAGE_EXT || exit $ERROR_TAR
cd $PACKAGE-$VERSION

sed -e 's/^I2C_HEADERS := \/usr\/local\/include/I2C_HEADERS := \/usr\/include/' \
    -e 's/^PREFIX := \/usr\/local/PREFIX := \/usr/' Makefile > Makefile.new

if [ "$ARCH" == "x86_64" ]; then
  sed -e 's/LIBDIR := $(PREFIX)\/lib/LIBDIR := $(PREFIX)\/lib64/' Makefile.new > Makefile
else
  mv Makefile.new Makefile
fi

make user || exit $ERROR_MAKE
make DESTDIR=$TMP/package-$PACKAGE user_install || exit $ERROR_INSTALL

CWD="`pwd`"

mkdir -p $TMP/package-$PACKAGE/install
cd $TMP/package-$PACKAGE

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

cat << EOF > install/slack-desc
# 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-----------------------------------------------------|
lm_sensors: lm_sensors (Linux sensors drivers and hardware monitoring tools)
lm_sensors:
lm_sensors: lm_sensors provides essential drivers for monitoring the
lm_sensors: temperatures, voltages, and fans of Linux systems with hardware
lm_sensors: monitoring devices. It contains Linux 2.4 drivers for sensor chips
lm_sensors: and I2C and SMBus masters, text-based tools for sensor reporting,
lm_sensors: and a library for sensors access called "libsensors". It also
lm_sensors: contains tools for sensor hardware identification and I2C bus probing.
lm_sensors:
lm_sensors:
lm_sensors:
EOF

# config
if [ -f "etc/sensors.conf" ]; then
  mv etc/sensors.conf etc/sensors.conf.new
fi

if [ -f "etc/sensors3.conf" ]; then
  mv etc/sensors3.conf etc/sensors.conf.new
fi

# docs
mkdir -p usr/doc/$PACKAGE-$VERSION
cp $CWD/{BACKGROUND,BUGS,CHANGES,CONTRIBUTORS,COPYING,INSTALL,QUICKSTART,README,README.thinkpad,TODO} usr/doc/$PACKAGE-$VERSION/

makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi