-
Notifications
You must be signed in to change notification settings - Fork 11
/
R2test.sh
60 lines (59 loc) · 2.54 KB
/
R2test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 2022 Jeffrey Kegler
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# This file is to document the procedure for testing with Marpa::R2.
# It can be run as a shell script to implement some of the procedure.
#
# Step 1: clone the Marpa::R2 repo. Clone into a repo
# which we will call "test", with something like this:
#
# git clone $( cd Marpa--R2; pwd) test
#
# Step 2: Copy a Libmarpa autoconf distribution into the clone
# with commands something like the following:
#
# (cd test/cpan/engine/; rm -rf read_only; mkdir read_only)
# (cd libmarpa/ac_dist; tar cf - .) | (cd test/cpan/engine/read_only; tar xvf -)
#
# Step 3: Hack Marpa::R2 repo and distro to match.
# In test, do the following:
ro=cpan/engine/read_only
major=`sh $ro/libmarpa_version.sh major`
minor=`sh $ro/libmarpa_version.sh minor`
micro=`sh $ro/libmarpa_version.sh micro`
(cd cpan/xs;make)
sed -e "/^#define EXPECTED_LIBMARPA_MAJOR /s/[0-9][0-9]*/$major/" \
-e "/^#define EXPECTED_LIBMARPA_MINOR /s/[0-9][0-9]*/$minor/" \
-e "/^#define EXPECTED_LIBMARPA_MICRO /s/[0-9][0-9]*/$micro/" \
cpan/xs/R2.xs > cpan/xs/R2.xs.hacked
mv cpan/xs/R2.xs.hacked cpan/xs/R2.xs
#
# Step 4: Build in the test/cpan directory:
# perl Build.PL
# ./Build --code
# ./Build test
#
# No-clone Variation:
# To use a new autoconf distro without a new clone, skip Step 1
# (cloning Marpa::R2) and run ".Build clean" before "./Build code"
# in the build (Step 4).
#
# Compile for debug variation:
# In Step 4, instead of "./Build code", run
#
# LIBMARPA_CFLAGS=-g ./Build code --Marpa-debug=1 --config optimize=-g