New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fcm-rpmbuild in vendors/FCM-2017.10.0/sbin – NEMO

source: vendors/FCM-2017.10.0/sbin/fcm-rpmbuild @ 13905

Last change on this file since 13905 was 10672, checked in by nicolasmartin, 5 years ago

Reimport latest FCM release

File size: 3.2 KB
Line 
1#!/bin/bash
2#-------------------------------------------------------------------------------
3# (C) British Crown Copyright 2006-17 Met Office.
4#
5# This file is part of FCM, tools for managing and building source code.
6#
7# FCM is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# FCM is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with FCM. If not, see <http://www.gnu.org/licenses/>.
19#-------------------------------------------------------------------------------
20# NAME
21#     fcm-rpmbuild
22#
23# SYNOPSIS
24#     fcm-rpmbuild [--gui] [REV]
25#     E.g.:
26#     fcm rpmbuild 2014-03
27#
28# DESCRIPTION
29#     Build an RPM for distributing FCM.
30#     Assume that the current working directory is a local Git clone containing
31#     the FCM project.
32#
33# OPTIONS
34#     --gui - add GUI packages such as "perl-Tk" and "xxdiff".
35#
36# ARGUMENTS
37#     REV - Revision to build. Default to HEAD.
38#-------------------------------------------------------------------------------
39
40set -eu
41THIS=$(basename $0)
42NAME='fcm'
43
44rpmdev-setuptree
45
46# Build RPM without no dependency on subversion or xxdiff?
47REQUIRES_GUI=
48if (($# > 0)) && [[ $1 == '--gui' ]]; then
49    REQUIRES_GUI='perl-Tk xxdiff'
50    shift 1
51fi
52
53# Create the source tree
54REV=${1:-HEAD}
55REV_NAME=$(git describe $REV)
56REV_BASE=$(git describe --abbrev=0 $REV)
57RELEASE=1
58if [[ $REV_NAME != $REV_BASE ]]; then
59    COMMIT_DATE=$(date -u +%Y%m%dT%H%M "--date=$(git show -s --format=%ci $REV)")
60    RELEASE=${COMMIT_DATE}git${REV_NAME#$REV_BASE-*-g}
61fi
62REV_BASE_DOT=$(sed 's/-/./g' <<<$REV_BASE)
63git archive --format=tar --prefix=$NAME-$REV_BASE_DOT/ $REV \
64    | (cd ~/rpmbuild/SOURCES/ && tar -xf -)
65SOURCE=~/rpmbuild/SOURCES/$NAME-$REV_BASE_DOT
66echo "FCM.VERSION=\"$REV_NAME\";" >$SOURCE/doc/etc/$NAME-version.js
67rm -r $SOURCE/{test,t}
68if [[ -z $REQUIRES_GUI ]]; then
69    rm $SOURCE/{bin/fcm_gui,lib/FCM1/Interactive/InputGetter/GUI.pm}
70fi
71
72# Create the rpmbuild spec file
73{
74    cat <<__SPEC__
75Name: $NAME
76Version: $REV_BASE_DOT
77Release: $RELEASE
78Summary: A modern Fortran build system + wrappers to SVN
79Group: Development/Tools
80License: GPLv3
81URL: https://github.com/metomi/$NAME/
82Source0: https://github.com/metomi/$NAME/releases/
83BuildArch: noarch
84Requires: diffutils filesystem gzip make perl-core perl-Config-IniFiles perl-MailTools perl-XML-Parser subversion subversion-perl $REQUIRES_GUI
85
86%description
87FCM: A modern Fortran build system + wrappers to Subversion for scientific
88software development
89
90%prep
91
92%build
93
94%install
95rm -fr %{buildroot}
96mkdir -p %{buildroot}/opt/ %{buildroot}/usr/bin
97cp -pr %_sourcedir/$NAME-$REV_BASE_DOT %{buildroot}/opt/$NAME
98cp -p %_sourcedir/$NAME-$REV_BASE_DOT/usr/bin/fcm %{buildroot}/usr/bin
99
100%clean
101rm -fr %{buildroot}
102
103%files
104/opt/$NAME
105/usr/bin/fcm
106__SPEC__
107} >~/rpmbuild/SPECS/$NAME.spec
108
109cd ~/rpmbuild/SPECS
110rpmbuild -ba $NAME.spec
111rm -fr ~/rpmbuild/SOURCES/$NAME-$REV_BASE_DOT
112exit
Note: See TracBrowser for help on using the repository browser.