rules 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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=3
  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_version=2.4.25
  13. kernel_source=kernel-headers-$(kernel_version)
  14. kernel_source_dir=linux
  15. builddir=$(shell pwd)
  16. target=$(DEB_HOST_GNU_CPU)
  17. with_shared_libs=y
  18. ifeq ($(with_shared_libs),y)
  19. shared_libs_true=true
  20. else
  21. shared_libs_true=false
  22. endif
  23. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  24. target_suffix=-$(target)
  25. endif
  26. ifneq ($(target),$(DEB_HOST_GNU_CPU))
  27. cross_options = --cross="$(target)-linux-"
  28. else
  29. cross_options = --cross=""
  30. endif
  31. p_dev=uclibc-dev$(target_suffix)
  32. p_lib=uclibc$(target_suffix)
  33. build: build-stamp
  34. build-stamp:
  35. dh_testdir
  36. # Brute force method of getting kernel headers
  37. if [ ! -f /usr/src/$(kernel_source).tar.bz2 ] ; then \
  38. wget http://uclibc.org/downloads/toolchain/$(kernel_source).tar.bz2 \
  39. -O /usr/src/$(kernel_source).tar.bz2; \
  40. fi;
  41. tar --bzip2 -xf /usr/src/$(kernel_source).tar.bz2
  42. # Hack to get include/asm-arm/arch directory. This should
  43. # stay here, and not move to the top-level Makefile, since
  44. # it adds a link _in the kernel source_, which is almost
  45. # certainly wrong in most situations.
  46. #ifeq ($(target),arm)
  47. ln -s arch-sa1100 $(kernel_source_dir)/include/asm-arm/arch
  48. ln -s proc-armo $(kernel_source_dir)/include/asm-arm/proc
  49. #endif
  50. touch $(kernel_source_dir)/include/linux/autoconf.h
  51. # Various stupid programs use linux/version.h to find the
  52. # Linux version.
  53. ( \
  54. echo '#define UTS_RELEASE "$(kernel_version)"'; \
  55. echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
  56. echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(shell echo $(kernel_version) | sed s/\\./,/g))'; \
  57. ) >$(kernel_source_dir)/include/linux/version.h
  58. cp debian/config .config
  59. sed -i -e 's,^.*TARGET_$(target).*,TARGET_$(target)=y,g' \
  60. .config
  61. sed -i -e 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(target)\",g' \
  62. .config
  63. sed -i -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(builddir)/$(kernel_source_dir)\",g' \
  64. .config
  65. sed -i -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
  66. .config
  67. sed -i -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
  68. .config
  69. sed -i -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
  70. .config
  71. sed -i -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y\nUCLIBC_HAS_LOCALE=n,g' \
  72. .config
  73. ifeq ($(target),arm)
  74. sed -i -e 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' .config
  75. echo CONFIG_GENERIC_ARM=y >>.config
  76. endif
  77. ifeq ($(target),i386)
  78. echo CONFIG_GENERIC_386=y >>.config
  79. endif
  80. yes '' | make oldconfig
  81. mkdir -p lib
  82. $(MAKE)
  83. $(MAKE) utils
  84. touch build-stamp
  85. clean:
  86. dh_testdir
  87. dh_testroot
  88. rm -f build-stamp
  89. rm -rf $(kernel_source_dir)
  90. # Add here commands to clean up after the build process.
  91. -$(MAKE) distclean
  92. -rm -f Config
  93. dh_clean
  94. install: build
  95. dh_testdir
  96. dh_testroot
  97. dh_clean -k
  98. dh_installdirs
  99. -rm debian/tmp
  100. -mkdir debian/tmp
  101. # Add here commands to install the package into debian/tmp.
  102. $(MAKE) install install_utils PREFIX=`pwd`/debian/tmp
  103. install -d debian/tmp/usr/share/man/man1
  104. install -m 644 debian/ldd.1 \
  105. debian/tmp/usr/share/man/man1/ldd.1
  106. install -m 644 debian/ldconfig.1 \
  107. debian/tmp/usr/share/man/man1/ldconfig.1
  108. # Build architecture-independent files here.
  109. binary-indep:
  110. # Build architecture-dependent files here.
  111. binary-arch: build install
  112. # dh_testversion
  113. dh_testdir
  114. dh_testroot
  115. dh_movefiles
  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 -puclibc
  125. dh_installinfo
  126. # dh_undocumented
  127. dh_installchangelogs
  128. dh_link
  129. dh_strip
  130. dh_compress
  131. dh_fixperms -Xld-uClibc
  132. # You may want to make some executables suid here.
  133. # dh_suidregister
  134. # dh_makeshlibs
  135. dh_installdeb
  136. # dh_perl
  137. dh_shlibdeps --exclude=lib
  138. dh_gencontrol
  139. dh_md5sums
  140. dh_builddeb
  141. binary: binary-indep binary-arch
  142. .PHONY: build clean binary-indep binary-arch binary install