Build to local directory and install as separate optional step.

This commit is contained in:
David Brown 2016-12-09 17:47:48 +00:00
parent c41cb011b6
commit d12393cc8c
12 changed files with 383 additions and 269 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
/Configuration.Mod
/Configuration.Make
/build/*
/install/*
/*.exe
/*.obj
/*.[cho]

View file

@ -27,8 +27,16 @@ default libraries complying with the Oakwood Guidelines for Oberon-2 compilers.
## Installation
While pre-built packages are not provided, it is easy to install the Oberon compiler and libraries
with the following simple steps.
It is easy to install the Oberon compiler and libraries
with the following simple steps:
1. Install pre-requisites such as git, gcc, static C libraries, diff utils.
2. Clone the repository and run 'make full'.
3. Optionally install to a system directory such as /opt or /usr/local/share.
4. Set your PATH variable to include the compiler binary.
These are detailed below:
#### 1. Install prerequisites
@ -43,28 +51,57 @@ with the following simple steps.
More details, including for MingW and MS C, in [**Installation**](/doc/Installation.md).
#### 2. Build and install the compiler and libraries
#### 2. Clone and build the compiler and libraries
1. `git clone https://github.com/vishaps/voc`
2. `cd voc`
3. `[sudo] make full`
3. `make full`
Since 'make full' will install the compiler and libraries, it needs root (unix) or administrator (windows) privileges.
`make full` will create an installation directory under your local repository at voc/install.
#### 3. Set your PATH environment variable
`mmake full` runs `ldconfig` to configure the linker to find libraries in voc/install, but you
need to update your program search PATH yourself (see step 4 below).
Set your path to the installed compiler binary location as reported
by make full, e.g.
| System | Set path |
| --------- | -------------------------------------- |
| Linux | `export PATH="/opt/voc/bin:$PATH"` |
| BSD | `export PATH="/usr/local/share/voc/bin:$PATH"` |
| Windows | See [Installation](/doc/Installation.md) |
| Termux | `export PATH="/data/data/com.termux/files/opt/voc/bin:$PATH"` |
#### 3. Optionally install to a system directory
Run `make install` as root to copy the voc/install directory to the appropriate directory
for your OS as follows:
| System | Where `make install` puts the installation |
| ------- | -------------------------------------- |
| Linux | `/opt/voc` |
| BSD | `/usr/local/share/voc` |
| Windows | See [**Windows installation**](/doc/WInstallation.md) |
| Termux | `/data/data/com.termux/files/opt/voc` |
`make install` updates `ldconfg` with the new library locations.
#### 4. Set your PATH environment variable
Since there are so many ways that different systems and users manage their PATHs, we leave
it to you to update your path to include the compiler binary.
Both `make full` and `make install` display instructions on setting the path specific to your
system.
For reference this will be:
| Installation choice | Set path |
| --------- | -------------------------------------- |
| Just `make full` | `export PATH="your-repository-clone/install/bin:$PATH"` |
| `make install` on Linux | `export PATH="/opt/voc/bin:$PATH"` |
| `make install` on BSD | `export PATH="/usr/local/share/voc/bin:$PATH"` |
| `make install` on Windows | See [**Windows installation**](/doc/WInstallation.md) |
| `make install` on Termux | `export PATH="/data/data/com.termux/files/opt/voc/bin:$PATH"` |
Also see [**Installation**](/doc/Installation.md).
The compiler finds the rest of the installation based on the location from which it is loaded.
## A 'Hello' application
@ -99,12 +136,15 @@ Compile as follows:
The -m parameter tells voc that this is a main module, and to generate an
executable binary.
Execute as usual on Linux ('./hello') or Windows ('hello').
Execute as usual on Linux (`./hello`) or Windows (`hello`).
In order to know module's interface, use "showdef" program.
### Viewing the interfaces of included modules.
In order to see the definition of a module's interface, use the "showdef" program.
```
$ showdef Out.sym
$ showdef Out.sym
DEFINITION Out;
VAR
@ -118,12 +158,10 @@ DEFINITION Out;
PROCEDURE Open;
PROCEDURE Real(x: REAL; n: INT16);
PROCEDURE String(str: ARRAY OF CHAR);
PROCEDURE Ten(e: INT16): LONGREAL;
END Out.
```
Also see [**Compiling**](/doc/Compiling.md).
## Licensing

View file

@ -2,10 +2,7 @@
The Oberon compiler and libraries may be built and installed on Linux based, BSD based or Windows based systems.
Building on Linux and BSD based systems is reasonably straightforward. First make sure you have the right pre-requites like a C compiler and static libraries installed, then clone the repository and run `make full`.
Full instructions for a Linux/BSD based build follow in the next section.
### Windows systems
Bulding on Windows is not so simple largely because there is more than one way to do it:
@ -30,8 +27,6 @@ Bulding on Windows is not so simple largely because there is more than one way t
For full details about building with Cygwin or native Microsoft C environments see [**Cygwin and MSC Installation**](/doc/Winstallation.md)
The following sections provide more details for Linux based builds.
### Building the Oberon compiler and libraries on a Linux or BSD based system
@ -42,6 +37,7 @@ This approach is for
- All BSD based systems
- includes macOS (Darwin)
#### 1. Install pre-requisites
The build process has the following pre-requisites:
@ -63,6 +59,7 @@ Example pre-requisite installation commands:
On Mac OS (Darwin) just type the git command. OS/X will tell you that it is not installed and ask if you want to install it (say yes). Note that Darwin builds always use clang, the OS will redirect attempts to use gcc to clang.
#### 2. Clone the Oberon compiler repository
Create and change to a directory in which to make the compiler and clone with this command:
@ -79,8 +76,8 @@ This will create a subdirectory 'voc' which includes the following files and dir
| makefile | Makefile for all BSD- and Linux- like environments. Includes tests. |
| make.cmd | Makefile specifically for native Microsoft C builds. No tests. |
#### 3. Build and install the Oberon compiler and library
#### 3. Build and install the Oberon compiler and library
```
cd voc
@ -96,12 +93,9 @@ The makefile will:
link the final Oberon compiler. This compiler is then used for the remaining steps.
- Build the .sym file browser command `showdef`.
- Build all the libraries in -O2 mode, and a subset in -OC mode.
- Install the compiler and libraries by copying them to an appropriate location for your OS.
- Create an installation directory structure local to your copy of the repository.
- Run a set of confidence tests.
Since installation directories are not generally write accessible to normal users, is is necessary to run
the `make full` command from a root shell, or by using `sudo`.
The makefile will use either gcc or clang, whichever is installed. If you have both installed you can specify which to use by running either `export CC=gcc` or `export CC=clang` before the `make full` command.
@ -110,15 +104,28 @@ The makefile will use either gcc or clang, whichever is installed. If you have b
If the makefile succeeds it will end with instructions on how to set your path variable so that the
compiler (voc) is found.
The installation will be found at:
#### Installing to system directories
You may optionally install to system directories such as /opt or /usr/local/share.
First be sure to have completed `make full` successfully.
Then from a root prompt, or using sudo, run `make install`
The installation will be made to:
| System | Install dir |
| ----------------------- | -------------------------------------- |
| All types of Linux | /opt/voc |
| BSD (including Darwin) | /usr/local/share/voc |
| Termux (android) | /data/data/com.termux/files/opt/voc | |
| Termux (android) | /data/data/com.termux/files/opt/voc |
The installation directory contains:
As with `make full`, `make install` will exit with instructions on how to set
your PATH.
#### Installation directory contentains:
| Directory | Content |
| --- | --- |

View file

@ -73,8 +73,8 @@ usage:
@echo ""
@echo " make full"
@echo ""
@echo " Does a full, clean build, installs it, and runs confidence tests."
@echo " Requires root access (for the install) except on cygwin."
@echo " Does a full, clean build, and runs confidence tests."
@echo " An installation directory image is left in the local repository install directory."
@echo ""
@echo "Targets for building and installation:"
@echo " make clean - Clean out the build directory"
@ -134,8 +134,6 @@ clean: configuration
# full: Full build of compiler and libarary.
full: configuration
@make -f src/tools/make/oberon.mk -s installable
@-make -f src/tools/make/oberon.mk -s uninstall
@make -f src/tools/make/oberon.mk -s clean
# Make bootstrap compiler from source suitable for current data model
@printf "\n\n--- Compiler build started ---\n\n"
@ -153,10 +151,10 @@ full: configuration
@make -f src/tools/make/oberon.mk -s library MODEL=C
@printf "\n\n--- Library build successfull ---\n\n"
@make -f src/tools/make/oberon.mk -s sourcechanges
@make -f src/tools/make/oberon.mk -s install
@make -f src/tools/make/oberon.mk -s makeinstalldir
@printf "\n\n--- Confidence tests started ---\n\n"
@make -f src/tools/make/oberon.mk -s confidence MODEL=2
@make -f src/tools/make/oberon.mk -s showpath
@make -f src/tools/make/oberon.mk -s instructions
assemble:
@ -221,14 +219,16 @@ s3: configuration
# makeinstalldir: Copy built files to local install directory
makeinstalldir:
@make -f src/tools/make/oberon.mk -s makeinstalldir
# install: Copy built files to install directory
install: configuration
@make -f src/tools/make/oberon.mk -s installable
@make -f src/tools/make/oberon.mk -s install MODEL=2
@make -f src/tools/make/oberon.mk -s showpath MODEL=2
@make -f src/tools/make/oberon.mk -s install
uninstall: configuration
@make -f src/tools/make/oberon.mk -s installable
@make -f src/tools/make/oberon.mk -s uninstall

View file

@ -229,6 +229,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
LogWStr("Oberon-2 compiler v"); LogWStr(Configuration.versionLong); LogW("."); LogWLn;
LogWStr("Based on Ofront by J. Templ and Software Templ OEG."); LogWLn;
LogWStr("Further development by Norayr Chilingarian, David Brown and others."); LogWLn;
LogWStr("Loaded from "); LogWStr(Modules.BinaryDir); LogWLn;
LogWLn;
LogWStr("Usage:"); LogWLn;
LogWLn;

View file

@ -67,7 +67,7 @@ PROCEDURE LinkMain*(VAR moduleName: ARRAY OF CHAR; statically: BOOLEAN; addition
Strings.Append(Configuration.objflag, cmd);
Strings.Append(moduleName, cmd);
Strings.Append(Configuration.linkflags, cmd);
Strings.Append(Configuration.installdir, cmd);
Strings.Append(OPM.InstallDir, cmd);
Strings.Append('/lib"', cmd);
Strings.Append(Configuration.libspec, cmd);
Strings.Append('-O', cmd);

View file

@ -112,7 +112,10 @@ MODULE Modules; (* jt 6.1.96 *)
VAR i,j: INTEGER;
BEGIN
i := 0; j := CharCount(d);
(* Append delimiter c to d only if d is either empty or doesn not
already end in c. *)
IF (j > 0) & (d[j-1] # c) THEN d[j] := c; INC(j) END;
(* Append s to d *)
WHILE s[i] # 0X DO d[j] := s[i]; INC(i); INC(j) END;
d[j] := 0X;
END AppendPart;
@ -144,7 +147,9 @@ MODULE Modules; (* jt 6.1.96 *)
PROCEDURE IsFilePresent(s: ARRAY OF CHAR): BOOLEAN;
VAR identity: Platform.FileIdentity;
BEGIN RETURN Platform.IdentifyByName(s, identity) = 0
BEGIN
(*Out.String("IsFilePresent("); Out.String(s); Out.String(")."); Out.Ln;*)
RETURN Platform.IdentifyByName(s, identity) = 0
END IsFilePresent;
PROCEDURE ExtractPart(s: ARRAY OF CHAR; VAR i: INTEGER; p: ARRAY OF CHAR; VAR d: ARRAY OF CHAR);
@ -181,45 +186,50 @@ MODULE Modules; (* jt 6.1.96 *)
END;
END Trim;
PROCEDURE FindBinaryDir(VAR d: ARRAY OF CHAR);
PROCEDURE FindBinaryDir(VAR binarydir: ARRAY OF CHAR);
TYPE pathstring = ARRAY 4096 OF CHAR;
VAR
executable: pathstring;
dir: pathstring;
testpath: pathstring;
pathlist: pathstring;
arg0: pathstring; (* The command exactly as passed by the shell *)
pathlist: pathstring; (* The whole PATH environment variable *)
pathdir: pathstring; (* A single directory from the PATH *)
tempstr: pathstring;
i, j, k: INTEGER;
present: BOOLEAN;
BEGIN
IF ArgCount < 1 THEN
(* Shells and GUIs always pass the command as ARGV[0]. *)
d[0] := 0X;
(* The caller is misbehaving: Shells and GUIs always pass the command
as ARGV[0]. *)
binarydir[0] := 0X;
RETURN;
END;
(* First try ARGV[0] without looking at the PATH environment variable. *)
GetArg(0, testpath); Trim(testpath, executable);
Canonify(executable, d); present := IsFilePresent(d);
IF (~present) & (~IsAbsolute(testpath)) THEN
(* ARGV[0] alone didn't work, try non-absolute ARGV[0] with every entry in path. *)
GetArg(0, arg0); (* arg0 is the command binary file name passed by the shell. *)
i := 0; WHILE (arg0[i] # 0X) & (arg0[i] # '/') DO INC(i) END;
IF arg0[i] = '/' THEN
(* The argument contains a '/', we expect it to work without reference
to the path. *)
Trim(arg0, tempstr); Canonify(tempstr, binarydir);
present := IsFilePresent(binarydir)
ELSE
(* There are no '/'s in arg0, so search through the path. *)
Platform.GetEnv("PATH", pathlist);
i := 0;
i := 0; present := FALSE;
WHILE (~present) & (pathlist[i] # 0X) DO
ExtractPart(pathlist, i, ":;", dir); Trim(dir, testpath);
AppendPart('/', executable, testpath);
Canonify(testpath, d); present := IsFilePresent(d)
ExtractPart(pathlist, i, ":;", pathdir);
AppendPart('/', arg0, pathdir);
Trim(pathdir, tempstr); Canonify(tempstr, binarydir);
present := IsFilePresent(binarydir)
END
END;
IF present THEN
(* Remove trailing executable file name *)
k := CharCount(d);
WHILE (k > 0) & ~IsOneOf(d[k-1], '/\') DO DEC(k) END;
(* Chop off executable file name *)
IF k = 0 THEN d[k] := 0X ELSE d[k-1] := 0X END;
(* Remove trailing binarydir file name *)
k := CharCount(binarydir);
WHILE (k > 0) & ~IsOneOf(binarydir[k-1], '/\') DO DEC(k) END;
(* Chop off binarydir file name *)
IF k = 0 THEN binarydir[k] := 0X ELSE binarydir[k-1] := 0X END;
ELSE
d[0] := 0X (* Couldn't determine binary directory. *)
binarydir[0] := 0X (* Couldn't determine binary directory. *)
END
END FindBinaryDir;

View file

@ -44,6 +44,7 @@ sub logged {
print $log strftime("%H.%M.%S", localtime), " ", $line;
}
close($pipe);
print $log strftime("%H.%M.%S", localtime), " --- Make completed ---\n";
close($log);
exit;
}
@ -58,165 +59,8 @@ for my $machine (sort keys %machines) {
logged($cmd, $machine);
}
while ((my $pid = wait) > 0) {print "Child pid $pid completed.\n";}
# # All builds have completed. Now scan the logs for pass/fail and build the passing report.
my %status = ();
my $fn;
my $date;
my $time;
my $os;
my $compiler;
my $datamodel;
my $compilerok;
my $libraryok;
my $sourcechange;
my $asmchange;
my $tests;
my $key;
my $ver;
sub clearvars {
$time = ""; $branch = ""; $os = ""; $compiler = "";
$datamodel = ""; $compilerok = ""; $libraryok = ""; $sourcechange = "";
$asmchange = ""; $tests = ""; $key = ""; $ver = "";
system("perl report.pl $branch");
while ((my $pid = wait) > 0) {
print "Child pid $pid completed.\n";
system("perl report.pl $branch");
}
sub logstatus {
my ($fn) = @_;
if ($compiler ne "") {
$status{"$os-$compiler-$datamodel"} =
[$fn, $date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok, $sourcechange, $asmchange, $tests];
}
clearvars();
}
sub parselog {
($fn) = @_;
clearvars();
open(my $log, $fn) // die "Couldn't open build log $fn.";
while (<$log>) {
if (/^([0-9\/]+) ([0-9.]+) .+\.log$/) {$date = $1}
if (/^([0-9.]+) /) {$time = $1}
# 19.39.58 Configuration: 1.95 [2016/07/14] for gcc LP64 on centos
if (/^[^ ]+ Configuration: ([0-9a-zA-Z.]+) \[[0-9\/]+\] for (.+) *$/) {
logstatus($fn);
$ver = $1;
printf "--- Config for $fn: $1 for $2.\n";
}
if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) {
($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5);
}
if (/^([0-9.]+) --- Compiler build started ---$/) {$compilerok = "Failed";}
if (/^([0-9.]+) --- Compiler build successfull ---$/) {$compilerok = "Built";}
if (/^([0-9.]+) --- Library build started ---$/) {$libraryok = "Failed";}
if (/^([0-9.]+) --- Library build successfull ---$/) {$libraryok = "Built";}
if (/^([0-9.]+) --- Generated c source files match bootstrap ---$/) {$sourcechange = "Unchanged";}
if (/^([0-9.]+) --- Generated c source files differ from bootstrap ---$/) {$sourcechange = "Changed";}
if (/^([0-9.]+) --- Generated code unchanged ---$/) {if ($asmchange eq "") {$asmchange = "Unchanged"}}
if (/^([0-9.]+) --- Generated code changed ---$/) {$asmchange = "Changed"}
if (/^([0-9.]+) --- Confidence tests started ---$/) {$tests = "Failed";}
if (/^([0-9.]+) --- Confidence tests passed ---$/) {$tests = "Passed";}
}
close($log);
logstatus($fn);
}
opendir DIR, "log" // die "Could not open log directory.";
my @logs = readdir DIR;
closedir DIR;
for my $logname (sort @logs) {
$logname = "log/" . $logname;
#print "Consider $logname\n";
if (-f $logname) {parselog($logname);}
}
my $fontheight = 12;
my $lineheight = 15;
sub svgtext {
my ($f, $x, $y, $colour, $msg) = @_;
print $f '<text x="', $x;
print $f '" y="', ($y+1)*$lineheight + $fontheight*0.4;
print $f '" font-family="Verdana" font-size="', $fontheight, 'px" fill="';
print $f $colour;
print $f '">';
print $f $msg;
print $f "</text>\n";
}
sub colourfor {
my ($str) = @_;
if ($str eq "Failed") {return "#e03030";}
if ($str eq "Changed") {return "#ff9d4d";}
return "#5adb5a";
}
my $rows = keys %status;
my $width = 710;
my $height = ($rows+2.2) * $lineheight;
open(my $svg, ">build-status.svg") // die "Could not create build-status.svg.";
print $svg '<svg width="', $width, '" height="', $height, '"';
print $svg ' xmlns="http://www.w3.org/2000/svg" version="1.1"';
print $svg ' xmlns:xlink="http://www.w3.org/1999/xlink"', ">\n";
print $svg '<rect x="3" y="3" width="', $width-6, '" height="', $height-6, '"';
print $svg ' rx="20" ry="20" fill="#404040"';
print $svg ' stroke="#d5850d" stroke-width="4"/>', "\n";
my $col1 = 20;
my $col2 = 97;
my $col3 = 160;
my $col4 = 220;
my $col5 = 280;
my $col6 = 330;
my $col7 = 380;
my $col8 = 440;
my $col9 = 490;
my $col10 = 570;
my $col11 = 650;
svgtext($svg, $col1, 0, "#e0e0e0", "Date");
svgtext($svg, $col3, 0, "#e0e0e0", "Branch");
svgtext($svg, $col4, 0, "#e0e0e0", "Platform");
svgtext($svg, $col7, 0, "#e0e0e0", "Compiler");
svgtext($svg, $col8, 0, "#e0e0e0", "Library");
svgtext($svg, $col9, 0, "#e0e0e0", "C Source");
svgtext($svg, $col10, 0, "#e0e0e0", "Assembler");
svgtext($svg, $col11, 0, "#e0e0e0", "Tests");
my $i=1;
for my $key (sort keys %status) {
my ($fn, $date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok,
$sourcechange, $asmchange, $tests) = @{$status{$key}};
print $svg '<a xlink:href="', $fn, '">';
svgtext($svg, $col1, $i, "#c0c0c0", $date);
svgtext($svg, $col2, $i, "#c0c0c0", $time);
svgtext($svg, $col3, $i, "#c0c0c0", $branch);
svgtext($svg, $col4, $i, "#c0c0c0", $os);
svgtext($svg, $col5, $i, "#c0c0c0", $compiler);
svgtext($svg, $col6, $i, "#c0c0c0", $datamodel);
svgtext($svg, $col7, $i, colourfor($compilerok), $compilerok);
svgtext($svg, $col8, $i, colourfor($libraryok), $libraryok);
svgtext($svg, $col9, $i, colourfor($sourcechange), $sourcechange);
svgtext($svg, $col10, $i, colourfor($asmchange), $asmchange);
svgtext($svg, $col11, $i, colourfor($tests), $tests);
print $svg '</a>';
$i++;
}
print $svg "</svg>\n";
system 'chmod +r log/*';
system 'scp build-status.svg dave@hub:/var/www';
system 'scp log/* dave@hub:/var/www/log';

View file

@ -0,0 +1,176 @@
#!perl -w
use strict;
use warnings;
use POSIX "strftime";
use Cwd;
my $branch = "master";
if (defined($ARGV[0]) && ($ARGV[0] ne "")) {$branch = $ARGV[0]}
print "--- Running build status report on branch $branch.\n";
my %status = ();
my $fn;
my $date;
my $time;
my $os;
my $compiler;
my $datamodel;
my $compilerok;
my $libraryok;
my $sourcechange;
my $asmchange;
my $tests;
my $key;
my $ver;
sub clearvars {
$time = ""; $branch = ""; $os = ""; $compiler = "";
$datamodel = ""; $compilerok = ""; $libraryok = ""; $sourcechange = "";
$asmchange = ""; $tests = ""; $key = ""; $ver = "";
}
sub logstatus {
my ($fn) = @_;
if ($compiler ne "") {
$status{"$os-$compiler-$datamodel"} =
[$fn, $date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok, $sourcechange, $asmchange, $tests];
}
clearvars();
}
sub parselog {
($fn) = @_;
clearvars();
open(my $log, $fn) // die "Couldn't open build log $fn.";
$branch = "Build on $fn started";
while (<$log>) {
if (/^([0-9\/]+) ([0-9.]+) .+\.log$/) {$date = $1}
if (/^([0-9.]+) /) {$time = $1}
# 19.39.58 Configuration: 1.95 [2016/07/14] for gcc LP64 on centos
if (/^[^ ]+ Configuration: ([0-9a-zA-Z.]+) \[[0-9\/]+\] for (.+) *$/) {
logstatus($fn);
$ver = $1;
printf "--- Config for $fn: $1 for $2.\n";
}
if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) {
($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5);
}
if (/^([0-9.]+) --- Compiler build started ---$/) {$compilerok = "Started";}
if (/^([0-9.]+) --- Compiler build successfull ---$/) {$compilerok = "Built";}
if (/^([0-9.]+) --- Library build started ---$/) {$libraryok = "Started";}
if (/^([0-9.]+) --- Library build successfull ---$/) {$libraryok = "Built";}
if (/^([0-9.]+) --- Generated c source files match bootstrap ---$/) {$sourcechange = "Unchanged";}
if (/^([0-9.]+) --- Generated c source files differ from bootstrap ---$/) {$sourcechange = "Changed";}
if (/^([0-9.]+) --- Generated code unchanged ---$/) {if ($asmchange eq "") {$asmchange = "Unchanged"}}
if (/^([0-9.]+) --- Generated code changed ---$/) {$asmchange = "Changed"}
if (/^([0-9.]+) --- Confidence tests started ---$/) {$tests = "Started";}
if (/^([0-9.]+) --- Confidence tests passed ---$/) {$tests = "Passed";}
if (/^([0-9.]+) --- Make completed ---$/) {
# Go back and convert 'Started' status to 'Failed'.
if ($branch =~ m/^Build on/) {$branch = "Build on $fn failed to start.";}
if ($compilerok eq "Started") {$compilerok = "Failed.";}
if ($libraryok eq "Started") {$libraryok = "Failed.";}
if ($tests eq "Started") {$tests = "Failed.";}
}
}
close($log);
logstatus($fn);
}
opendir DIR, "log" // die "Could not open log directory.";
my @logs = readdir DIR;
closedir DIR;
for my $logname (sort @logs) {
$logname = "log/" . $logname;
#print "Consider $logname\n";
if (-f $logname) {parselog($logname);}
}
my $fontheight = 12;
my $lineheight = 15;
sub svgtext {
my ($f, $x, $y, $colour, $msg) = @_;
print $f '<text x="', $x;
print $f '" y="', ($y+1)*$lineheight + $fontheight*0.4;
print $f '" font-family="Verdana" font-size="', $fontheight, 'px" fill="';
print $f $colour;
print $f '">';
print $f $msg;
print $f "</text>\n";
}
sub colourfor {
my ($str) = @_;
if ($str eq "Failed") {return "#e03030";}
if ($str eq "Changed") {return "#ff9d4d";}
return "#5adb5a";
}
my $rows = keys %status;
my $width = 710;
my $height = ($rows+2.2) * $lineheight;
open(my $svg, ">build-status.svg") // die "Could not create build-status.svg.";
print $svg '<svg width="', $width, '" height="', $height, '"';
print $svg ' xmlns="http://www.w3.org/2000/svg" version="1.1"';
print $svg ' xmlns:xlink="http://www.w3.org/1999/xlink"', ">\n";
print $svg '<rect x="3" y="3" width="', $width-6, '" height="', $height-6, '"';
print $svg ' rx="20" ry="20" fill="#404040"';
print $svg ' stroke="#d5850d" stroke-width="4"/>', "\n";
my $col1 = 20;
my $col2 = 97;
my $col3 = 160;
my $col4 = 220;
my $col5 = 280;
my $col6 = 330;
my $col7 = 380;
my $col8 = 440;
my $col9 = 490;
my $col10 = 570;
my $col11 = 650;
svgtext($svg, $col1, 0, "#e0e0e0", "Date");
svgtext($svg, $col3, 0, "#e0e0e0", "Branch");
svgtext($svg, $col4, 0, "#e0e0e0", "Platform");
svgtext($svg, $col7, 0, "#e0e0e0", "Compiler");
svgtext($svg, $col8, 0, "#e0e0e0", "Library");
svgtext($svg, $col9, 0, "#e0e0e0", "C Source");
svgtext($svg, $col10, 0, "#e0e0e0", "Assembler");
svgtext($svg, $col11, 0, "#e0e0e0", "Tests");
my $i=1;
for my $key (sort keys %status) {
my ($fn, $date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok,
$sourcechange, $asmchange, $tests) = @{$status{$key}};
print $svg '<a xlink:href="', $fn, '">';
svgtext($svg, $col1, $i, "#c0c0c0", $date);
svgtext($svg, $col2, $i, "#c0c0c0", $time);
svgtext($svg, $col3, $i, "#c0c0c0", $branch);
svgtext($svg, $col4, $i, "#c0c0c0", $os);
svgtext($svg, $col5, $i, "#c0c0c0", $compiler);
svgtext($svg, $col6, $i, "#c0c0c0", $datamodel);
svgtext($svg, $col7, $i, colourfor($compilerok), $compilerok);
svgtext($svg, $col8, $i, colourfor($libraryok), $libraryok);
svgtext($svg, $col9, $i, colourfor($sourcechange), $sourcechange);
svgtext($svg, $col10, $i, colourfor($asmchange), $asmchange);
svgtext($svg, $col11, $i, colourfor($tests), $tests);
print $svg '</a>';
$i++;
}
print $svg "</svg>\n";
system 'chmod +r log/*';
system 'scp build-status.svg dave@hub:/var/www';
system 'scp log/* dave@hub:/var/www/log';

View file

@ -1,7 +1,7 @@
# Push buildall and postpush to postpush server
set -x
for f in postpush.pl buildall.pl build-oberon.sh; do
for f in *.pl build-oberon.sh; do
scp -P 5922 $f root@www:/var/lib/nethserver/ibay/githubhook/$f
ssh -p 5922 root@www "chmod +x /var/lib/nethserver/ibay/githubhook/$f"
done;

View file

@ -0,0 +1,28 @@
# addlibrary - shell script to install/uninstall oberon libraries
#
# $1 - "install" or "uninstall"
# $2 - location containing .so's
# $3 - oberon name
if ! which ldconfig >/dev/null 2>&1; then exit 0; fi
if test -d /etc/ld.so.conf.d; then
# Linux-like system
# Need to update the ldconfig configuration in the /etc/ld.so.conf.d dir.
if test "$1" = "install"; then
echo $2>/etc/ld.so.conf.d/lib$3.conf
else
rm -f /etc/ld.so.conf.d/lib$3.conf
fi
ldconfig
else
# BSD-like system
# Just run ldconfig -m to update the cache. It'll add-to/update/reove-from
# the cache appropraitely for whether they are present opt not.
ldconfig -m "$2"
fi

View file

@ -33,7 +33,7 @@ usage:
clean:
@printf '\n\n--- Cleaning branch $(BRANCH) $(OS) $(COMPILER) $(DATAMODEL) ---\n\n'
rm -rf $(BUILDDIR)
rm -rf $(BUILDDIR) $(ROOTDIR)/install
rm -f $(OBECOMP)
@ -142,68 +142,77 @@ browsercmd:
# makeinstalldir: Use only after a successful full build. Creates an
# installation directory image in $(BUILDDOR)/install
makeinstalldir:
@printf '\nCreating installation image at $(ROOTDIR)/install\n'
@rm -rf "$(ROOTDIR)/install"
@mkdir -p "$(ROOTDIR)/install/bin"
@cp $(OBECOMP) "$(ROOTDIR)/install/bin/$(OBECOMP)"
@-cp $(BUILDDIR)/showdef$(BINEXT) "$(ROOTDIR)/install/bin"
@mkdir -p "$(ROOTDIR)/install/2/include" && cp $(BUILDDIR)/2/*.h "$(ROOTDIR)/install/2/include/"
@mkdir -p "$(ROOTDIR)/install/2/sym" && cp $(BUILDDIR)/2/*.sym "$(ROOTDIR)/install/2/sym/"
@mkdir -p "$(ROOTDIR)/install/C/include" && cp $(BUILDDIR)/C/*.h "$(ROOTDIR)/install/C/include/"
@mkdir -p "$(ROOTDIR)/install/C/sym" && cp $(BUILDDIR)/C/*.sym "$(ROOTDIR)/install/C/sym/"
@cp $(BUILDDIR)/*.Txt "$(ROOTDIR)/install/2/sym/"
@cp $(BUILDDIR)/*.Txt "$(ROOTDIR)/install/C/sym/"
@mkdir -p "$(ROOTDIR)/install/lib"
@cp $(BUILDDIR)/2/lib$(ONAME)* "$(ROOTDIR)/install/lib/"
@cp $(BUILDDIR)/C/lib$(ONAME)* "$(ROOTDIR)/install/lib/"
# instructions: Advice on completion of local build
instructions: FORCE
@printf '\nOberon build and test complete, result is in $(ROOTDIR)/install\n'
@printf '\nYou can use the new compiler by running $(ROOTDIR)/install/bin/$(ONAME),\n'
@printf 'Or add it to your path as follows:\n'
@printf 'export PATH=\"$(ROOTDIR)/install/bin:$$PATH\"\n'
@printf '\n'
FORCE:
# installable: Check for access to the installation directory
# installable: Check for access to the installation directory
installable:
@rm -rf "S(INSTALLDIR)/test-access-qqq"
@if ! mkdir -p "$(INSTALLDIR)/test-access-qqq";then printf '\n\n Cannot write to install directory.\n Please use sudo or run as root/administrator.\n\n'; exit 1;fi
@rm -rf "S(INSTALLDIR)/test-access-qqq"
uninstall: installable
@printf '\nUninstalling from \"$(INSTALLDIR)\"\n'
rm -rf "$(INSTALLDIR)"
@sh src/tools/make/addlibrary.sh uninstall \""$(INSTALLDIR)/lib"\" $(oname)
# install: Use only after a successful full build. Installs the compiler
# and libraries in /opt/$(ONAME).
# May require root access.
install:
install: uninstall
@printf '\nInstalling into \"$(INSTALLDIR)\"\n'
@rm -rf "$(INSTALLDIR)"
@mkdir -p "$(INSTALLDIR)/bin"
@cp $(OBECOMP) "$(INSTALLDIR)/bin/$(OBECOMP)"
@-cp $(BUILDDIR)/showdef$(BINEXT) "$(INSTALLDIR)/bin"
@mkdir -p "$(INSTALLDIR)/2/include" && cp $(BUILDDIR)/2/*.h "$(INSTALLDIR)/2/include/"
@mkdir -p "$(INSTALLDIR)/2/sym" && cp $(BUILDDIR)/2/*.sym "$(INSTALLDIR)/2/sym/"
@mkdir -p "$(INSTALLDIR)/C/include" && cp $(BUILDDIR)/C/*.h "$(INSTALLDIR)/C/include/"
@mkdir -p "$(INSTALLDIR)/C/sym" && cp $(BUILDDIR)/C/*.sym "$(INSTALLDIR)/C/sym/"
@cp $(BUILDDIR)/*.Txt "$(INSTALLDIR)/2/sym/"
@cp $(BUILDDIR)/*.Txt "$(INSTALLDIR)/C/sym/"
@mkdir -p "$(INSTALLDIR)/lib"
@cp $(BUILDDIR)/2/lib$(ONAME)* "$(INSTALLDIR)/lib/"
@cp $(BUILDDIR)/C/lib$(ONAME)* "$(INSTALLDIR)/lib/"
@if which ldconfig >/dev/null 2>&1; then $(LDCONFIG); fi
# showpath: Describe how to set the PATH variable
showpath:
@cp -rf "$(ROOTDIR)/install/" "$(INSTALLDIR)"
@sh src/tools/make/addlibrary.sh install \""$(INSTALLDIR)/lib"\" $(ONAME)
@printf '\nOberon compiler installed to $(INSTALLDIR)\n'
@printf '\nNow add $(INSTALLDIR)/bin to your path, for example with the command:\n'
@printf 'export PATH=\"$(INSTALLDIR)/bin:\$$PATH\"\n'
@printf 'export PATH=\"$(INSTALLDIR)/bin:$$PATH\"\n'
@printf '\n'
uninstall:
@printf '\nUninstalling from \"$(INSTALLDIR)\"\n'
rm -rf "$(INSTALLDIR)"
rm -f /etc/ld.so.conf/lib$(ONAME)
if which ldconfig >/dev/null 2>&1; then ldconfig; fi
runtime:
runtime: FORCE
@printf '\nMaking run time library for -O$(MODEL)\n'
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Platform$(PLATFORM).Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Heap.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Out.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Modules.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Strings.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Out.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/In.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/VT100.Mod
cd $(BUILDDIR)/$(MODEL); $(ROOTDIR)/$(OBECOMP) -Fs -O$(MODEL) ../../../src/runtime/Files.Mod
@ -387,7 +396,7 @@ sourcechanges:
RUNTEST = COMPILER=$(COMPILER) OBECOMP="$(OBECOMP) -O$(MODEL)" FLAVOUR=$(FLAVOUR) BRANCH=$(BRANCH) sh ./test.sh "$(INSTALLDIR)"
RUNTEST = COMPILER=$(COMPILER) OBECOMP="$(OBECOMP) -O$(MODEL)" FLAVOUR=$(FLAVOUR) BRANCH=$(BRANCH) sh ./test.sh "$(ROOTDIR)/install"
confidence:
@printf '\n\n--- Confidence tests ---\n\n'