#!/bin/bash

source /usr/share/slackdev/buildkit.sh

# Package metadata:
export PKGNAM=glibc
export VERSION=${VERSION:-2.33}
export BUILD=${BUILD:-4}
export PKGSERIES=${PKGSERIES:-l}
export SLACKPACKAGE=$PKGNAM-$VERSION-$PKGARCH-$BUILD.txz

# If building within /patches, we'll drop the packages in to their respective
# 'series' directories within /tmp:
slack_findpkgstore_is_stablerelease && {
  export PKGSTORE=/tmp/
  # Since we have packages in both series
  mkdir -vpm755 $PKGSTORE/{a,l} ;}

# Ensure base ARM packages are installed first:
slackbasedeps

# We require ARMedslack's kernel-header package to be installed
# This package replaces Scratchbox's 2.6's headers which RMK stated
# on the armlinux mailing list, cause gcc3.3.2 build failure.
# Ensure the kernel headers package is installed:
# 17-May-2005: Note - for glibc-2.3.5 I have two pre-made 2.4 & 2.6 header
#              archives, so I don't need to faff around with these anymore as
#              there's no chance that my header archives will become polluted
#              during package building (which was the purpose of the code below).
#removepkg kernel-headers
#( cd /usr/include
#  rm -rf linux asm-arm asm-generic asm
#  slackcheckpkgdeps kernel-headers || installpkg $PKGSTORE/d/kernel-headers-*.t?z
#  # This isn't necessary, but I like to reassure myself:
#  ln -s asm asm-arm )
#
# I used to do this when I'd previously been making broken kernel-headers & wanted
# to make sure I had the most recent working version.
# You still need working system-wide kernel headers for the compiler to work.
# This just ensures that you have the pukka headers installed.
# It's probably not needed since I tend not to do any friggin' in the riggin'
# with this stuff anymore, but for old time's sake:
#removepkg kernel-headers
#installpkg $PKGSTORE/d/kernel-headers*t?z

# Launch the package build script:
BUILDLOG=$SLKPORTARCH-$( basename $SLACKPACKAGE .t?z ).build.log
( ./$PKGNAM.SlackBuild ) >& /dev/stdout | tee $BUILDLOG

# Compress the build log:
bzip2 -9fvz $BUILDLOG

