189
190 #############################################################################
191 # URL encoding for package names, at least
192 #############################################################################
193 # This isn't real URL encoding, just a couple of common substitutions
194 url_encode() {
195 [ $# -lt 1 ] && logerr "Not enough arguments to url_encode(). Expecting a string to encode."
196 local encoded="$1";
197 encoded=`echo $encoded | sed -e 's!/!%2F!g' -e 's!+!%2B!g'`
198 encoded=`echo $encoded | sed -e 's/%../_/g;'`
199 echo $encoded
200 }
201
202 #############################################################################
203 # Some initialization
204 #############################################################################
205 # Set the LANG to C as the assembler will freak out on unicode in headers
206 LANG=C
207 export LANG
208 # Set the path - This can be overriden/extended in the build script
209 PATH="/opt/gcc-4.8.1/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/gnu/bin:/usr/sfw/bin"
210 export PATH
211 # The dir where this file is located - used for sourcing further files
212 MYDIR=$PWD/`dirname $BASH_SOURCE[0]`
213 # The dir where this file was sourced from - this will be the directory of the
214 # build script
215 SRCDIR=$PWD/`dirname $0`
216
217 #############################################################################
218 # Load configuration options
219 #############################################################################
220 . $MYDIR/config.sh
221 . $MYDIR/site.sh
222
223 # Platform information
224 SUNOSVER=`uname -r` # e.g. 5.11
225
226 if [[ -f $LOGFILE ]]; then
227 mv $LOGFILE $LOGFILE.1
228 fi
229 process_opts $@
230 shift $((OPTIND - 1))
231
232 BasicRequirements(){
233 local needed=""
234 [[ -x /opt/gcc-4.8.1/bin/gcc ]] || needed+=" developer/gcc48"
235 [[ -x /usr/bin/ar ]] || needed+=" developer/object-file"
236 [[ -x /usr/bin/ld ]] || needed+=" developer/linker"
237 [[ -f /usr/lib/crt1.o ]] || needed+=" developer/library/lint"
238 [[ -x /usr/bin/gmake ]] || needed+=" developer/build/gnu-make"
239 [[ -f /usr/include/sys/types.h ]] || needed+=" system/header"
240 [[ -f /usr/include/math.h ]] || needed+=" system/library/math"
241 if [[ -n "$needed" ]]; then
242 logmsg "You appear to be missing some basic build requirements."
243 logmsg "To fix this run:"
244 logmsg " "
245 logmsg " sudo pkg install$needed"
246 if [[ -n "$BATCH" ]]; then
247 logmsg "===== Build aborted ====="
248 exit 1
249 fi
250 echo
251 for i in "$needed"; do
252 ask_to_install $i "--- Build-time dependency $i not found"
253 done
254 fi
367 i=${i:1}
368 pkg info $i > /dev/null 2<&1 &&
369 logerr "--- $i cannot be installed while building this package."
370 continue
371 ;;
372 esac
373 pkg info $i > /dev/null 2<&1 ||
374 ask_to_install "$i" "--- Build-time dependency $i not found"
375 done
376 }
377
378 #############################################################################
379 # People that need this should call it explicitly
380 #############################################################################
381 run_autoconf() {
382 logmsg "Running autoconf"
383 pushd $TMPDIR/$BUILDDIR > /dev/null
384 logcmd autoconf || logerr "Failed to run autoconf"
385 popd > /dev/null
386 }
387
388 #############################################################################
389 # Stuff that needs to be done/set before we start building
390 #############################################################################
391 prep_build() {
392 logmsg "Preparing for build"
393
394 # Get the current date/time for the package timestamp
395 DATETIME=`TZ=UTC /usr/bin/date +"%Y%m%dT%H%M%SZ"`
396
397 logmsg "--- Creating temporary install dir"
398 # We might need to encode some special chars
399 PKGE=$(url_encode $PKG)
400 # For DESTDIR the '%' can cause problems for some install scripts
401 PKGD=${PKGE//%/_}
402 DESTDIR=$DTMPDIR/${PKGD}_pkg
403 if [[ -z $DONT_REMOVE_INSTALL_DIR ]]; then
404 logcmd chmod -R u+w $DESTDIR > /dev/null 2>&1
405 logcmd rm -rf $DESTDIR || \
406 logerr "Failed to remove old temporary install dir"
|
189
190 #############################################################################
191 # URL encoding for package names, at least
192 #############################################################################
193 # This isn't real URL encoding, just a couple of common substitutions
194 url_encode() {
195 [ $# -lt 1 ] && logerr "Not enough arguments to url_encode(). Expecting a string to encode."
196 local encoded="$1";
197 encoded=`echo $encoded | sed -e 's!/!%2F!g' -e 's!+!%2B!g'`
198 encoded=`echo $encoded | sed -e 's/%../_/g;'`
199 echo $encoded
200 }
201
202 #############################################################################
203 # Some initialization
204 #############################################################################
205 # Set the LANG to C as the assembler will freak out on unicode in headers
206 LANG=C
207 export LANG
208 # Set the path - This can be overriden/extended in the build script
209 PATH="/opt/gcc-5.1.0/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/gnu/bin:/usr/sfw/bin"
210 export PATH
211 # The dir where this file is located - used for sourcing further files
212 MYDIR=$PWD/`dirname $BASH_SOURCE[0]`
213 # The dir where this file was sourced from - this will be the directory of the
214 # build script
215 SRCDIR=$PWD/`dirname $0`
216
217 #############################################################################
218 # Load configuration options
219 #############################################################################
220 . $MYDIR/config.sh
221 . $MYDIR/site.sh
222
223 # Platform information
224 SUNOSVER=`uname -r` # e.g. 5.11
225
226 if [[ -f $LOGFILE ]]; then
227 mv $LOGFILE $LOGFILE.1
228 fi
229 process_opts $@
230 shift $((OPTIND - 1))
231
232 BasicRequirements(){
233 local needed=""
234 [[ -x /opt/gcc-5.1.0/bin/gcc ]] || needed+=" developer/gcc51"
235 [[ -x /usr/bin/ar ]] || needed+=" developer/object-file"
236 [[ -x /usr/bin/ld ]] || needed+=" developer/linker"
237 [[ -f /usr/lib/crt1.o ]] || needed+=" developer/library/lint"
238 [[ -x /usr/bin/gmake ]] || needed+=" developer/build/gnu-make"
239 [[ -f /usr/include/sys/types.h ]] || needed+=" system/header"
240 [[ -f /usr/include/math.h ]] || needed+=" system/library/math"
241 if [[ -n "$needed" ]]; then
242 logmsg "You appear to be missing some basic build requirements."
243 logmsg "To fix this run:"
244 logmsg " "
245 logmsg " sudo pkg install$needed"
246 if [[ -n "$BATCH" ]]; then
247 logmsg "===== Build aborted ====="
248 exit 1
249 fi
250 echo
251 for i in "$needed"; do
252 ask_to_install $i "--- Build-time dependency $i not found"
253 done
254 fi
367 i=${i:1}
368 pkg info $i > /dev/null 2<&1 &&
369 logerr "--- $i cannot be installed while building this package."
370 continue
371 ;;
372 esac
373 pkg info $i > /dev/null 2<&1 ||
374 ask_to_install "$i" "--- Build-time dependency $i not found"
375 done
376 }
377
378 #############################################################################
379 # People that need this should call it explicitly
380 #############################################################################
381 run_autoconf() {
382 logmsg "Running autoconf"
383 pushd $TMPDIR/$BUILDDIR > /dev/null
384 logcmd autoconf || logerr "Failed to run autoconf"
385 popd > /dev/null
386 }
387
388 #############################################################################
389 # People that need this should call it explicitly
390 #############################################################################
391 run_automake() {
392 logmsg "Running automake"
393 pushd $TMPDIR/$BUILDDIR > /dev/null
394 logcmd automake || logerr "Failed to run automake"
395 popd > /dev/null
396 }
397
398 #############################################################################
399 # Stuff that needs to be done/set before we start building
400 #############################################################################
401 prep_build() {
402 logmsg "Preparing for build"
403
404 # Get the current date/time for the package timestamp
405 DATETIME=`TZ=UTC /usr/bin/date +"%Y%m%dT%H%M%SZ"`
406
407 logmsg "--- Creating temporary install dir"
408 # We might need to encode some special chars
409 PKGE=$(url_encode $PKG)
410 # For DESTDIR the '%' can cause problems for some install scripts
411 PKGD=${PKGE//%/_}
412 DESTDIR=$DTMPDIR/${PKGD}_pkg
413 if [[ -z $DONT_REMOVE_INSTALL_DIR ]]; then
414 logcmd chmod -R u+w $DESTDIR > /dev/null 2>&1
415 logcmd rm -rf $DESTDIR || \
416 logerr "Failed to remove old temporary install dir"
|