From aff92004d1e9022bdf7ef9d16e5b2f49672da9a4 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 23 May 2014 13:37:21 +0200 Subject: [PATCH] base-pistachio: migrate to new ports mechanism Issue #1082 --- repos/base-pistachio/Makefile | 68 +---------------------- repos/base-pistachio/lib/mk/platform.mk | 5 +- repos/base-pistachio/ports/pistachio.hash | 1 + repos/base-pistachio/ports/pistachio.port | 34 ++++++++++++ repos/base-pistachio/src/kernel/target.mk | 2 +- 5 files changed, 40 insertions(+), 70 deletions(-) create mode 100644 repos/base-pistachio/ports/pistachio.hash create mode 100644 repos/base-pistachio/ports/pistachio.port diff --git a/repos/base-pistachio/Makefile b/repos/base-pistachio/Makefile index 1b8e55d76..ba10c4fab 100644 --- a/repos/base-pistachio/Makefile +++ b/repos/base-pistachio/Makefile @@ -1,67 +1 @@ -# -# \brief Checkout Pistachio and additional needed tools (kickstart) -# \author Stefan Kalkowski -# \date 2011-07-15 -# - -VERBOSE = @ -ECHO = @echo -GIT_URI = https://github.com/l4ka/pistachio.git -GIT_REV = 76bac3d926dc707c6a3243b38c1505d2b5b6537b -CONTRIB_DIR = contrib -SHELL = bash -PATCHES = $(shell find patches -name *.patch) - -# -# Utility to check if a tool is installed -# -check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) - -$(call check_tool,git) -$(call check_tool,patch) -$(call check_tool,sed) -$(call check_tool,autoheader) -$(call check_tool,autoconf) - -# -# Determine python version to use for CML2 -# -PYTHON2 := $(notdir $(lastword $(shell which python2 $(addprefix python2.,4 5 6 7 8)))) -ifeq ($(PYTHON2),) -prepare: python_not_installed -python_not_installed: - $(ECHO) "Error: CML2 Configuration System needs Python 2 to be installed" - @false; -endif - -# -# Print help information by default -# -help:: - $(ECHO) - $(ECHO) "Check out upstream source code of Pistachio" - $(ECHO) - $(ECHO) "The source code will be located at the '$(CONTRIB_DIR)/' directory." - $(ECHO) - $(ECHO) "--- available commands ---" - $(ECHO) "prepare - checkout upstream source codes" - $(ECHO) "clean - remove upstream source codes" - $(ECHO) - -$(CONTRIB_DIR): - $(VERBOSE)git clone $(GIT_URI) contrib - -prepare: $(CONTRIB_DIR) - $(VERBOSE)cd $(CONTRIB_DIR); git fetch; git reset --hard $(GIT_REV) - $(ECHO) "applying patches to '$(CONTRIB_DIR)/'" - $(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done - @# use GCC front end for as linker for the pistachio user land - $(VERBOSE)sed -i "/LD=/s/^.*$$/LD=\$$(CC)/" $(CONTRIB_DIR)/user/config.mk.in - @# add '-Wl,' prefix to '-melf_*' linker options - $(VERBOSE)sed -i "s/-melf_/-Wl,-melf_/" `grep -rl melf_ $(CONTRIB_DIR)/user` - $(VERBOSE)for i in cmlcompile.py cmlconfigure.py configtrans.py; do \ - sed -i "s/env python/env $(PYTHON2)/" $(CONTRIB_DIR)/contrib/cml2/$$i; done - $(VERBOSE)cd $(CONTRIB_DIR)/user; autoheader; autoconf; - -clean:: - $(VERBOSE)rm -rf $(CONTRIB_DIR) +include ../../tool/prepare.mk diff --git a/repos/base-pistachio/lib/mk/platform.mk b/repos/base-pistachio/lib/mk/platform.mk index efb3cc3f5..82bcf24ae 100644 --- a/repos/base-pistachio/lib/mk/platform.mk +++ b/repos/base-pistachio/lib/mk/platform.mk @@ -11,6 +11,7 @@ ifeq ($(called_from_lib_mk),yes) all: $(filter-out $(wildcard $(PISTACHIO_USER_BUILD_DIR)), $(PISTACHIO_USER_BUILD_DIR)) LD_PREFIX = "-Wl," +PISTACHIO_CONTRIB_DIR := $(call select_from_ports,pistachio)/src/kernel/pistachio $(PISTACHIO_USER_BUILD_DIR): $(VERBOSE)mkdir $@ @@ -18,8 +19,8 @@ $(PISTACHIO_USER_BUILD_DIR): LIBGCCFLAGS="$(CC_MARCH)" \ LDFLAGS="$(addprefix $(LD_PREFIX),$(LD_MARCH)) -nostdlib" \ CFLAGS="$(CC_MARCH)" \ - $(REP_DIR)/contrib/user/configure --build=ia32 --host i686 \ - CC=$(CROSS_DEV_PREFIX)gcc + $(PISTACHIO_CONTRIB_DIR)/user/configure --build=ia32 --host i686 \ + CC=$(CROSS_DEV_PREFIX)gcc $(VERBOSE_MK) MAKEFLAGS= $(MAKE) $(VERBOSE_DIR) -C $@ endif diff --git a/repos/base-pistachio/ports/pistachio.hash b/repos/base-pistachio/ports/pistachio.hash new file mode 100644 index 000000000..2995a4d0e --- /dev/null +++ b/repos/base-pistachio/ports/pistachio.hash @@ -0,0 +1 @@ +dummy \ No newline at end of file diff --git a/repos/base-pistachio/ports/pistachio.port b/repos/base-pistachio/ports/pistachio.port new file mode 100644 index 000000000..4a2464876 --- /dev/null +++ b/repos/base-pistachio/ports/pistachio.port @@ -0,0 +1,34 @@ +LICENSE := BSD +VERSION := git +DOWNLOADS := pistachio.git +URL(pistachio) := https://github.com/l4ka/pistachio.git +REV(pistachio) := 76bac3d926dc707c6a3243b38c1505d2b5b6537b +DIR(pistachio) := src/kernel/pistachio +PATCHES := $(shell find $(REP_DIR)/patches -name *.patch) +PATCH_OPT := -p1 -d src/kernel/pistachio + +$(call check_tool,git) +$(call check_tool,patch) +$(call check_tool,sed) +$(call check_tool,autoheader) +$(call check_tool,autoconf) + +# +# Determine python version to use for CML2 +# +PYTHON2 := $(notdir $(lastword $(shell which python2 $(addprefix python2.,4 5 6 7 8)))) +ifeq ($(PYTHON2),) +default: python_not_installed +python_not_installed: + $(error CML2 Configuration System needs Python 2 to be installed) +endif + +default : additional_steps +additional_steps : $(DOWNLOADS) + @# use GCC front end for as linker for the pistachio user land + $(VERBOSE)sed -i "/LD=/s/^.*$$/LD=\$$(CC)/" src/kernel/pistachio/user/config.mk.in + @# add '-Wl,' prefix to '-melf_*' linker options + $(VERBOSE)sed -i "s/-melf_/-Wl,-melf_/" `grep -rl melf_ src/kernel/pistachio/user` + $(VERBOSE)for i in cmlcompile.py cmlconfigure.py configtrans.py; do \ + sed -i "s/env python/env $(PYTHON2)/" src/kernel/pistachio/contrib/cml2/$$i; done + $(VERBOSE)cd src/kernel/pistachio/user; autoheader; autoconf; diff --git a/repos/base-pistachio/src/kernel/target.mk b/repos/base-pistachio/src/kernel/target.mk index 29f5234f5..58d56e10d 100644 --- a/repos/base-pistachio/src/kernel/target.mk +++ b/repos/base-pistachio/src/kernel/target.mk @@ -2,7 +2,7 @@ TARGET = kernel REQUIRES += pistachio KERNEL_BUILD_DIR = $(BUILD_BASE_DIR)/kernel/pistachio KERNEL = $(KERNEL_BUILD_DIR)/x86-kernel -KERNEL_SRC = $(REP_DIR)/contrib/kernel +KERNEL_SRC := $(call select_from_ports,pistachio)/src/kernel/pistachio/kernel STARTUP_LIB = LIBGCC_DIR = $(dir $(shell $(CC) $(CC_MARCH) -print-libgcc-file-name))