latest changes
This commit is contained in:
parent
1a85b40353
commit
15b5656b7a
|
@ -1,2 +1,3 @@
|
|||
native-gcc
|
||||
repos
|
||||
repos
|
||||
.vscode
|
13
Dockerfile
13
Dockerfile
|
@ -1,3 +1,4 @@
|
|||
FROM walkero/lha-on-docker as lha-image
|
||||
# The ubuntu:latest tag points to the "latest LTS", since that's the version recommended for general use.
|
||||
FROM ubuntu:latest
|
||||
|
||||
|
@ -5,6 +6,8 @@ LABEL maintainer="Georgios Sokianos <walkero@gmail.com>"
|
|||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG REPOS_PATH
|
||||
ARG CLIB2_REPO
|
||||
COPY --from=lha-image /usr/bin/lha /usr/bin/lha
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
|
@ -48,16 +51,6 @@ RUN apt-get -y --no-install-recommends install \
|
|||
git config --global user.email "walkero@gmail.com"; \
|
||||
git config --global user.name "Georgios Sokianos";
|
||||
|
||||
# Install latest lha from git repo
|
||||
RUN git clone https://github.com/jca02266/lha.git && \
|
||||
mkdir build && \
|
||||
cd lha && \
|
||||
autoreconf -vfi && \
|
||||
cd ../build && \
|
||||
../lha/configure --prefix=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*;
|
||||
|
||||
# Add necessary repos
|
||||
ADD ${REPOS_PATH}/adtools /opt/adtools
|
||||
|
|
12
Makefile
12
Makefile
|
@ -1,10 +1,18 @@
|
|||
GCC ?= 8 # 8,9,10,11 can be used here
|
||||
CLIB2REPO ?= adtools # or use afxgroup
|
||||
CLIB2TAG :=
|
||||
|
||||
REPOSPATH ?= ./repos
|
||||
REPO ?= walkero/adtoolsbuilder
|
||||
TAG ?= adtools-build
|
||||
WORKSPACE ?= -w /opt/adtools
|
||||
NAME ?= adtools-build
|
||||
VOLUMES ?= -v "${PWD}/native-gcc":/gcc
|
||||
GCC ?= 8
|
||||
|
||||
ifeq ($(CLIB2REPO), afxgroup)
|
||||
override CLIB2TAG = -newclib2
|
||||
override TAG = adtools-build$(CLIB2TAG)
|
||||
endif
|
||||
|
||||
.PHONY: help build buildnc shell compile clonerepos pullrepos clean
|
||||
|
||||
|
@ -34,10 +42,12 @@ help:
|
|||
|
||||
build:
|
||||
docker build -t $(REPO):$(TAG) \
|
||||
--build-arg CLIB2_REPO=$(CLIB2REPO) \
|
||||
--build-arg REPOS_PATH=$(REPOSPATH) .
|
||||
|
||||
buildnc: pullrepos
|
||||
docker build --no-cache -t $(REPO):$(TAG) \
|
||||
--build-arg CLIB2_REPO=$(CLIB2REPO) \
|
||||
--build-arg REPOS_PATH=$(REPOSPATH) .
|
||||
|
||||
shell:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
gild/bin/gild checkout binutils ${BINUTILS_VER} && \
|
||||
gild/bin/gild checkout gcc ${GCC_VER} && \
|
||||
make -C native-build -j4
|
||||
make -C native-build SDK_VERSION=53.34 CLIB2_REPO=afxgroup -j4
|
||||
|
||||
# Prepare coreutils 5.2 (disabled)
|
||||
gild/bin/gild checkout coreutils 5.2
|
||||
|
@ -21,6 +21,6 @@ cd /opt/adtools/native-build
|
|||
# The following might fail on [ and need to run twice
|
||||
make native-install
|
||||
|
||||
make native-dist && \
|
||||
make native-dist SDK_VERSION=53.34 CLIB2_REPO=afxgroup && \
|
||||
make clib2-dist && \
|
||||
mv adtools-os4-*.lha /gcc
|
||||
|
|
|
@ -0,0 +1,556 @@
|
|||
#
|
||||
# This makefile drives the native build done on a non-native system, i.e.,
|
||||
# before building the native compiler, a cross compiler will be build.
|
||||
# We then build the native compiler using the freshly-built cross
|
||||
# compiler.
|
||||
#
|
||||
# The user running this script must have write access to /gcc
|
||||
#
|
||||
# Define CROSS_IS_PRESENT=1 if a suitable cross compiler is already
|
||||
# present, in which case the cross compiler build is skipped, e.g.:
|
||||
#
|
||||
# make CROSS_IS_PRESENT=1
|
||||
#
|
||||
|
||||
ROOT_DIR=$(realpath .)
|
||||
|
||||
# Compiler setup, utilize ccache if available
|
||||
CCACHE:=$(shell which ccache)
|
||||
HOST_GCC:=$(strip $(CCACHE) gcc)
|
||||
HOST_GXX:=$(strip $(CCACHE) g++)
|
||||
|
||||
GNU_SERVER=http://ftp.gnu.org/gnu
|
||||
# GNU_SERVER=http://ftp.vim.org/ftp/gnu
|
||||
|
||||
GMP_ARCHIVE=gmp-5.1.3.tar.bz2
|
||||
MPFR_ARCHIVE=mpfr-3.1.6.tar.bz2
|
||||
MPC_ARCHIVE=mpc-1.0.3.tar.gz
|
||||
|
||||
BINUTILS_VERSION=2.23.2
|
||||
BINUTILS_SRC_DIR=../binutils/repo
|
||||
|
||||
GCC_SRC_DIR=../gcc/repo
|
||||
GCC_VERSION:=$(shell cat $(GCC_SRC_DIR)/gcc/BASE-VER)
|
||||
GCC_DEV_PHASE:=$(shell cat ${GCC_SRC_DIR}/gcc/DEV-PHASE)
|
||||
|
||||
ifneq ($(GCC_DEV_PHASE),)
|
||||
GCC_DEV_PHASE:= ($(GCC_DEV_PHASE))
|
||||
endif
|
||||
|
||||
GCC_BRANCH_NAME:=$(word 1, $(subst ., , $(GCC_VERSION)))
|
||||
|
||||
# Setup SDK variables and URL
|
||||
SDK_VERSION:=53.30
|
||||
ifeq ($(SDK_VERSION), 53.34)
|
||||
FILEID=125
|
||||
else ifeq ($(SDK_VERSION), 54.16)
|
||||
FILEID=xxx
|
||||
else
|
||||
FILEID=82
|
||||
endif
|
||||
SDK_URL=https://www.hyperion-entertainment.biz/index.php?option=com_registration&view=download&format=raw&file=$(FILEID)&Itemid=$(FILEID)
|
||||
|
||||
# Native tools
|
||||
COREUTILS_SRC_DIR=../coreutils/repo
|
||||
COREUTILS_VERSION=5.2.1
|
||||
|
||||
# Distribution version, used as middle part of a distribution archive
|
||||
DIST_VERSION=$(shell date +%Y%m%d)-$(shell git rev-list --count HEAD)
|
||||
|
||||
ifeq ($(CLIB2_REPO), afxgroup)
|
||||
CLIB2_URL=https://github.com/afxgroup/clib2
|
||||
CLIB2_SHA1=52e57e91812ede8783a82c6d14fccec65c29ebf8
|
||||
CLIB2_DIR=downloads/clib2
|
||||
else
|
||||
CLIB2_URL=https://github.com/sodero/clib2
|
||||
CLIB2_SHA1=02ecf7d92448b5486502cd9e95fc838dca4804a7
|
||||
CLIB2_DIR=downloads/clib2/library
|
||||
endif
|
||||
# CLIB2_URL=https://github.com/sba1/clib2-1
|
||||
# CLIB2_SHA1=b874ff71deb55016a20f87483beb1ecbe226c55e
|
||||
CLIB2_RELEASE_ARCHIVE_NAME=adtools-os4-clib2-$(DIST_VERSION).lha
|
||||
|
||||
CROSS_PREFIX?=$(ROOT_DIR)/root-cross
|
||||
# This assumes that cross prefix is absolute
|
||||
DESTDIR?=
|
||||
|
||||
STRIP=$(CROSS_PREFIX)/bin/ppc-amigaos-strip
|
||||
STRIPFLAGS=--strip-all --strip-unneeded-rel-relocs -R.comment
|
||||
|
||||
all: gcc-native-done-$(GCC_VERSION)
|
||||
|
||||
#
|
||||
# Print the dist version that is used as suffix for various
|
||||
# suffixes.
|
||||
#
|
||||
.PHONY: print-dist-version
|
||||
print-dist-version:
|
||||
@echo $(DIST_VERSION)
|
||||
|
||||
#
|
||||
# Downloads clib2
|
||||
#
|
||||
downloads-done-clib2:
|
||||
mkdir -p downloads
|
||||
@echo "clib2 repo to be used: $(CLIB2_URL) $(CLIB2_REPO)"
|
||||
git clone $(CLIB2_URL) downloads/clib2 && \
|
||||
git -C downloads/clib2 checkout $(CLIB2_SHA1)
|
||||
|
||||
# This file is necessary so that shared libraries work with afxgroup's clib2
|
||||
ifeq ($(CLIB2_REPO), afxgroup)
|
||||
cp -f /opt/misc/clib2-afxgroup/amigaos.h /opt/adtools/gcc/repo/gcc/config/rs6000/
|
||||
endif
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Downloads the SDK and libraries necesseary to build the cross compiler
|
||||
#
|
||||
downloads-done: downloads-done-clib2
|
||||
ifeq ("$(wildcard /opt/misc/SDK_$(SDK_VERSION).lha)", "")
|
||||
wget "$(SDK_URL)" -O downloads/SDK_$(SDK_VERSION).lha
|
||||
else
|
||||
cp /opt/misc/SDK_$(SDK_VERSION).lha downloads/
|
||||
endif
|
||||
cd downloads && wget -N $(GNU_SERVER)/gmp/$(GMP_ARCHIVE)
|
||||
cd downloads && wget -N $(GNU_SERVER)/mpfr/$(MPFR_ARCHIVE)
|
||||
cd downloads && wget -N $(GNU_SERVER)/mpc/$(MPC_ARCHIVE)
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Builds the cross binutils package (assembler, etc).
|
||||
#
|
||||
binutils-cross-build-done-$(BINUTILS_VERSION):
|
||||
$(MAKE) -C ../binutils-build SRC_DIR=$(BINUTILS_SRC_DIR) PREFIX=$(CROSS_PREFIX) CROSS_BUILD_DIR=$(ROOT_DIR)/binutils-cross-build-$(BINUTILS_VERSION)
|
||||
touch $@
|
||||
|
||||
.PHONY: binutils-build
|
||||
binutils-build: binutils-cross-build-done-$(BINUTILS_VERSION)
|
||||
|
||||
#
|
||||
# Installs the cross binutils package (assembler, etc).
|
||||
#
|
||||
binutils-cross-done-$(BINUTILS_VERSION): binutils-cross-build-done-$(BINUTILS_VERSION)
|
||||
$(MAKE) -C $(ROOT_DIR)/binutils-cross-build-$(BINUTILS_VERSION) install DESTDIR=$(DESTDIR)
|
||||
touch $@
|
||||
|
||||
.PHONY: binutils-install
|
||||
binutils-install: binutils-cross-done-$(BINUTILS_VERSION)
|
||||
|
||||
#
|
||||
# Prepares the includes
|
||||
#
|
||||
includes-done: downloads-done
|
||||
mkdir -p $(CROSS_PREFIX)/ppc-amigaos/SDK/include
|
||||
cd downloads && lha x SDK_$(SDK_VERSION).lha
|
||||
|
||||
# TODO: Decide if we need to remove it
|
||||
# We built clib2 inplace
|
||||
# cd downloads/SDK_Install && lha xf clib2*.lha
|
||||
# cd downloads/SDK_Install && mv clib2* $(CROSS_PREFIX)/ppc-amigaos/SDK
|
||||
|
||||
ifeq ($(SDK_VERSION), 53.30)
|
||||
cd downloads/SDK_Install && lha xf newlib*.lha
|
||||
cd downloads/SDK_Install && mv newlib* $(CROSS_PREFIX)/ppc-amigaos/SDK
|
||||
endif
|
||||
|
||||
cd downloads/SDK_Install && lha xf base.lha
|
||||
cd downloads/SDK_Install && rm -Rf *.lha
|
||||
cd downloads/SDK_Install && mv Include/* $(CROSS_PREFIX)/ppc-amigaos/SDK/include
|
||||
|
||||
ifeq ($(SDK_VERSION), 53.34)
|
||||
cp -r /opt/misc/newlib/SDK/* $(CROSS_PREFIX)/ppc-amigaos/SDK
|
||||
cp -r /opt/misc/execsg_private_sdk/SDK/Include/* $(CROSS_PREFIX)/ppc-amigaos/SDK/include/
|
||||
endif
|
||||
|
||||
# TODO: Enable that
|
||||
# rm -Rf downloads/SDK_Install downloads/SDK_Install.info
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Path to the initial cross compiler or standard
|
||||
# cross compiler if a cross compiler is present
|
||||
#
|
||||
|
||||
ifeq ($(CROSS_IS_PRESENT),1)
|
||||
|
||||
XGCC=ppc-amigaos-gcc
|
||||
XGCC_CC=ppc-amigaos-gcc
|
||||
XAR=ppc-amigaos-ar -q
|
||||
XRANLIB=ppc-amigaos-ranlib
|
||||
|
||||
CLIB2_CROSS_DONE_DEPENDENCY=downloads-done-clib2
|
||||
|
||||
else
|
||||
|
||||
XGCC_DIR=$(abspath .)/gcc-cross-build-$(GCC_VERSION)/gcc
|
||||
XGCC=$(XGCC_DIR)/xgcc
|
||||
XGCC_CC=$(XGCC) -B $(XGCC_DIR)
|
||||
XAR=$(CROSS_PREFIX)/bin/ppc-amigaos-ar -q
|
||||
XRANLIB=$(CROSS_PREFIX)/bin/ppc-amigaos-ranlib
|
||||
|
||||
CLIB2_CROSS_DONE_DEPENDENCY=xgcc-done-$(GCC_VERSION)
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Prints the folder where the basic xg (xgcc or xg++) compilers
|
||||
# can be round.
|
||||
#
|
||||
.PHONY: print-xg-dir
|
||||
print-xg-dir:
|
||||
@echo $(XGCC_DIR)
|
||||
|
||||
#
|
||||
# Build only xgcc, no other stuff like libstdc++ etc.
|
||||
#
|
||||
xgcc-done-$(GCC_VERSION): includes-done binutils-cross-done-$(BINUTILS_VERSION)
|
||||
CC="$(HOST_GCC)" CXX="$(HOST_GXX)" $(MAKE) -C ../gcc-build cross-configure \
|
||||
SRC_DIR=$(GCC_SRC_DIR) \
|
||||
PREFIX=$(CROSS_PREFIX) \
|
||||
CROSS_BUILD_DIR=$(ROOT_DIR)/gcc-cross-build-$(GCC_VERSION) \
|
||||
VERSION=$(GCC_VERSION)
|
||||
$(MAKE) -C $(ROOT_DIR)/gcc-cross-build-$(GCC_VERSION) all-gcc
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Build clib2 via xgcc
|
||||
#
|
||||
clib2-cross-done-$(GCC_VERSION): $(CLIB2_CROSS_DONE_DEPENDENCY)
|
||||
ifeq ($(CLIB2_REPO), afxgroup)
|
||||
# Build clib2 using xgcc that have just been built
|
||||
$(MAKE) -C $(CLIB2_DIR) -f GNUmakefile.os4 \
|
||||
CC="$(XGCC_CC)" AR="$(XAR)" RANLIB="$(XRANLIB)" \
|
||||
SHARED=no INSTALL_PREFIX="$(CROSS_PREFIX)/ppc-amigaos/SDK/clib2"
|
||||
$(MAKE) -C $(CLIB2_DIR) -f GNUmakefile.os4 install \
|
||||
CC="$(XGCC_CC)" AR="$(XAR)" RANLIB="$(XRANLIB)" \
|
||||
SHARED=no INSTALL_PREFIX="$(CROSS_PREFIX)/ppc-amigaos/SDK/clib2"
|
||||
else
|
||||
# Build clib2 using xgcc that have just been built
|
||||
$(MAKE) -C $(CLIB2_DIR) -f GNUmakefile.os4 CC="$(XGCC_CC)" AR="$(XAR)" RANLIB="$(XRANLIB)"
|
||||
# Copy clib2 libs and includes
|
||||
rm -Rf $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/lib $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/include
|
||||
mkdir -p $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/lib
|
||||
mkdir -p $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/include
|
||||
cp -Rp $(CLIB2_DIR)/include/* $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/include
|
||||
cp -Rp $(CLIB2_DIR)/lib/* $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2/lib
|
||||
cp $(CLIB2_DIR)/../LICENSE $(CROSS_PREFIX)/ppc-amigaos/SDK/clib2
|
||||
endif
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Build the cross compiler
|
||||
#
|
||||
gcc-cross-done-$(GCC_VERSION): clib2-cross-done-$(GCC_VERSION)
|
||||
# Compile remaining
|
||||
$(MAKE) -C $(ROOT_DIR)/gcc-cross-build-$(GCC_VERSION)
|
||||
$(MAKE) -C $(ROOT_DIR)/gcc-cross-build-$(GCC_VERSION) install
|
||||
touch $@
|
||||
|
||||
.PHONY: gcc-cross
|
||||
gcc-cross: gcc-cross-done-$(GCC_VERSION)
|
||||
|
||||
#
|
||||
# Optional target for additional libs
|
||||
#
|
||||
.PHONY: additionals-libs
|
||||
additionals-libs:
|
||||
mkdir -p $(CROSS_PREFIX)/ppc-amigaos/SDK/local/common/include
|
||||
mkdir -p /tmp/abcd
|
||||
cd downloads && lha xw=/tmp/abcd SDK_$(SDK_VERSION).lha
|
||||
cd /tmp/abcd/SDK_Install && lha x pthread.lha && lha x zlib-1.2.3.lha
|
||||
cp -Rf /tmp/abcd/SDK_Install/Local/* $(CROSS_PREFIX)/ppc-amigaos/SDK/local
|
||||
rm -Rf /tmp/abcd
|
||||
|
||||
|
||||
ifeq ($(CROSS_IS_PRESENT),1)
|
||||
NATIVE_LIBRARY_DEPENDENCIES=downloads-done
|
||||
else
|
||||
NATIVE_LIBRARY_DEPENDENCIES=gcc-cross-done-$(GCC_VERSION)
|
||||
endif
|
||||
|
||||
#
|
||||
# Build and install the libraries
|
||||
#
|
||||
libraries-done: $(NATIVE_LIBRARY_DEPENDENCIES)
|
||||
cd downloads && tar -xjf $(notdir $(GMP_ARCHIVE))
|
||||
cd downloads && tar -xjf $(notdir $(MPFR_ARCHIVE))
|
||||
cd downloads && tar -xzf $(notdir $(MPC_ARCHIVE))
|
||||
cd $(basename $(basename downloads/$(notdir $(GMP_ARCHIVE)))) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" ./configure --host=ppc-amigaos --prefix=$(CROSS_PREFIX) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" make install
|
||||
cd $(basename $(basename downloads/$(notdir $(MPFR_ARCHIVE)))) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" ./configure --host=ppc-amigaos --prefix=$(CROSS_PREFIX) -with-gmp=$(CROSS_PREFIX) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" make install
|
||||
cd $(basename $(basename downloads/$(notdir $(MPC_ARCHIVE)))) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" ./configure --host=ppc-amigaos --prefix=$(CROSS_PREFIX) --with-gmp=$(CROSS_PREFIX) --with-mpfr=$(CROSS_PREFIX) && PATH="$(CROSS_PREFIX)/bin:$(PATH)" make install
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Build the native binutils
|
||||
#
|
||||
binutils-native-done-$(BINUTILS_VERSION): libraries-done
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C ../binutils-build native \
|
||||
SRC_DIR=$(BINUTILS_SRC_DIR) \
|
||||
PREFIX=/gcc \
|
||||
NATIVE_BUILD_DIR=$(ROOT_DIR)/binutils-native-build-$(BINUTILS_VERSION)
|
||||
touch $@
|
||||
|
||||
#
|
||||
# Build the native gcc
|
||||
#
|
||||
gcc-native-done-$(GCC_VERSION): binutils-native-done-$(BINUTILS_VERSION)
|
||||
mkdir -p $(ROOT_DIR)/root-native/gcc/include
|
||||
mkdir -p /gcc/include
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C ../gcc-build native \
|
||||
SRC_DIR=$(GCC_SRC_DIR) \
|
||||
PREFIX=/gcc \
|
||||
NATIVE_BUILD_DIR=$(ROOT_DIR)/gcc-native-build-$(GCC_VERSION) \
|
||||
VERSION=$(GCC_VERSION) \
|
||||
LIB_PATH=$(CROSS_PREFIX) \
|
||||
NATIVE_SYS_ROOT=$(ROOT_DIR)/root-native
|
||||
touch $@
|
||||
|
||||
ifeq ($(CROSS_IS_PRESENT),1)
|
||||
coreutils-native-done:
|
||||
else
|
||||
coreutils-native-done: gcc-cross-done-$(GCC_VERSION)
|
||||
endif
|
||||
mkdir -p coreutils-native-build
|
||||
@if [ ! -f $(COREUTILS_SRC_DIR)/configure ]; then echo "Please checkout coreutils first!"; false; fi
|
||||
# Pretend few files to be uptodate
|
||||
touch $(realpath $(COREUTILS_SRC_DIR))/configure $(realpath $(COREUTILS_SRC_DIR))/config.hin
|
||||
# cd coreutils-native-build ; PATH="$(CROSS_PREFIX)/bin:$(PATH)" LIBS="-lunix" $(realpath $(COREUTILS_SRC_DIR))/configure --prefix=/gcc --host=ppc-amigaos
|
||||
cd coreutils-native-build ; PATH="$(CROSS_PREFIX)/bin:$(PATH)" CPPFLAGS="-mcrt=clib2" LDFLAGS="-mcrt=clib2" LIBS="-lunix -lnet" $(realpath $(COREUTILS_SRC_DIR))/configure --prefix=/gcc --host=ppc-amigaos --disable-maintainer-mode
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C coreutils-native-build
|
||||
touch $@
|
||||
|
||||
|
||||
GCC_BASE_BRANCH_NAME=$(GCC_BRANCH_NAME)-base
|
||||
#
|
||||
# Build the main docs
|
||||
#
|
||||
.PHONY: doc
|
||||
doc:
|
||||
rm -Rf $@
|
||||
mkdir -p $@/tmp/orig
|
||||
mkdir -p $@/tmp/patched
|
||||
|
||||
echo "@set version-GCC $(GCC_VERSION)-adtools" >$@/tmp/orig/gcc-vers.texi
|
||||
echo "@set srcdir $(ROOT_DIR)/$(GCC_BASE_BRANCH_NAME)/gcc" >>$@/tmp/orig/gcc-vers.texi
|
||||
echo "@set BUGURL https://github.com/sba1/adtools/issues" >>$@/tmp/orig/gcc-vers.texi
|
||||
|
||||
echo "@set version-GCC $(GCC_VERSION)-adtools" >$@/tmp/patched/gcc-vers.texi
|
||||
echo "@set srcdir $(GCC_SRC_DIR)/gcc" >>$@/tmp/patched/gcc-vers.texi
|
||||
echo "@set BUGURL https://github.com/sba1/adtools/issues" >>$@/tmp/patched/gcc-vers.texi
|
||||
|
||||
# Checkout base branch as worktree
|
||||
cd $(GCC_SRC_DIR) && git worktree add -f $(ROOT_DIR)/$(GCC_BASE_BRANCH_NAME) $(GCC_BASE_BRANCH_NAME) || true
|
||||
cd $(ROOT_DIR)/$(GCC_BASE_BRANCH_NAME) && git checkout --detach $(GCC_BASE_BRANCH_NAME)
|
||||
|
||||
makeinfo --plaintext -I $(GCC_BASE_BRANCH_NAME)/gcc/doc -I $(GCC_BASE_BRANCH_NAME)/gcc/doc/include -I $@/tmp/orig -o $@/tmp/orig/gcc.txt $(GCC_BASE_BRANCH_NAME)/gcc/doc/gcc.texi
|
||||
makeinfo --plaintext -I $(GCC_BASE_BRANCH_NAME)/gcc/doc -I $(GCC_BASE_BRANCH_NAME)/gcc/doc/include -I $@/tmp/orig -o $@/tmp/orig/cpp.txt $(GCC_BASE_BRANCH_NAME)/gcc/doc/cpp.texi
|
||||
|
||||
makeinfo --plaintext -I $(GCC_SRC_DIR)/gcc/doc -I $(GCC_SRC_DIR)/gcc/doc/include -I $@/tmp/patched -o $@/tmp/patched/gcc.txt $(GCC_SRC_DIR)/gcc/doc/gcc.texi
|
||||
makeinfo --plaintext -I $(GCC_SRC_DIR)/gcc/doc -I $(GCC_SRC_DIR)/gcc/doc/include -I $@/tmp/patched -o $@/tmp/patched/cpp.txt $(GCC_SRC_DIR)/gcc/doc/cpp.texi
|
||||
|
||||
cd $@/tmp && bash -c "wdiff -n -w $$'\033[30;41m' -x $$'\033[0m' -y $$'\033[30;42m' -z $$'\033[0m' orig/gcc.txt patched/gcc.txt >../gcc.txt" || true
|
||||
cd $@/tmp && bash -c "wdiff -n -w $$'\033[30;41m' -x $$'\033[0m' -y $$'\033[30;42m' -z $$'\033[0m' orig/cpp.txt patched/cpp.txt >../cpp.txt" || true
|
||||
|
||||
rm -Rf $@/tmp
|
||||
#
|
||||
# Target for generating the ReadMe used for Aminet
|
||||
#
|
||||
ReadMe: ReadMe.mak
|
||||
python -c "\
|
||||
from mako.template import Template;\
|
||||
from mako.lookup import TemplateLookup;\
|
||||
print Template(\
|
||||
filename='$<',\
|
||||
input_encoding='utf-8',\
|
||||
output_encoding='utf-8',\
|
||||
lookup=TemplateLookup(['./'],input_encoding='utf-8')).render(\
|
||||
DIST_VERSION='$(DIST_VERSION)',\
|
||||
ADTOOLS_COMMIT_SHA1='$(shell git rev-list HEAD -1)',\
|
||||
BINUTILS_VERSION='$(BINUTILS_VERSION)',\
|
||||
GCC_VERSION='$(GCC_VERSION)',\
|
||||
GCC_DEV_PHASE='$(GCC_DEV_PHASE)',\
|
||||
COREUTILS_VERSION='$(COREUTILS_VERSION)',\
|
||||
CLIB2_RELEASE_ARCHIVE_NAME='$(CLIB2_RELEASE_ARCHIVE_NAME)'\
|
||||
)\
|
||||
" >$@.utf8
|
||||
iconv --from-code=UTF8 --to-code=ISO-8859-15 $@.utf8 >$@
|
||||
|
||||
# Function to make a file whose name is prefixed by the target alias
|
||||
# but which is the same as the given one.
|
||||
#
|
||||
# We use cp here until we know that softlinks would work properly.
|
||||
define MAKE_TARGET_ALIAS
|
||||
cp /gcc/bin/$(1) /gcc/bin/ppc-amigaos-$(1)
|
||||
endef
|
||||
|
||||
# A simple macro for inserting a newline
|
||||
define NL
|
||||
|
||||
|
||||
endef
|
||||
|
||||
#
|
||||
# Lists all executable files that are produced by the binutils steps
|
||||
# and that also should be reachable via a target alias prefix.
|
||||
#
|
||||
BINUTILS_EXES = \
|
||||
addr2line \
|
||||
ar \
|
||||
as \
|
||||
c++filt \
|
||||
elfedit \
|
||||
gprof \
|
||||
ld \
|
||||
ld.bfd \
|
||||
nm \
|
||||
objcopy \
|
||||
objdump \
|
||||
ranlib \
|
||||
readelf \
|
||||
size \
|
||||
strings \
|
||||
strip
|
||||
|
||||
#
|
||||
# Install native compiler into /gcc. Needs write access to this directory
|
||||
#
|
||||
native-install: coreutils-native-done gcc-native-done-$(GCC_VERSION) ReadMe doc
|
||||
rm -Rf /gcc/*
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C binutils-native-build-$(BINUTILS_VERSION) install
|
||||
# Create copies of few files that usually are also accessible via a filename with the target alias prefix
|
||||
$(foreach EXE, $(BINUTILS_EXES), $(call MAKE_TARGET_ALIAS,$(EXE))$(NL))
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C gcc-native-build-$(GCC_VERSION) install
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C coreutils-native-build install
|
||||
# Disabled SDK as we don't want to distribute it
|
||||
# cp -R $(CROSS_PREFIX)/ppc-amigaos/SDK /gcc
|
||||
# Disabled, because we don't want to copy from CROSS_PREFIX here
|
||||
# cp -Rf $(CROSS_PREFIX)/lib/gcc/ppc-amigaos /gcc/lib/gcc/
|
||||
# Delete all but our target gcc libs
|
||||
find /gcc/lib/gcc/ppc-amigaos -mindepth 1 -maxdepth 1 -not -name $(GCC_VERSION) | xargs rm -Rf
|
||||
# Disabled, no longer required
|
||||
# # Move lib archives (e.g., libgcc.a into the proper directory)
|
||||
# cd /gcc/lib/gcc ; for lib in `find -name *.a -o -name *.so`; do mkdir -p `dirname $$lib`/lib; mv $$lib `dirname $$lib`/lib ; done
|
||||
cp ReadMe /gcc
|
||||
mkdir -p /gcc/doc
|
||||
cp doc/* /gcc/doc
|
||||
|
||||
#
|
||||
# Similar to native-install but deploys the components in separate directories
|
||||
#
|
||||
native-separate-install:
|
||||
rm -Rf root-native-binutils
|
||||
rm -Rf root-native-gcc
|
||||
rm -Rf root-native-coreutils
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C binutils-native-build-$(BINUTILS_VERSION) install DESTDIR=$(ROOT_DIR)/root-native-binutils
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C gcc-native-build-$(GCC_VERSION) install DESTDIR=$(ROOT_DIR)/root-native-gcc
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C coreutils-native-build install DESTDIR=$(ROOT_DIR)/root-native-coreutils
|
||||
$(MAKE) private-native-separate-dist
|
||||
|
||||
# Private target. Unfinished
|
||||
private-native-separate-dist:
|
||||
$(foreach var,$(wildcard $(ROOT_DIR)/root-native-coreutils/gcc/bin/*), $(STRIP) $(STRIPFLAGS) $(var) ; ) true
|
||||
$(foreach var,$(wildcard $(ROOT_DIR)/root-native-binutils/gcc/bin/*), $(STRIP) $(STRIPFLAGS) $(var) ; ) true
|
||||
$(foreach var,$(wildcard $(ROOT_DIR)/root-native-gcc/gcc/bin/*), $(STRIP) $(STRIPFLAGS) $(var) ; ) true
|
||||
$(STRIP) $(STRIPFLAGS) $(ROOT_DIR)/root-native-gcc/gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/cc1
|
||||
$(STRIP) $(STRIPFLAGS) $(ROOT_DIR)/root-native-gcc/gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/cc1plus
|
||||
$(STRIP) $(STRIPFLAGS) $(ROOT_DIR)/root-native-gcc/gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/lto1
|
||||
$(STRIP) $(STRIPFLAGS) $(ROOT_DIR)/root-native-gcc/gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/lto-wrapper
|
||||
rm -Rf dist
|
||||
mkdir -p dist/coreutils-$(COREUTILS_VERSION)-$(DIST_VERSION)
|
||||
|
||||
#
|
||||
# Strip native files
|
||||
#
|
||||
native-strip:
|
||||
# Invoke make recursively with another target so that $(wildcard) is properly resolved.
|
||||
$(MAKE) native-strip-really
|
||||
|
||||
native-strip-really:
|
||||
$(foreach var,$(wildcard /gcc/bin/*), $(STRIP) --strip-all --strip-unneeded-rel-relocs $(var) ; ) true
|
||||
$(STRIP) $(STRIPFLAGS) /gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/cc1
|
||||
$(STRIP) $(STRIPFLAGS) /gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/cc1plus
|
||||
$(STRIP) $(STRIPFLAGS) /gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/lto1
|
||||
$(STRIP) $(STRIPFLAGS) /gcc/libexec/gcc/ppc-amigaos/$(GCC_VERSION)/lto-wrapper
|
||||
|
||||
#
|
||||
# Native distribution archive
|
||||
#
|
||||
DIST_FOLDER:=adtools-os4-$(GCC_BRANCH_NAME)-$(DIST_VERSION)
|
||||
|
||||
native-dist: native-strip-really
|
||||
rm -f $(realpath .)/$(DIST_FOLDER).lha
|
||||
rm -Rf /tmp/$(DIST_FOLDER)
|
||||
mkdir /tmp/$(DIST_FOLDER)
|
||||
cp -pR /gcc/* /tmp/$(DIST_FOLDER)
|
||||
|
||||
# Deduplicate
|
||||
../bin/dedup /tmp/$(DIST_FOLDER) >.dedup
|
||||
echo "; Create alternative filenames" >/tmp/$(DIST_FOLDER)/RestoreLinks
|
||||
../bin/dedup /tmp/$(DIST_FOLDER) --amigaos --folder-is-pwd >>/tmp/$(DIST_FOLDER)/RestoreLinks
|
||||
# Disbaled until we find a way to keep softlinks via lha
|
||||
# sh -x .dedup
|
||||
# rm .dedup
|
||||
|
||||
cd /tmp && lha -aq2o6 $(realpath .)/$(DIST_FOLDER).lha $(DIST_FOLDER)/*
|
||||
|
||||
#
|
||||
# Clib2 distribution
|
||||
#
|
||||
clib2-dist: clib2-cross-done-$(GCC_VERSION)
|
||||
cd root-cross/ppc-amigaos/SDK && lha -aq2o6 $(realpath .)/$(CLIB2_RELEASE_ARCHIVE_NAME) clib2
|
||||
|
||||
#
|
||||
# Upload the binary archive to the main Aminet server
|
||||
#
|
||||
.PHONY: upload-release
|
||||
upload-release: native-dist
|
||||
ln -s $(DIST_FOLDER).lha adtools-$(GCC_BRANCH_NAME)-os4.lha
|
||||
lftp -e "put adtools-$(GCC_BRANCH_NAME)-os4.lha && put ReadMe -o adtools-$(GCC_BRANCH_NAME)-os4.readme && quit" ftp://main.aminet.net/new
|
||||
|
||||
#
|
||||
# Cleanup clib2
|
||||
#
|
||||
|
||||
.PHONY: clean-clib2
|
||||
clean-clib2:
|
||||
test ! -d $(CLIB2_DIR) && true || $(MAKE) -C $(CLIB2_DIR) -f GNUmakefile.os4 clean
|
||||
|
||||
#
|
||||
# Cleanup gcc only
|
||||
#
|
||||
|
||||
.PHONY: clean-gcc
|
||||
clean-gcc:
|
||||
rm -Rf \
|
||||
xgcc-done-$(GCC_VERSION) \
|
||||
gcc-cross-build-$(GCC_VERSION) \
|
||||
gcc-cross-done-$(GCC_VERSION) \
|
||||
gcc-native-build-$(GCC_VERSION) \
|
||||
gcc-native-done-$(GCC_VERSION)
|
||||
|
||||
#
|
||||
# Cleanup everything
|
||||
#
|
||||
.PHONY: clean
|
||||
clean: clean-clib2 clean-gcc
|
||||
rm -Rf \
|
||||
binutils-cross-build-$(BINUTILS_VERSION) \
|
||||
binutils-native-build-$(BINUTILS_VERSION) \
|
||||
$(CROSS_PREFIX) \
|
||||
build-cross-done \
|
||||
binutils-cross-build-done-$(BINUTILS_VERSION) \
|
||||
binutils-cross-done-$(BINUTILS_VERSION) \
|
||||
binutils-native-done-$(BINUTILS_VERSION) \
|
||||
clib2-cross-done-$(GCC_VERSION) \
|
||||
includes-done \
|
||||
libraries-done \
|
||||
root-native \
|
||||
coreutils-native-build \
|
||||
coreutils-native-done
|
||||
|
||||
#
|
||||
# Cleanup really everything
|
||||
#
|
||||
.PNONY: clean-all
|
||||
clean-all: clean
|
||||
rm -Rf downloads-done downloads-done-clib2 downloads
|
|
@ -273,7 +273,8 @@ endif
|
|||
# Pretend few files to be uptodate
|
||||
touch $(realpath $(COREUTILS_SRC_DIR))/configure $(realpath $(COREUTILS_SRC_DIR))/config.hin
|
||||
# cd coreutils-native-build ; PATH="$(CROSS_PREFIX)/bin:$(PATH)" LIBS="-lunix" $(realpath $(COREUTILS_SRC_DIR))/configure --prefix=/gcc --host=ppc-amigaos
|
||||
cd coreutils-native-build ; PATH="$(CROSS_PREFIX)/bin:$(PATH)" CPPFLAGS="-mcrt=clib2" LDFLAGS="-mcrt=clib2" LIBS="-lunix -lnet" $(realpath $(COREUTILS_SRC_DIR))/configure --prefix=/gcc --host=ppc-amigaos --disable-maintainer-mode
|
||||
cd coreutils-native-build ; PATH="$(CROSS_PREFIX)/bin:$(PATH)" CPPFLAGS="-mcrt=clib2" LDFLAGS="-mcrt=clib2" LIBS="-lunix -lnet" $(realpath $(COREUTILS_SRC_DIR))/configure --prefix=/gcc --host=ppc-amigaos
|
||||
# --disable-maintainer-mode
|
||||
PATH="$(CROSS_PREFIX)/bin:$(PATH)" $(MAKE) -C coreutils-native-build
|
||||
touch $@
|
||||
|
||||
|
|
Loading…
Reference in New Issue