#!/usr/bin/env bash

set -e
set -o pipefail

gen_pkg()
{
	echo "prefix=$prefix
libdir=$libdir
includedir=$includedir
ldscriptdir=$ldscriptdir

Name: toslibc
Description: 32-bit C standard library for Atari TOS
Version: ${TOSLIBC_VERSION_MINOR}"'

Libs: -L${libdir} -lc '"${TOSLIBC_PROGRAM_BASIC_LDFLAGS}"' --script=${ldscriptdir}/prg.ld
Cflags: -isystem ${includedir} '"${TOSLIBC_PROGRAM_BASIC_CFLAGS}"
}

if [ $# = 1 ]
then
	gen_pkg >"$1".tmp
	mv "$1".tmp "$1"
else
	gen_pkg
fi
