rules 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. #!/usr/bin/make -f
  2. # Sample debian/rules that uses debhelper.
  3. # GNU copyright 1997 to 1999 by Joey Hess.
  4. # Uncomment this to turn on verbose mode.
  5. #export DH_VERBOSE=1
  6. # This is the debhelper compatability version to use.
  7. export DH_COMPAT=1
  8. #include version
  9. major=$(shell grep '^MAJOR_VERSION' Rules.mak|sed 's/.*=//')
  10. minor=$(shell grep '^MINOR_VERSION' Rules.mak|sed 's/.*=//')
  11. version:=$(strip $(major)).$(strip $(minor))
  12. kernel_version=2.4.18
  13. kernel_source=kernel-source-$(kernel_version)
  14. target=$(DEB_HOST_GNU_CPU)
  15. #target=arm
  16. with_shared_libs=y
  17. #ifeq ($(target),powerpc)
  18. #with_shared_libs=n
  19. #endif
  20. ifeq ($(with_shared_libs),y)
  21. shared_libs_true=true
  22. else
  23. shared_libs_true=false
  24. endif
  25. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  26. target_suffix=-$(target)
  27. endif
  28. ifneq ($(target),mipsel)
  29. config_orig = extra/Configs/Config.$(target)
  30. else
  31. config_orig = extra/Configs/Config.mips
  32. endif
  33. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  34. cross_options = --cross="$(target)-linux-"
  35. else
  36. cross_options = --cross=""
  37. endif
  38. p_dev=libuclibc-dev$(target_suffix)
  39. p_lib=libuclibc0$(target_suffix)
  40. p_gcc=uclibc$(target_suffix)-toolchain
  41. debian/control: debian/control.in debian/rules
  42. sed -e s/_TARGET_/$(target_suffix)/ \
  43. -e "s/_ARCHS_/arm i386 m68k mips mipsel powerpc sh sparc/" \
  44. -e "s/_KERNEL_/$(kernel_source)/" \
  45. debian/control.in >debian/control
  46. build: build-stamp
  47. build-stamp: debian/control
  48. dh_testdir
  49. # Brute force method of getting kernel headers
  50. tar --bzip2 -xf /usr/src/$(kernel_source).tar.bz2 \
  51. $(kernel_source)/include
  52. # Hack to get include/asm-arm/arch directory. This should
  53. # stay here, and not move to the top-level Makefile, since
  54. # it adds a link _in the kernel source_, which is almost
  55. # certainly wrong in most situations.
  56. #ifeq ($(target),arm)
  57. ln -s arch-sa1100 $(kernel_source)/include/asm-arm/arch
  58. ln -s proc-armo $(kernel_source)/include/asm-arm/proc
  59. #endif
  60. touch $(kernel_source)/include/linux/autoconf.h
  61. # Various stupid programs use linux/version.h to find the
  62. # Linux version.
  63. ( \
  64. echo '#define UTS_RELEASE "$(kernel_version)"'; \
  65. echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
  66. echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(shell echo $(kernel_version) | sed s/\\./,/g))'; \
  67. ) >$(kernel_source)/include/linux/version.h
  68. extra/Configs/uClibc_config_fix.pl \
  69. --arch=$(target) \
  70. $(cross_options) \
  71. --devel_prefix=/usr/$(target)-linux-uclibc \
  72. --system_devel_prefix=/usr \
  73. --kernel_dir=`pwd`/$(kernel_source) \
  74. --large_file=true \
  75. --rpc_support=true \
  76. --c99_math=true \
  77. --threads=true \
  78. --long_long=true \
  79. --float=true \
  80. --shadow=true \
  81. --mmu=true \
  82. --ldso_path="/lib" \
  83. --shared_support=$(shared_libs_true) \
  84. --file=$(config_orig) \
  85. >Config
  86. ifeq (yes,no)
  87. echo '#Debian configuration overrides' >>Config
  88. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  89. echo 'TARGET_ARCH = $(target)' >>Config
  90. echo 'CROSS = $(target)-linux-' >>Config
  91. else
  92. echo 'CROSS = ' >>Config
  93. endif
  94. echo 'DOPIC = true' >>Config
  95. echo 'SYSTEM_DEVEL_PREFIX = /usr' >>Config
  96. echo 'DEVEL_PREFIX = /usr/$$(TARGET_ARCH)-linux-uclibc' >>Config
  97. echo 'SHARED_LIB_LOADER_PATH = /lib' >>Config
  98. #echo 'TARGET_PREFIX = /' >>Config
  99. ifeq ($(with_shared_libs),n)
  100. echo 'HAVE_SHARED = false' >>Config
  101. else
  102. echo 'HAVE_SHARED = true' >>Config
  103. endif
  104. echo 'KERNEL_SOURCE = '`pwd`/$(kernel_source) >>Config
  105. echo 'HAS_MMU = true' >>Config
  106. echo 'HAS_FLOATING_POINT = true' >>Config
  107. echo 'DO_C99_MATH = true' >>Config
  108. echo 'DODEBUG = false' >>Config
  109. echo 'INCLUDE_THREADS = true' >>Config
  110. endif
  111. mkdir -p lib
  112. $(MAKE)
  113. touch build-stamp
  114. clean: debian/control
  115. dh_testdir
  116. dh_testroot
  117. rm -f build-stamp
  118. rm -f debian/$(p_dev)
  119. rm -rf kernel-source-*
  120. # Add here commands to clean up after the build process.
  121. -$(MAKE) clean
  122. -rm Config
  123. dh_clean
  124. install: build debian/control
  125. dh_testdir
  126. dh_testroot
  127. dh_clean -k
  128. dh_installdirs
  129. -rm debian/$(p_dev)
  130. ln -s tmp debian/$(p_dev)
  131. # Add here commands to install the package into debian/tmp.
  132. $(MAKE) install_dev PREFIX=`pwd`/debian/$(p_dev)
  133. $(MAKE) install_runtime PREFIX=`pwd`/debian/$(p_lib)
  134. $(MAKE) install_toolchain PREFIX=`pwd`/debian/$(p_gcc)
  135. $(MAKE) install_utils PREFIX=`pwd`/debian/$(p_gcc)
  136. install -d debian/$(p_gcc)/usr/share/man/man1
  137. install -m 644 debian/uclibc-gcc.1 \
  138. debian/$(p_gcc)/usr/share/man/man1/$(target)-uclibc-gcc.1
  139. (cd debian/$(p_gcc)/usr/share/man/man1; \
  140. ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-cc.1.gz; \
  141. ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-ld.1.gz; \
  142. for x in addr2line ar as cpp gasp nm objcopy objdump ranlib \
  143. size strings strip;do \
  144. ln -sf $$x.1.gz $(target)-uclibc-$$x.1.gz;done)
  145. install -d debian/$(p_lib)/usr/share/man/man1
  146. install -m 644 debian/uclibc-ldd.1 \
  147. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldd.1
  148. install -m 644 debian/uclibc-ldconfig.1 \
  149. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldconfig.1
  150. install -m 644 debian/uclibc-readelf.1 \
  151. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-readelf.1
  152. (cd debian/$(p_dev); find . -name '.*' -exec rm -f '{}' ';')
  153. (cd debian/$(p_lib); find . -name '.*' -exec rm -f '{}' ';')
  154. (cd debian/$(p_gcc); find . -name '.*' -exec rm -f '{}' ';')
  155. ifeq ($(with_shared_libs),y)
  156. ifeq ($(target),$(DEB_HOST_GNU_CPU))
  157. mkdir -p debian/$(p_lib)/lib/
  158. ln -sf /usr/$(target)-linux-uclibc/lib/ld-uClibc.so.0 \
  159. debian/$(p_lib)/lib/ld-uClibc.so.0
  160. endif
  161. endif
  162. # Build architecture-independent files here.
  163. binary-indep:
  164. # Build architecture-dependent files here.
  165. binary-arch: build install
  166. # dh_testversion
  167. dh_testdir
  168. dh_testroot
  169. # dh_installdebconf
  170. dh_installdocs
  171. dh_installexamples
  172. dh_installmenu
  173. # dh_installemacsen
  174. # dh_installpam
  175. # dh_installinit
  176. dh_installcron
  177. # dh_installmanpages -plibuclibc0
  178. dh_installinfo
  179. # dh_undocumented
  180. dh_installchangelogs
  181. dh_link
  182. cd debian/libuclibc0 && ../fixlinks
  183. cd debian/libuclibc-dev && ../fixlinks
  184. cd debian/uclibc-toolchain && ../fixlinks
  185. dh_strip
  186. dh_compress
  187. dh_fixperms -Xld-uClibc
  188. # You may want to make some executables suid here.
  189. # dh_suidregister
  190. # dh_makeshlibs
  191. dh_installdeb
  192. # dh_perl
  193. ifeq ($(target),$(DEB_HOST_GNU_CPU))
  194. dh_shlibdeps --exclude=ld_uclibc -ldebian/$(p_lib)/usr/$(target)-linux-uclibc/lib
  195. else
  196. dh_shlibdeps --exclude=lib
  197. endif
  198. dh_gencontrol
  199. dh_md5sums
  200. dh_builddeb
  201. binary: binary-indep binary-arch
  202. .PHONY: build clean binary-indep binary-arch binary install