|
| 1 | +# |
| 2 | +# Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. |
| 3 | +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | +# |
| 5 | +# This code is free software; you can redistribute it and/or modify it |
| 6 | +# under the terms of the GNU General Public License version 2 only, as |
| 7 | +# published by the Free Software Foundation. Oracle designates this |
| 8 | +# particular file as subject to the "Classpath" exception as provided |
| 9 | +# by Oracle in the LICENSE file that accompanied this code. |
| 10 | +# |
| 11 | +# This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | +# version 2 for more details (a copy is included in the LICENSE file that |
| 15 | +# accompanied this code). |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License version |
| 18 | +# 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | +# |
| 21 | +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | +# or visit www.oracle.com if you need additional information or have any |
| 23 | +# questions. |
| 24 | +# |
| 25 | + |
| 26 | +ARCH := $(word 1,$(subst -, ,$(TARGET))) |
| 27 | + |
| 28 | +ifeq ($(TARGET), arm-linux-gnueabihf) |
| 29 | + ARCH=armhfp |
| 30 | +endif |
| 31 | + |
| 32 | +$(info ARCH=$(ARCH)) |
| 33 | + |
| 34 | +ifeq ($(PREFIX),) |
| 35 | + $(error PREFIX not set) |
| 36 | +endif |
| 37 | + |
| 38 | +BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET) |
| 39 | +TARGETDIR := $(PREFIX)/$(TARGET) |
| 40 | +SYSROOT := $(TARGETDIR)/sysroot |
| 41 | + |
| 42 | +# Base OS information and repositories |
| 43 | +# |
| 44 | +# BASE_OS_REPOS is a space-separated set of repositories. Each entry |
| 45 | +# is of the format <repo_name>,<url> where <repo_name> is a unique |
| 46 | +# identifier across the set of repositories. |
| 47 | + |
| 48 | +ifeq ($(BASE_OS), OL) |
| 49 | + ifeq ($(filter aarch64 x86_64, $(ARCH)), ) |
| 50 | + $(error Only "aarch64 x86_64" architectures are supported for OL, but "$(ARCH)" was requested) |
| 51 | + endif |
| 52 | + BASE_OS_VERSION ?= 7 |
| 53 | + ifeq ($(BASE_OS_VERSION), 6) |
| 54 | + ifeq ($(filter x86_64, $(ARCH)), ) |
| 55 | + $(error Only "x86_64" architectures are supported for OL6, but "$(ARCH)" was requested) |
| 56 | + endif |
| 57 | + BASE_OS_DESCRIPTION_VERSION := 6.4 |
| 58 | + REPO_BASE_URL := https://yum.oracle.com/repo/OracleLinux/OL6/4 |
| 59 | + BASE_OS_REPOS := base,$(REPO_BASE_URL)/base/$(ARCH) |
| 60 | + else ifeq ($(BASE_OS_VERSION), 7) |
| 61 | + BASE_OS_DESCRIPTION_VERSION := 7.6 |
| 62 | + REPO_BASE_URL := https://yum.oracle.com/repo/OracleLinux/OL7/6 |
| 63 | + BASE_OS_REPOS := base,$(REPO_BASE_URL)/base/$(ARCH) |
| 64 | + else |
| 65 | + REPO_BASE_URL := https://yum.oracle.com/repo/OracleLinux/OL$(BASE_OS_VERSION) |
| 66 | + BASE_OS_REPOS := baseos,$(REPO_BASE_URL)/baseos/latest/$(ARCH) appstream,$(REPO_BASE_URL)/appstream/$(ARCH) |
| 67 | + BASE_OS_DESCRIPTION_VERSION := $(BASE_OS_VERSION) |
| 68 | + endif |
| 69 | + BASE_OS_DESCRIPTION := OL$(BASE_OS_DESCRIPTION_VERSION) |
| 70 | +else ifeq ($(BASE_OS), Fedora) |
| 71 | + ifeq ($(filter aarch64 armhfp ppc64le riscv64 s390x x86_64, $(ARCH)), ) |
| 72 | + $(error Only "aarch64 armhfp ppc64le riscv64 s390x x86_64" architectures are supported for Fedora, but "$(ARCH)" was requested) |
| 73 | + endif |
| 74 | + ifeq ($(ARCH), riscv64) |
| 75 | + BASE_OS_VERSION ?= 43 |
| 76 | + BASE_OS_BUILD := 6640 |
| 77 | + REPO_BASE_URL := https://riscv-koji.fedoraproject.org/repos-dist/f$(BASE_OS_VERSION)/$(BASE_OS_BUILD)/riscv64 |
| 78 | + BASE_OS_REPOS := riscv64,$(REPO_BASE_URL) |
| 79 | + else |
| 80 | + ifeq ($(ARCH), armhfp) |
| 81 | + BASE_OS_VERSION ?= 36 |
| 82 | + else |
| 83 | + BASE_OS_VERSION ?= 41 |
| 84 | + endif |
| 85 | + ifeq ($(ARCH), armhfp) |
| 86 | + ifneq ($(BASE_OS_VERSION), 36) |
| 87 | + $(error Fedora 36 is the last release supporting "armhfp", but $(BASE_OS_VERSION) was requested) |
| 88 | + endif |
| 89 | + endif |
| 90 | + LATEST_ARCHIVED_OS_VERSION := 41 |
| 91 | + ifeq ($(filter aarch64 x86_64 armhfp, $(ARCH)), ) |
| 92 | + FEDORA_TYPE := fedora-secondary |
| 93 | + else |
| 94 | + FEDORA_TYPE := fedora/linux |
| 95 | + endif |
| 96 | + NOT_ARCHIVED := $(shell [ $(BASE_OS_VERSION) -gt $(LATEST_ARCHIVED_OS_VERSION) ] && echo true) |
| 97 | + ifeq ($(NOT_ARCHIVED),true) |
| 98 | + RPM_REPO_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os |
| 99 | + else |
| 100 | + RPM_REPO_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os |
| 101 | + endif |
| 102 | + BASE_OS_REPOS := os,$(RPM_REPO_URL) |
| 103 | + endif |
| 104 | + BASE_OS_DESCRIPTION := Fedora_$(BASE_OS_VERSION) |
| 105 | +else |
| 106 | + $(error Unknown base OS $(BASE_OS)) |
| 107 | +endif |
0 commit comments