# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../tzdata/tzdata.conf
# Copyright (C) 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

custextract='tzcode_extract'
hook_add prepatch 5 'tzdata_extract'

tzcode_extract() {
	local taropt_orig="$taropt"
	mkdir -p "${xsrctar%%.*}"
	taropt="-C ${xsrctar%%.*} $taropt_orig"
	autoextract_tar_bz2 "$@"
	taropt="$taropt_orig"
}

tzdata_extract() {
	echo_status 'extracting tzdata'
	tar -v $taropt $( match_source_file -p tzdata )
}

# they add some options when setting CC in the Makefile, we have to override $(cc)
makeopt="cc=$CC AWK=$AWK RANLIB=$RANLIB"
# use `zic` from the PATH, instead of the just compiled one
var_append makeopt ' ' 'zic=zic'

var_append makeopt ' ' "TOPDIR=/$prefix"
var_append makeopt ' ' "ETCDIR=$sbindir"	# no, this is not a typo
var_append makeopt ' ' "TZDIR=$datadir/zoneinfo"

makeinstopt="$makeopt DESTDIR=$root install"