Advertisement
Guest User

Untitled

a guest
Apr 28th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 7.01 KB | None | 0 0
  1. #! /usr/bin/make -f
  2. # -*- makefile -*-
  3. # debian/rules file for GNU libc.
  4. # Copyright 1998, 1999 by Joel Klecker <espy@debian.org>
  5. # Copyright 2000 Ben Collins <bcollins@debian.org>
  6. # Copyright 2003 Jeff Bailey <jbailey@debian.org>
  7. # This Makefile is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11.  
  12. # What are the phases to building glibc?
  13.  
  14. # Unpack main tarball
  15. # Do any necessary overlays
  16. # Apply patches
  17. # Determine how many builds there are to do.  For Each build:
  18.  
  19. #  Create build directory
  20. #  Configure
  21. #  Build
  22. #  Test as desired
  23. #  Install to package directories
  24.  
  25. # Run debian magic to build packages.
  26.  
  27. # Things you may need to customise:
  28.  
  29. # These are done as absolute paths so that in the case of filesystem size
  30. # limitations, they can be overridden and spread all over.
  31. build-tree := build-tree
  32. stamp := $(CURDIR)/stamp-dir/
  33. DUMMY := $(shell mkdir -p $(stamp))
  34.  
  35. # Beyond here you shouldn't need to customise anything:
  36. export SHELL          = /bin/bash -e
  37.  
  38. DEB_HOST_ARCH         ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
  39. DEB_HOST_ARCH_ENDIAN  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)
  40. DEB_HOST_ARCH_OS      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
  41. DEB_HOST_GNU_TYPE     ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
  42. DEB_HOST_MULTIARCH    ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
  43. DEB_BUILD_ARCH        ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
  44. DEB_BUILD_ARCH_BITS   ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
  45. DEB_BUILD_GNU_TYPE    ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  46.  
  47. DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
  48.  
  49. DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
  50. GLIBC_VERSION = $(shell echo $(DEB_VERSION) | sed -e 's/.*://' -e 's/[+-].*//')
  51.  
  52. SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
  53.  
  54. # The minimum package version with which these packages are compatible.
  55. shlib_dep_ver = $(GLIBC_VERSION)
  56. shlib_dep = $(libc) (>= $(shlib_dep_ver))
  57.  
  58. DEB_BUILDDIR ?= $(build-tree)/$(DEB_HOST_ARCH)-$(curpass)
  59. DEB_BUILDDIRLIBC ?= $(build-tree)/$(DEB_HOST_ARCH)-libc
  60.  
  61. GLIBC_SOURCES = $(filter-out debian $(shell basename $(stamp)) $(build-tree), $(wildcard *))
  62.          
  63. # Support multiple makes at once based on number of processors
  64. ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  65. NJOBS := -j $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  66. endif
  67.  
  68. # use the package settings, not the settings from the environment
  69. define unsetenv
  70.   unexport $(1)
  71.   $(1) =
  72. endef
  73. $(foreach v, CPPFLAGS CFLAGS CXXFLAGS LDFLAGS, $(if $(filter environment,$(origin $(v))),$(eval $(call unsetenv, $(v)))))
  74.  
  75. # Default setup
  76. GLIBC_PASSES ?= libc
  77.  
  78. prefix=/usr
  79. bindir=$(prefix)/bin
  80. datadir=$(prefix)/share
  81. complocaledir=$(prefix)/lib/locale
  82. sysconfdir=/etc
  83. libexecdir=$(prefix)/lib
  84. rootsbindir=/sbin
  85. includedir=$(prefix)/include
  86. docdir=$(prefix)/share/doc
  87. mandir=$(prefix)/share/man
  88. sbindir=$(prefix)/sbin
  89. vardbdir=/var/lib/misc
  90. rtlddir=/lib
  91. slibdir=/lib/$(DEB_HOST_MULTIARCH)
  92. libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
  93. mvec = no
  94.  
  95.  
  96. BASE_CC = gcc
  97. BASE_CXX = g++
  98. BASE_MIG = mig
  99. DEB_GCC_VERSION ?= -8
  100.  
  101. RUN_TESTSUITE = yes
  102. TIMEOUTFACTOR = 25
  103.  
  104. # Set cross and native compiler names, including version.
  105. CC     = $(DEB_HOST_GNU_TYPE)-$(BASE_CC)$(DEB_GCC_VERSION) -no-pie -fno-PIE
  106. CXX    = $(DEB_HOST_GNU_TYPE)-$(BASE_CXX)$(DEB_GCC_VERSION) -no-pie -fno-PIE
  107. MIG    = $(DEB_HOST_GNU_TYPE)-$(BASE_MIG)
  108. BUILD_CC = $(DEB_BUILD_GNU_TYPE)-$(BASE_CC)
  109. BUILD_CXX = $(DEB_BUILD_GNU_TYPE)-$(BASE_CXX)
  110.  
  111. BUILD_CFLAGS = -O2 -g
  112. HOST_CFLAGS = -pipe -O2 -g $(call xx,extra_cflags)
  113.  
  114. # 32-bit MIPS builders have a 2GB memory space. This is not enough to
  115. # build test-tgmath3.o with GCC, unless tweaking the garbage collector.
  116. ifeq ($(findstring mips,$(DEB_BUILD_ARCH))-$(DEB_BUILD_ARCH_BITS), mips-32)
  117.   CC += --param ggc-min-expand=10
  118. endif
  119.  
  120. configure_target := $(DEB_HOST_GNU_TYPE)
  121.  
  122. # Normally we'll just use this for --build.  If the architecture requires
  123. # that build daemons be able to run a particular optimized library, then
  124. # they can set the --build to match --host for that optimized build.
  125. # Among other things this lets tests run.
  126. configure_build := $(DEB_BUILD_GNU_TYPE)
  127.  
  128. # Which build pass are we on?
  129. curpass = $(filter-out %_,$(subst _,_ ,$@))
  130.  
  131. ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
  132.   DEB_ARCH_REGULAR_PACKAGES = $(libc)-dev
  133.   DEB_INDEP_REGULAR_PACKAGES =
  134.   DEB_UDEB_PACKAGES =
  135.   ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
  136.     DEB_BUILD_OPTIONS+=nocheck
  137.   endif
  138. else
  139.   DEB_ARCH_REGULAR_PACKAGES = $(libc) $(libc)-dev $(libc)-dbg $(libc)-pic libc-bin libc-dev-bin multiarch-support
  140.   DEB_INDEP_REGULAR_PACKAGES = glibc-doc glibc-source locales
  141.   DEB_UDEB_PACKAGES = $(libc)-udeb
  142.   ## Locales can only be pre-generated during native compiles
  143.   ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
  144.     DEB_ARCH_REGULAR_PACKAGES += locales-all
  145.   endif
  146. endif
  147.  
  148. # Generic kernel version check
  149. define kernel_check
  150. (if [ $(CURRENT_KERNEL_VERSION) -lt $(1) ]; then \
  151.   false; \
  152. fi)
  153. endef
  154.  
  155. # Include libidn for both NPTL and FBTL targets.
  156. standard-add-ons = libidn,
  157.  
  158. # Pull in all the per-arch magic!
  159.  
  160. -include debian/sysdeps/$(DEB_HOST_ARCH_OS).mk
  161. -include debian/sysdeps/$(DEB_HOST_ARCH).mk
  162.  
  163. ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
  164. DEB_ARCH_REGULAR_PACKAGES += $(foreach p,$(DEB_ARCH_MULTILIB_PACKAGES), $(if $(findstring -dev,$(p)), $(p)))
  165. else
  166. DEB_ARCH_REGULAR_PACKAGES += $(DEB_ARCH_MULTILIB_PACKAGES)
  167. endif
  168.  
  169. # Don't run dh_strip on this package
  170. NOSTRIP_$(libc)-dbg = 1
  171.  
  172. # Put the debug files from these packages in $(libc)-dbg
  173. DEBUG_$(libc) = 1
  174. DEBUG_libc6-xen = 1
  175. DEBUG_libc6.1-alphaev67 = 1
  176.  
  177. ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
  178.   ifeq ($(threads),yes)
  179.   DEB_ARCH_REGULAR_PACKAGES += nscd
  180.   endif
  181. endif
  182.  
  183. # And now the rules...
  184. include debian/rules.d/*.mk
  185.  
  186. clean:: unpatch
  187.     rm -rf $(patsubst %,debian/tmp-%,$(GLIBC_PASSES))
  188.     rm -rf $(build-tree)
  189.     rm -rf $(stamp)
  190.     rm -rf debian/include
  191.     rm -f debian/control.in/libc0.1 debian/control.in/libc0.3 \
  192.         debian/control.in/libc6 debian/control.in/libc6.1 \
  193.         debian/*.preinst.*
  194.  
  195. # Required Debian targets
  196. build-arch: $(stamp)info \
  197.     $(patsubst %,$(stamp)build_%,$(GLIBC_PASSES)) \
  198.     $(patsubst %,$(stamp)check_%,$(GLIBC_PASSES))
  199. ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
  200. build-arch: $(stamp)build_C.UTF-8 \
  201.     $(stamp)build_locales-all
  202. endif
  203.  
  204. build-indep: $(stamp)source
  205.  
  206. build: build-arch build-indep
  207.  
  208.  
  209. binary-indep: build-indep testroot debian/control $(build-tree) \
  210.     $(patsubst %,$(stamp)binaryinst_%,$(DEB_INDEP_REGULAR_PACKAGES))
  211.  
  212. binary-arch: build-arch testroot debian/control $(build-tree) \
  213.     $(patsubst %,$(stamp)binaryinst_%,$(DEB_ARCH_REGULAR_PACKAGES)) \
  214.     $(patsubst %,$(stamp)binaryinst_%,$(DEB_UDEB_PACKAGES))
  215.  
  216. binary: binary-indep binary-arch
  217.  
  218. testroot:
  219.     dh_testroot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement