1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
ifeq ($(DEB_HOST_ARCH_CPU), mipsel)
kfreebsd_cpu := mips
else
kfreebsd_cpu := $(DEB_HOST_ARCH_CPU)
endif
major=9
minor=0
HEADERS_PACKAGE := $(CURDIR)/debian/kfreebsd-kernel-headers
SRC_TAR := /usr/src/kfreebsd-source-$(major).$(minor).tar.xz
clean:
dh_testdir
dh_testroot
rm -rf .pc
rm -f *-stamp
rm -rf sys usr.sbin misc
$(MAKE) -C test clean
dh_clean
.PHONY: clean
build-indep:
build-arch: build-arch-stamp
build-arch-stamp:
dh_testdir
tar xfJ $(SRC_TAR) --wildcards --strip-components=1 "*.h"
mkdir -p misc
set -e ; \
find sys -type f | (while read i ; do \
sed -i $$i \
-e 's/defined\s*(\s*__FreeBSD__\s*)/1/g' \
-e 's/#\s*ifdef\s*__FreeBSD__\(\s\|$$\)/#if 1/g' \
-e 's/#\s*ifndef\s*__FreeBSD__\(\s\|$$\)/#if 0/g' \
-e 's/__FreeBSD__/$(major)/g' \
\
-e "s/__FreeBSD_version/__FreeBSD_kernel_version/g" \
\
-e 's/defined\s*(\s*__GNUCLIKE_[A-Z_]\+\s*)/1/g' \
-e 's/#\s*ifdef\s*__GNUCLIKE_[A-Z_]\+\(\s\|$$\)/#if defined(__GNUC__)/g' \
-e 's/#\s*ifndef\s*__GNUCLIKE_[A-Z_]\+\(\s\|$$\)/#if !defined(__GNUC__)/g' \
\
-e 's/defined\s*(\s*__CC_SUPPORTS_\(INLINE\|__INLINE\|__INLINE__\|__FUNC__\|WARNING\|VARADIC_XXX\|DYNAMIC_ARRAY_INIT\)\s*)/defined(__GNUC__)/g' \
-e 's/#\s*ifdef\s*__CC_SUPPORTS_\(INLINE\|__INLINE\|__INLINE__\|__FUNC__\|WARNING\|VARADIC_XXX\|DYNAMIC_ARRAY_INIT\)\(\s\|$$\)/#if defined(__GNUC__)/g' \
-e 's/#\s*ifndef\s*__CC_SUPPORTS_\(INLINE\|__INLINE\|__INLINE__\|__FUNC__\|WARNING\|VARADIC_XXX\|DYNAMIC_ARRAY_INIT\)\(\s\|$$\)/#if !defined(__GNUC__)/g' \
\
-e 's/__unused/__attribute__((__unused__))/g' \
-e 's/__packed\(\s\|;\)/ __attribute__((__packed__))\1/g' \
-e 's/__aligned(\([^)]*\?\))/ __attribute__((aligned(\1)))/g' \
-e 's/\(\s\|^\|(\)u_\(char\|int\|short\|long\)\(\s\)/\1unsigned \2\3/g' \
-e 's/__printflike(\([0-9]\+\),\s*\([0-9]\+\))/__attribute__((__format__ (__printf__, \1, \2)))/g' \
\
-e 's/defined\s*(\s*_SYS_CDEFS_H_\s*)/defined(_SYS_CDEFS_H)/g' \
-e 's/#\s*ifdef\s*_SYS_CDEFS_H_\(\s\|$$\)/#ifdef _SYS_CDEFS_H/g' \
-e 's/#\s*ifndef\s*_SYS_CDEFS_H_\(\s\|$$\)/#ifndef _SYS_CDEFS_H/g' \
\
-e 's/_SYS_QUEUE_H_/_FREEBSD_SYS_QUEUE_H_/g' \
\
-e 's/#\s*include\s\+<sys\/types\.h>\s*/#include <sys\/kern\/types.h>/g' \
-e 's/#\s*include\s\+<sys\/time\.h>\s*/#include <sys\/kern\/time.h>/g' \
-e 's/#\s*include\s\+<sys\/param\.h>\s*/#include <sys\/kern\/param.h>/g' \
-e 's/#\s*include\s\+<sys\/queue\.h>\s*/#include <sys\/kern\/queue.h>/g' \
-e 's/#\s*include\s\+<sys\/_termios\.h>\s*/#include <sys\/termios.h>/g' \
\
-e 's/__size_t/__this_is_a_temporary_kludge__size_t/g' $(shell ## see rev 184135 in GCC SVN ##) \
; done) ; \
echo "#include <sys/kern/param.h>" > misc/osreldate.h
QUILT_PATCHES=$(CURDIR)/debian/patches quilt push -a || test $$? = 2
touch $@
build: build-indep build-arch
.PHONY: build-indep build-arch build
install-indep: build-indep
install-arch: build-arch
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_install --sourcedir=$(CURDIR)
ifneq ($(filter amd64, $(kfreebsd_cpu)),)
sh debian/generate-asm.sh $(kfreebsd_cpu) $(CURDIR)/sys $(HEADERS_PACKAGE)/usr/include
else
mkdir -p $(HEADERS_PACKAGE)/usr/include/machine
cd $(CURDIR)/sys/$(kfreebsd_cpu)/include \
&& find . -type f -name "*.h" -exec cp --parents {} $(HEADERS_PACKAGE)/usr/include/machine \;
endif
ifneq ($(filter i386 amd64, $(kfreebsd_cpu)),)
# Install "x86" directory (only on i386 and amd64).
mkdir -p $(HEADERS_PACKAGE)/usr/include/x86
cd $(CURDIR)/sys/x86/include \
&& find . -type f -name "*.h" -exec cp --parents {} $(HEADERS_PACKAGE)/usr/include/x86 \;
endif
# headers must be tested after they're installed
$(MAKE) -C test
install: install-indep install-arch
.PHONY: install-indep install-arch install
# Build architecture-independent files here.
binary-indep: install-indep
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: install-arch
dh_testdir
dh_testroot
dh_installdocs
# dh_installman
dh_installchangelogs
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: binary-indep binary-arch binary
|