Skip to content
Snippets Groups Projects
Commit 2503b49a authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

add missing make_version_macros.pl

parent 233ff690
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -44,6 +44,7 @@ RUN apt-get -y --no-install-recommends install meson
RUN apt-get -y --no-install-recommends install ninja-build
RUN pip3 install wheel
RUN pip3 install meson
RUN pip3 install ninja
############################################################
# apt cleanup
......@@ -178,10 +179,12 @@ WORKDIR /home/binary_c/progs/stars/binary_c
#RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && ./make libbinary_c.so || true
###### new meson/ninja
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && wc -c LICENCE |gawk "{print \$1}" > .lread && meson builddir -Dgeneric=true
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && cd builddir && ninja
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && cd builddir && ninja libbinary_c.so
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && cd builddir && ninja binary_c_symlink
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && wc -c LICENCE |gawk "{print \$1}" > .lread
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && meson builddir -Dgeneric=true --buildtype release
WORKDIR /home/binary_c/progs/stars/binary_c/builddir
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && ninja
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && ninja libbinary_c.so
RUN export LD_LIBRARY_PATH=$HOME/lib LIBRARY_PATH=$HOME/lib && ninja binary_c_symlink
############################################################
# install perl modules for binary_grid
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -6,8 +6,22 @@
# Run this script from binary_c's "docker" directory
############################################################
# initial working directory
WD=$PWD
# set cache date to 'date ...' for a unique (non-cached build)
#CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S)
CACHE_DATE=today
# which git branch do we want?
#GIT_BRANCH=master
GIT_BRANCH=izzard-discs
# TMPDIR is our temporary space : usually mktemp is good enough
# but you may want to change this location manually
#TMPDIR=$(mktemp -d -t ci-XXXXXXXXXX)
TMPDIR=/tmp/dockerbuildtmp
############################################################
# get binary_c version string
############################################################
......@@ -18,19 +32,15 @@ echo "Building docker container for binary_c version $BINARY_C_VERSION"
# First, clone the master branch to a temporary directory
############################################################
# working dir in /tmp
#TMPDIR=$(mktemp -d -t ci-XXXXXXXXXX)
TMPDIR=/tmp/dockerbuildtmp; mkdir -p $TMPDIR
# make temporary directory
mkdir -p $TMPDIR
echo Cloning binary_c to $TMPDIR
cd $TMPDIR
echo "TMPDIR is $TMPDIR"
# git clone binary_c (master) to $TMP, but only a
# depth=1 "shallow clone"
#git clone --depth 1 gitlab@gitlab.eps.surrey.ac.uk:ri0005/binary_c.git
# get rob's branch
git clone --branch izzard-discs --depth 1 gitlab@gitlab.eps.surrey.ac.uk:ri0005/binary_c.git
git clone --depth 1 --branch $GIT_BRANCH gitlab@gitlab.eps.surrey.ac.uk:ri0005/binary_c.git
############################################################
# bind the temporary directory, $TMP/binary_c, here using
......@@ -49,7 +59,7 @@ merge.pl Dockerfile > Dockerfile.merged
############################################################
# build docker container (this takes a while...)
############################################################
docker --log-level=debug build --build-arg CACHE_DATE=$(date +%Y-%m-%d:%H:%M:%S) -t binary_c -f Dockerfile.merged . |& tee build.log
docker --log-level=debug build --build-arg CACHE_DATE=$CACHE_DATE -t binary_c -f Dockerfile.merged . |& tee build.log
############################################################
# unbind binary_c git master
......
......@@ -334,13 +334,17 @@ if get_option('clean_data_objects') == true
run_command('meson/clean_data_objects.sh')
endif
############################################################
# make binary_c_version_macros.h
#
run_command('meson/make_version_macros.pl')
############################################################
# source files
#
c_sourcefiles = run_command('meson/c_sourcefiles.sh').stdout().strip().split('\n')
h_sourcefiles = run_command('meson/h_sourcefiles.sh').stdout().strip().split('\n')
############################################################
# full list of libraries with which we wish to link
#
......
#!/usr/bin/env perl
use strict;
# script to make binary_c_version_macros.h
my $colour =
{
'magenta' => '',
'black' => '',
'bold yellow' => '',
'bold white' => '',
'green' => '',
'bold green' => '',
'cyan' => '',
'bold black' => '',
'bold blue' => '',
'bold magenta' => '',
'blue' => '',
'bold cyan' => '',
'bold red' => '',
'red' => '',
'yellow' => '',
'reset' => '',
'white' => ''
};
my $version = slurp('src/binary_c_version.h');
$version = ($version =~
/\#define\s+BINARY_C_VERSION\s+\"([^\"]+)\"\s+/)[0];
my ($major,$minor,$patch,$pre) = ($version=~/^(\d+)\.(\d+)(?:\.(\d+))?(?:pre)?(\d*)/);
print $colour->{'green'},"Version $version -> Major $major, Minor $minor, Patch $patch";
if(defined $pre)
{
print " Pre $pre";
}
print $colour->{'reset'},"\n";
open(HEADER,'>','src/binary_c_version_macros.h');
print HEADER "
/*
* This file is automatically generated by the binary_c
* configure script.
*
* Please do not change it by hand or add it to the git
* repository!
*/
\#pragma once
\#ifndef BINARY_C_VERSION_MACROS_H
\#define BINARY_C_VERSION_MACROS_H
\#define BINARY_C_MAJOR_VERSION $major
\#define BINARY_C_MINOR_VERSION $minor
\#define BINARY_C_PATCH_VERSION $patch
\#define BINARY_C_PRE_VERSION $pre
\#endif // BINARY_C_VERSION_MACROS_H
";
close HEADER;
sub slurp
{
open(my $fh,'<'.$_[0])||die("cannot open $_[0] in slurp");
return (do { local( $/ ) ; <$fh> } );
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment