rules 5.2 KB

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