rules 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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=powerpc
  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. #endif
  43. ifneq ($(target),mipsel)
  44. cp extra/Configs/Config.$(target) Config
  45. else
  46. cp extra/Configs/Config.mips Config
  47. endif
  48. echo '#Debian configuration overrides' >>Config
  49. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  50. echo 'TARGET_ARCH = $(target)' >>Config
  51. echo 'CROSS = $(target)-linux-' >>Config
  52. else
  53. echo 'CROSS = ' >>Config
  54. endif
  55. echo 'DOPIC = true' >>Config
  56. echo 'SYSTEM_DEVEL_PREFIX = /usr' >>Config
  57. echo 'DEVEL_PREFIX = /usr/$$(TARGET_ARCH)-linux-uclibc' >>Config
  58. echo 'SHARED_LIB_LOADER_PATH = /lib' >>Config
  59. #echo 'TARGET_PREFIX = /' >>Config
  60. ifeq ($(with_shared_libs),n)
  61. echo 'HAVE_SHARED = false' >>Config
  62. endif
  63. echo 'KERNEL_SOURCE = '`pwd`/$(kernel_source) >>Config
  64. echo 'HAS_MMU = true' >>Config
  65. echo 'HAS_FLOATING_POINT = true' >>Config
  66. echo 'DO_C99_MATH = true' >>Config
  67. echo 'DODEBUG = false' >>Config
  68. $(MAKE)
  69. touch build-stamp
  70. clean: debian/control
  71. dh_testdir
  72. dh_testroot
  73. rm -f build-stamp
  74. rm -f debian/$(p_dev)
  75. rm -rf kernel-source-*
  76. # Add here commands to clean up after the build process.
  77. -$(MAKE) clean
  78. -rm Config
  79. dh_clean
  80. install: build debian/control
  81. dh_testdir
  82. dh_testroot
  83. dh_clean -k
  84. dh_installdirs
  85. -rm debian/$(p_dev)
  86. ln -s tmp debian/$(p_dev)
  87. # Add here commands to install the package into debian/tmp.
  88. $(MAKE) install_dev PREFIX=`pwd`/debian/$(p_dev)
  89. $(MAKE) install_runtime PREFIX=`pwd`/debian/$(p_lib)
  90. $(MAKE) install_toolchain PREFIX=`pwd`/debian/$(p_gcc)
  91. install -d debian/$(p_gcc)/usr/share/man/man1
  92. install -m 644 debian/uclibc-gcc.1 \
  93. debian/$(p_gcc)/usr/share/man/man1/$(target)-uclibc-gcc.1
  94. (cd debian/$(p_gcc)/usr/share/man/man1; \
  95. ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-cc.1.gz; \
  96. ln -sf $(target)-uclibc-gcc.1.gz $(target)-uclibc-ld.1.gz; \
  97. for x in addr2line ar as cpp gasp nm objcopy objdump ranlib \
  98. size strings strip;do \
  99. ln -sf $$x.1.gz $(target)-uclibc-$$x.1.gz;done)
  100. install -d debian/$(p_lib)/usr/share/man/man1
  101. install -m 644 debian/uclibc-ldd.1 \
  102. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldd.1
  103. install -m 644 debian/uclibc-ldconfig.1 \
  104. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-ldconfig.1
  105. install -m 644 debian/uclibc-readelf.1 \
  106. debian/$(p_lib)/usr/share/man/man1/$(target)-uclibc-readelf.1
  107. (cd debian/$(p_dev); find . -name '.*' -exec rm -f '{}' ';')
  108. (cd debian/$(p_lib); find . -name '.*' -exec rm -f '{}' ';')
  109. (cd debian/$(p_gcc); find . -name '.*' -exec rm -f '{}' ';')
  110. ifeq ($(with_shared_libs),y)
  111. ifeq ($(target),$(DEB_HOST_GNU_CPU))
  112. mkdir -p debian/$(p_lib)/lib/
  113. ln -sf /usr/$(target)-linux-uclibc/lib/ld-uClibc.so.0 \
  114. debian/$(p_lib)/lib/ld-uClibc.so.0
  115. endif
  116. endif
  117. # Build architecture-independent files here.
  118. binary-indep:
  119. # Build architecture-dependent files here.
  120. binary-arch: build install
  121. # dh_testversion
  122. dh_testdir
  123. dh_testroot
  124. # dh_installdebconf
  125. dh_installdocs
  126. dh_installexamples
  127. dh_installmenu
  128. # dh_installemacsen
  129. # dh_installpam
  130. # dh_installinit
  131. dh_installcron
  132. # dh_installmanpages -plibuclibc0
  133. dh_installinfo
  134. # dh_undocumented
  135. dh_installchangelogs
  136. dh_link
  137. cd debian/libuclibc0 && ../fixlinks
  138. cd debian/libuclibc-dev && ../fixlinks
  139. cd debian/uclibc-toolchain && ../fixlinks
  140. dh_strip
  141. dh_compress
  142. dh_fixperms -Xld-uClibc
  143. # You may want to make some executables suid here.
  144. # dh_suidregister
  145. # dh_makeshlibs
  146. dh_installdeb
  147. # dh_perl
  148. ifeq ($(target),$(DEB_HOST_GNU_CPU))
  149. dh_shlibdeps --exclude=ld_uclibc -ldebian/$(p_lib)/usr/$(target)-linux-uclibc/lib
  150. else
  151. dh_shlibdeps --exclude=lib
  152. endif
  153. dh_gencontrol
  154. dh_md5sums
  155. dh_builddeb
  156. binary: binary-indep binary-arch
  157. .PHONY: build clean binary-indep binary-arch binary install