rules 5.8 KB

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