rules 6.1 KB

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