rules 4.7 KB

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