rules 4.5 KB

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