rules 4.9 KB

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