< prev index next >

make/devkit/Tools.gmk

Print this page




  34 # if you configure after you've once build the BUILD->BUILD
  35 # compiler THAT one will be picked up as the compiler for itself.
  36 # This is not so great, especially if you did a partial delete
  37 # of the target tree.
  38 #
  39 # Fix this...
  40 #
  41 
  42 $(info TARGET=$(TARGET))
  43 $(info HOST=$(HOST))
  44 $(info BUILD=$(BUILD))
  45 
  46 ARCH := $(word 1,$(subst -, ,$(TARGET)))
  47 
  48 ifeq ($(TARGET), arm-linux-gnueabihf)
  49   ARCH=armhfp
  50 endif
  51 
  52 $(info ARCH=$(ARCH))
  53 
  54 ifeq ($(BASE_OS), OL)
  55   BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
  56   LINUX_VERSION := OL6.4
  57 else ifeq ($(BASE_OS), Fedora)
  58   DEFAULT_OS_VERSION := 27
  59   ifeq ($(BASE_OS_VERSION), )
  60     BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
  61   endif
  62   ifeq ($(filter x86_64 armhfp, $(ARCH)), )
  63     FEDORA_TYPE := fedora-secondary
  64   else
  65     FEDORA_TYPE := fedora/linux
  66   endif
  67   ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
  68   ifeq ($(ARCHIVED),true)
  69     BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
  70   else
  71     BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
  72   endif
  73   LINUX_VERSION := Fedora_$(BASE_OS_VERSION)
  74 else
  75   $(error Unknown base OS $(BASE_OS))
  76 endif
  77 
  78 ##########################################################################################
  79 # Define external dependencies
  80 
  81 # Latest that could be made to work.
  82 GCC_VER := 8.2.0
  83 ifeq ($(GCC_VER), 8.2.0)
  84   gcc_ver := gcc-8.2.0
  85   binutils_ver := binutils-2.30
  86   ccache_ver := ccache-3.5.1a
  87   CCACHE_DIRNAME := ccache-3.5.1
  88   mpfr_ver := mpfr-3.1.5
  89   gmp_ver := gmp-6.1.2
  90   mpc_ver := mpc-1.0.3
  91   gdb_ver := gdb-8.2.1
  92 else ifeq ($(GCC_VER), 7.3.0)
  93   gcc_ver := gcc-7.3.0
  94   binutils_ver := binutils-2.30
  95   ccache_ver := ccache-3.3.6
  96   mpfr_ver := mpfr-3.1.5
  97   gmp_ver := gmp-6.1.2
  98   mpc_ver := mpc-1.0.3
  99   gdb_ver := gdb-8.1
 100 else ifeq ($(GCC_VER), 4.9.2)
 101   gcc_ver := gcc-4.9.2
 102   binutils_ver := binutils-2.25
 103   ccache_ver := ccache-3.2.1
 104   mpfr_ver := mpfr-3.0.1
 105   gmp_ver := gmp-4.3.2
 106   mpc_ver := mpc-1.0.1
 107   gdb_ver := gdb-7.12.1
 108 else
 109   $(error Unsupported GCC version)
 110 endif
 111 
 112 GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.xz
 113 BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.xz
 114 CCACHE := https://samba.org/ftp/ccache/$(ccache_ver).tar.xz
 115 MPFR := https://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
 116 GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
 117 MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz
 118 GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz
 119 
 120 # RPMs used by all BASE_OS
 121 RPM_LIST := \
 122     kernel-headers \
 123     glibc glibc-headers glibc-devel \
 124     cups-libs cups-devel \
 125     libX11 libX11-devel \
 126     xorg-x11-proto-devel \
 127     alsa-lib alsa-lib-devel \
 128     libXext libXext-devel \
 129     libXtst libXtst-devel \
 130     libXrender libXrender-devel \
 131     libXrandr libXrandr-devel \
 132     freetype freetype-devel \
 133     libXt libXt-devel \
 134     libSM libSM-devel \
 135     libICE libICE-devel \


 166 rpms := $(SYSROOT)/rpms_unpacked
 167 
 168 # Need to patch libs that are linker scripts to use non-absolute paths
 169 libs := $(SYSROOT)/libs_patched
 170 
 171 ################################################################################
 172 # Download RPMs
 173 download-rpms:
 174         mkdir -p $(DOWNLOAD_RPMS)
 175         # Only run this if rpm dir is empty.
 176         ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), )
 177           cd $(DOWNLOAD_RPMS) && \
 178               wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
 179         endif
 180 
 181 ##########################################################################################
 182 # Unpack source packages
 183 
 184 # Generate downloading + unpacking of sources.
 185 define Download
 186   # Allow override
 187   $(1)_DIRNAME ?= $(basename $(basename $(notdir $($(1)))))
 188   $(1)_DIR = $(abspath $(SRCDIR)/$$($(1)_DIRNAME))
 189   $(1)_CFG = $$($(1)_DIR)/configure
 190   $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
 191 
 192   $$($(1)_CFG) : $$($(1)_FILE)
 193         mkdir -p $$(SRCDIR)
 194         tar -C $$(SRCDIR) -xf $$<
 195         $$(foreach p,$$(abspath $$(wildcard patches/$$(notdir $$($(1)_DIR)).patch)), \
 196           echo PATCHING $$(p) ; \
 197           patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
 198         )
 199         touch $$@
 200 
 201   $$($(1)_FILE) :
 202         wget -P $(DOWNLOAD) $$($(1))
 203 endef
 204 
 205 # Download and unpack all source packages
 206 $(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB,$(eval $(call Download,$(p))))
 207 
 208 ##########################################################################################
 209 # Unpack RPMS
 210 
 211 RPM_ARCHS := $(ARCH) noarch
 212 ifeq ($(ARCH),x86_64)
 213   ifeq ($(BUILD),$(HOST))
 214     ifeq ($(TARGET),$(HOST))
 215       # When building the native compiler for x86_64, enable mixed mode.


 349 $(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
 350 
 351 ##########################################################################################
 352 
 353 $(gcc) \
 354     $(binutils) \
 355     $(gmp) \
 356     $(mpfr) \
 357     $(mpc) \
 358     $(bfdmakes) \
 359     $(ccache) : ENVS += $(TOOLS)
 360 
 361 # libdir to work around hateful bfd stuff installing into wrong dirs...
 362 # ensure we have 64 bit bfd support in the HOST library. I.e our
 363 # compiler on i686 will know 64 bit symbols, BUT later
 364 # we build just the libs again for TARGET, then with whatever the arch
 365 # wants.
 366 $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
 367 
 368 # Makefile creation. Simply run configure in build dir.
 369 # Setting CFLAGS to -O2 generates a much faster ld.
 370 $(bfdmakes) \
 371 $(BUILDDIR)/$(binutils_ver)/Makefile \
 372     : $(BINUTILS_CFG)
 373         $(info Configuring $@. Log in $(@D)/log.config)
 374         @mkdir -p $(@D)
 375         ( \
 376           cd $(@D) ; \
 377           $(PATHPRE) $(ENVS) CFLAGS="-O2 $(CFLAGS)" \
 378               $(BINUTILS_CFG) \
 379               $(CONFIG) \
 380               --with-sysroot=$(SYSROOT) \
 381               --disable-nls \
 382               --program-prefix=$(TARGET)- \
 383               --enable-multilib \
 384               --enable-gold=default \
 385               --enable-threads \
 386               --enable-plugins \
 387         ) > $(@D)/log.config 2>&1
 388         @echo 'done'
 389 
 390 $(BUILDDIR)/$(mpfr_ver)/Makefile \
 391     : $(MPFR_CFG)
 392         $(info Configuring $@. Log in $(@D)/log.config)
 393         @mkdir -p $(@D)
 394         ( \
 395           cd $(@D) ; \
 396           $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
 397               $(MPFR_CFG) \
 398               $(CONFIG) \
 399               --program-prefix=$(TARGET)- \
 400               --enable-shared=no \
 401               --with-gmp=$(PREFIX) \
 402         ) > $(@D)/log.config 2>&1
 403         @echo 'done'
 404 
 405 $(BUILDDIR)/$(gmp_ver)/Makefile \




  34 # if you configure after you've once build the BUILD->BUILD
  35 # compiler THAT one will be picked up as the compiler for itself.
  36 # This is not so great, especially if you did a partial delete
  37 # of the target tree.
  38 #
  39 # Fix this...
  40 #
  41 
  42 $(info TARGET=$(TARGET))
  43 $(info HOST=$(HOST))
  44 $(info BUILD=$(BUILD))
  45 
  46 ARCH := $(word 1,$(subst -, ,$(TARGET)))
  47 
  48 ifeq ($(TARGET), arm-linux-gnueabihf)
  49   ARCH=armhfp
  50 endif
  51 
  52 $(info ARCH=$(ARCH))
  53 
  54 ifeq ($(BASE_OS), OEL6)
  55   BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
  56   LINUX_VERSION := OEL6.4
  57 else ifeq ($(BASE_OS), Fedora)
  58   DEFAULT_OS_VERSION := 27
  59   ifeq ($(BASE_OS_VERSION), )
  60     BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
  61   endif
  62   ifeq ($(filter x86_64 armhfp, $(ARCH)), )
  63     FEDORA_TYPE := fedora-secondary
  64   else
  65     FEDORA_TYPE := fedora/linux
  66   endif
  67   ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
  68   ifeq ($(ARCHIVED),true)
  69     BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
  70   else
  71     BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
  72   endif
  73   LINUX_VERSION := Fedora_$(BASE_OS_VERSION)
  74 else
  75   $(error Unknown base OS $(BASE_OS))
  76 endif
  77 
  78 ##########################################################################################
  79 # Define external dependencies
  80 
  81 # Latest that could be made to work.
  82 GCC_VER := 7.3.0
  83 ifeq ($(GCC_VER), 7.3.0)









  84   gcc_ver := gcc-7.3.0
  85   binutils_ver := binutils-2.30
  86   ccache_ver := ccache-3.3.6
  87   mpfr_ver := mpfr-3.1.5
  88   gmp_ver := gmp-6.1.2
  89   mpc_ver := mpc-1.0.3
  90   gdb_ver := gdb-8.1
  91 else ifeq ($(GCC_VER), 4.9.2)
  92   gcc_ver := gcc-4.9.2
  93   binutils_ver := binutils-2.25
  94   ccache_ver := ccache-3.2.1
  95   mpfr_ver := mpfr-3.0.1
  96   gmp_ver := gmp-4.3.2
  97   mpc_ver := mpc-1.0.1
  98   gdb_ver := gdb-7.12.1
  99 else
 100   $(error Unsupported GCC version)
 101 endif
 102 
 103 GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.xz
 104 BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.xz
 105 CCACHE := https://samba.org/ftp/ccache/$(ccache_ver).tar.xz
 106 MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
 107 GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
 108 MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz
 109 GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz
 110 
 111 # RPMs used by all BASE_OS
 112 RPM_LIST := \
 113     kernel-headers \
 114     glibc glibc-headers glibc-devel \
 115     cups-libs cups-devel \
 116     libX11 libX11-devel \
 117     xorg-x11-proto-devel \
 118     alsa-lib alsa-lib-devel \
 119     libXext libXext-devel \
 120     libXtst libXtst-devel \
 121     libXrender libXrender-devel \
 122     libXrandr libXrandr-devel \
 123     freetype freetype-devel \
 124     libXt libXt-devel \
 125     libSM libSM-devel \
 126     libICE libICE-devel \


 157 rpms := $(SYSROOT)/rpms_unpacked
 158 
 159 # Need to patch libs that are linker scripts to use non-absolute paths
 160 libs := $(SYSROOT)/libs_patched
 161 
 162 ################################################################################
 163 # Download RPMs
 164 download-rpms:
 165         mkdir -p $(DOWNLOAD_RPMS)
 166         # Only run this if rpm dir is empty.
 167         ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), )
 168           cd $(DOWNLOAD_RPMS) && \
 169               wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(BASE_URL)
 170         endif
 171 
 172 ##########################################################################################
 173 # Unpack source packages
 174 
 175 # Generate downloading + unpacking of sources.
 176 define Download
 177   $(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))


 178   $(1)_CFG = $$($(1)_DIR)/configure
 179   $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
 180 
 181   $$($(1)_CFG) : $$($(1)_FILE)
 182         mkdir -p $$(SRCDIR)
 183         tar -C $$(SRCDIR) -xf $$<
 184         $$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
 185           echo PATCHING $$(p) ; \
 186           patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
 187         )
 188         touch $$@
 189 
 190   $$($(1)_FILE) :
 191         wget -P $(DOWNLOAD) $$($(1))
 192 endef
 193 
 194 # Download and unpack all source packages
 195 $(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB,$(eval $(call Download,$(p))))
 196 
 197 ##########################################################################################
 198 # Unpack RPMS
 199 
 200 RPM_ARCHS := $(ARCH) noarch
 201 ifeq ($(ARCH),x86_64)
 202   ifeq ($(BUILD),$(HOST))
 203     ifeq ($(TARGET),$(HOST))
 204       # When building the native compiler for x86_64, enable mixed mode.


 338 $(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
 339 
 340 ##########################################################################################
 341 
 342 $(gcc) \
 343     $(binutils) \
 344     $(gmp) \
 345     $(mpfr) \
 346     $(mpc) \
 347     $(bfdmakes) \
 348     $(ccache) : ENVS += $(TOOLS)
 349 
 350 # libdir to work around hateful bfd stuff installing into wrong dirs...
 351 # ensure we have 64 bit bfd support in the HOST library. I.e our
 352 # compiler on i686 will know 64 bit symbols, BUT later
 353 # we build just the libs again for TARGET, then with whatever the arch
 354 # wants.
 355 $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
 356 
 357 # Makefile creation. Simply run configure in build dir.

 358 $(bfdmakes) \
 359 $(BUILDDIR)/$(binutils_ver)/Makefile \
 360     : $(BINUTILS_CFG)
 361         $(info Configuring $@. Log in $(@D)/log.config)
 362         @mkdir -p $(@D)
 363         ( \
 364           cd $(@D) ; \
 365           $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
 366               $(BINUTILS_CFG) \
 367               $(CONFIG) \
 368               --with-sysroot=$(SYSROOT) \
 369               --disable-nls \
 370               --program-prefix=$(TARGET)- \
 371               --enable-multilib \
 372               --enable-gold \

 373               --enable-plugins \
 374         ) > $(@D)/log.config 2>&1
 375         @echo 'done'
 376 
 377 $(BUILDDIR)/$(mpfr_ver)/Makefile \
 378     : $(MPFR_CFG)
 379         $(info Configuring $@. Log in $(@D)/log.config)
 380         @mkdir -p $(@D)
 381         ( \
 382           cd $(@D) ; \
 383           $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
 384               $(MPFR_CFG) \
 385               $(CONFIG) \
 386               --program-prefix=$(TARGET)- \
 387               --enable-shared=no \
 388               --with-gmp=$(PREFIX) \
 389         ) > $(@D)/log.config 2>&1
 390         @echo 'done'
 391 
 392 $(BUILDDIR)/$(gmp_ver)/Makefile \


< prev index next >