# -*- coding: ascii; tab-width: 4 -*-
Package: byteswap-dev
Version: 20091128
Revision: 2
Type: nosource
Description: Linux-style byteswap.h header file
DescDetail: <<
	Some packages assume that all systems have a Linux-style
	byteswap.h header file defining the macros bswap_16(),
	bswap_32() and bswap_64(). Since Mac OS X doesn't have this,
	we create a byteswap.h that maps those macros to the OS X
	equivalents.
<<
DescUsage: <<
	To use, BuildDepend on %n and add -I%%p/lib/%n to CPPFLAGS.
<<
License: Public Domain
Maintainer: Daniel Johnson <daniel@daniel-johnson.org>

BuildDependsOnly: true

CompileScript: <<
	#!/bin/bash -ev
	cat >byteswap.h <<EOF
/*
  This is a simple compatibility shim to convert
  Linux byte swap macros to the Mac OS X equivalents.
  It is public domain.
*/

#include <libkern/OSByteOrder.h>

#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
EOF
<<

InstallScript: <<
	install -d %i/lib/%n/linux
	install -m 0644 byteswap.h %i/lib/%n
	ln -s %p/lib/%n/byteswap.h %i/lib/%n/linux/byteswap.h
<<