Add git repository to /src if applicable.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-08-14 17:25:10 +02:00
parent d85a0b70cc
commit 3648fce015
3 changed files with 71 additions and 3 deletions

View File

@ -43,6 +43,17 @@ SORTIX_RELEASE_DIR?=release
SORTIX_REPOSITORY_DIR?=repository
SORTIX_ISO_COMPRESSION?=xz
SORTIX_INCLUDE_SOURCE_GIT_REPO?=$(shell test -d .git && echo "file://`pwd`")
SORTIX_INCLUDE_SOURCE_GIT_REPO:=$(SORTIX_INCLUDE_SOURCE_GIT_REPO)
SORTIX_INCLUDE_SOURCE_GIT_ORIGIN?=
SORTIX_INCLUDE_SOURCE_GIT_CLONE_OPTIONS?=--single-branch
SORTIX_INCLUDE_SOURCE_GIT_BRANCHES?=master
ifneq ($(and $(shell which git 2>/dev/null),$(SORTIX_INCLUDE_SOURCE_GIT_REPO)),)
SORTIX_INCLUDE_SOURCE?=git
else
SORTIX_INCLUDE_SOURCE?=yes
endif
include build-aux/dirs.mak
BUILD_NAME:=sortix-$(VERSION)-$(MACHINE)
@ -189,6 +200,19 @@ sysroot-system: sysroot-fsh sysroot-base-headers
.PHONY: sysroot-source
sysroot-source: sysroot-fsh
ifeq ($(SORTIX_INCLUDE_SOURCE),git)
rm -rf "$(SYSROOT)/src"
git clone --no-hardlinks $(SORTIX_INCLUDE_SOURCE_GIT_CLONE_OPTIONS) -- $(SORTIX_INCLUDE_SOURCE_GIT_REPO) "$(SYSROOT)/src"
-cd "$(SYSROOT)/src" && for BRANCH in $(SORTIX_INCLUDE_SOURCE_GIT_BRANCHES); do \
git fetch origin $$BRANCH && \
git branch -f $$BRANCH FETCH_HEAD ; \
done
ifneq ($(SORTIX_INCLUDE_SOURCE_GIT_ORIGIN),)
cd "$(SYSROOT)/src" && git remote set-url origin $(SORTIX_INCLUDE_SOURCE_GIT_ORIGIN)
else
-cd "$(SYSROOT)/src" && git remote rm origin
endif
else ifneq ($(SORTIX_INCLUDE_SOURCE),no)
cp .gitignore -t "$(SYSROOT)/src"
cp COPYING-GPL -t "$(SYSROOT)/src"
cp COPYING-LGPL -t "$(SYSROOT)/src"
@ -196,6 +220,7 @@ sysroot-source: sysroot-fsh
cp README -t "$(SYSROOT)/src"
cp -RT build-aux "$(SYSROOT)/src/build-aux"
(for D in $(MODULES); do (cp -R $$D -t "$(SYSROOT)/src" && $(MAKE) -C "$(SYSROOT)/src/$$D" clean) || exit $$?; done)
endif
(cd "$(SYSROOT)" && find .) | sed 's/\.//' | \
grep -E '^/src(/.*)?$$' | \
LC_ALL=C sort > "$(SYSROOT)/tix/manifest/src"

View File

@ -8,8 +8,10 @@
.Pa /src
.Sh DESCRIPTION
Releases come with the system source code in
.Pa /src .
It can be modified, compiled and installed on the current system.
.Pa /src
as a
.Xr git 1
repository. It can be modified, compiled and installed on the current system.
The source code is built with a
.Xr make 1
build system. The source code can be located in any location, if so, simply
@ -138,6 +140,19 @@ Specifies compiler optimization options that gets added to
.Ev CFLAGS
and
.Ev CXXFLAGS .
.It Ev SORTIX_INCLUDE_SOURCE
Specifies whether the source code is included in the sysroot. This must be one
of
.Sy no, yes
or
.Sy git
and defaults to
.Sy git
if
.Xr git 1
is installed and
.Sy yes
otherwise.
.It Ev SORTIX_ISO_COMPRESSION
Specifies the compression algorithm used in iso files. This must be one of
.Sy none , gzip
@ -251,6 +266,30 @@ as not all ports can be built natively yet.
.Pp
The ports system is described in detail in
.Xr porting-guide 7 .
.Ss Patches
The source code is managed as a
.Xr git 1
repository and you can make your own changes and commit them. A good approach
is to set up your own local development branch and work there:
.Bd -literal
git checkout -b local
git add utils/hello.c
git commit -m 'Add hello(1).'
.Ed
.Pp
You can then easily prepare your a set of patches for upstream submission:
.Bd -literal
git format-patch master..local
.Ed
.Pp
This will create a series of .patch files containing your changes. Review them
and rewrite git history as needed until they are of submittable quality. You can
then submit them for review at the official website.
.Pp
To transfer files out of the operating system, you can either mount the local
root filesystem from another operating system with networking, or you transmit
the patches over the serial connection as described in
.Xr serial-transfer 7 .
.Ss Releases
CD-ROM release of the operating system can be built with the
.Sy iso
@ -272,7 +311,9 @@ target and prepare a
directory with a directory structure and miscellaneous files suitable for a
formal online release.
.Sh SEE ALSO
.Xr git 1 ,
.Xr make 1 ,
.Xr cross-development 7 ,
.Xr porting-guide 7 ,
.Xr serial-transfer 7 ,
.Xr update-initrd 8

View File

@ -83,7 +83,9 @@ file lists all currently installed ports.
.Ss Source Code
Releases come full with the system source code in
.Pa /src
along with the tools to build it and develop it. The build
as a
.Xr git 1
repository along with the tools to build it and develop it. The build
process is covered in
.Xr development 7 .
.Ss Mounting