1
2DIRS="cpu disk docker host load mem net process"
3
4GOOS=`uname | tr '[:upper:]' '[:lower:]'`
5ARCH=`uname -m`
6
7case $ARCH in
8	amd64)
9		GOARCH="amd64"
10		;;
11	x86_64)
12		GOARCH="amd64"
13		;;
14	i386)
15		GOARCH="386"
16		;;
17	i686)
18		GOARCH="386"
19		;;
20	arm)
21		GOARCH="arm"
22		;;
23	arm64)
24		GOARCH="arm64"
25		;;
26	*)
27		echo "unknown arch: $ARCH"
28		exit 1
29esac
30
31for DIR in $DIRS
32do
33	if [ -e ${DIR}/types_${GOOS}.go ]; then
34		echo "// +build $GOOS" > ${DIR}/${DIR}_${GOOS}_${GOARCH}.go
35		echo "// +build $GOARCH" >> ${DIR}/${DIR}_${GOOS}_${GOARCH}.go
36		go tool cgo -godefs ${DIR}/types_${GOOS}.go >> ${DIR}/${DIR}_${GOOS}_${GOARCH}.go
37	fi
38done
39
40
41