Skip to content

Commit 77243e7

Browse files
authored
Merge pull request #28 from chylli-deriv/refactor/auto-compile
Refactor/auto compile
2 parents 19d1d49 + 7c554df commit 77243e7

File tree

4 files changed

+81
-13
lines changed

4 files changed

+81
-13
lines changed

.github/dependabot.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/build_workflow.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build workflow
2+
run-name: Build workflow
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'master'
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest # Maybe here is a blocker
13+
container:
14+
image: debian:bullseye
15+
defaults:
16+
run:
17+
shell: bash -le {0}
18+
env:
19+
BRANCH: ${{ github.ref_name }}
20+
steps:
21+
- name: prepare
22+
23+
run: |
24+
apt-get update
25+
apt-get -y dist-upgrade
26+
apt-get -y install locales build-essential gettext libpq5 libpq-dev make gcc git openssh-client curl wget sudo lsb-release socat redis-server cmake
27+
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
28+
locale-gen
29+
if [[ ! $BRANCH =~ perl-[0-9]+\.[0-9]+\.[0-9]+ ]]; then
30+
echo "Error: Branch name must be perl-<version>"
31+
exit 1
32+
fi
33+
VERSION=$(echo $BRANCH | sed -e 's/.*perl-\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
34+
35+
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV
36+
git config --global user.email "cibot@deriv.com"
37+
git config --global user.name "ci bot"
38+
git config --global --add safe.directory $PWD # ignore ownership problem
39+
- name: Checkout
40+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4
41+
- name: compile
42+
run: |
43+
bash ./rebuild.sh
44+
- name: push
45+
run: |
46+
rm -rf lib bin man
47+
mv /home/git/binary-com/perl/{bin,lib} .
48+
git add lib bin
49+
git commit -m "[ci skip] compile $VERSION"
50+
git push origin HEAD:$BRANCH

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# perl
2-
Custom compiled perl for Binary.com
32

4-
# compiling steps
3+
Custom compiled perl for deriv.com
54

6-
Download source code from http://www.cpan.org/src/5.0/perl-5.26.2.tar.gz
5+
## compiling steps
76

8-
We defined `-Dusesitecustomize` and removed `-Dusethreads`. Most of other parameters are copied from `perl -V | grep config_args`
9-
Run following command:
10-
```
11-
./Configure -Dusesitecustomize -Dinc_version_list=none -Dprefix=/home/git/binary-com/perl -Dvendorprefix=/home/git/regentmarkets/cpan/local -Dvendorlib=/home/git/regentmarkets/cpan/local/lib/perl5 -Dvendorarch=/home/git/regentmarkets/cpan/local/lib/perl5/x86_64-linux -Duselargefiles -Dccflags="-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" -Dldflags=" -Wl,-z,relro" -Dlddlflags="-shared -Wl,-z,relro" -Dcccdlflags="-fPIC" -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Uuseithreads -Uusemultiplicity -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -des
12-
make
13-
make install
7+
```bash
8+
VERSION=5.26.2 ./rebuild.sh
149
```
10+
11+
## compiling it with CI
12+
13+
1. enable CI test in your forked repo :
14+
at https://github.com/username/perl/settings/actions set `Allow all actions and reusable workflows`
15+
and `Read and write permissions`. Don't forget to click `save` at both section.
16+
2. Or create a new branch directly on binary-com/perl repo
17+
3. create a branch whose name include a perl version `perl-x.yy.zz`, e.g. `upgrade/perl.5.38.2`
18+
19+
Then CI will download and compile perl and push it to your branch

rebuild.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
#!/bin/bash
22
set -e
33

4-
wget http://www.cpan.org/src/5.0/perl-5.26.2.tar.gz
5-
rm -rf perl-5.26.2
6-
tar xzvf perl-5.26.2.tar.gz
7-
cd perl-5.26.2
4+
if [ -z "$VERSION" ]; then
5+
echo "No VERSION environment variable set. Exiting..."
6+
exit 1
7+
fi
8+
echo "Building perl version $VERSION"
9+
rm -rf bin lib man
10+
wget http://www.cpan.org/src/5.0/perl-$VERSION.tar.gz
11+
rm -rf perl-$VERSION
12+
tar xzvf perl-$VERSION.tar.gz
13+
cd perl-$VERSION
814

915
# Apply patch for fixing Time::Local tests entering year 2020 (CPAN RT#124787)
1016
zcat ../patches/0001-Fix-Time-Local-tests.patch.gz | patch -p1 --verbose || exit 1
1117

1218
# Apply patch for fixing gcc 10 problem https://github.com/openwrt/packages/pull/12178
1319
patch -Np1 < ../patches/999-fix-build-failure-against-gcc-10.patch
1420

21+
#We defined `-Dusesitecustomize` and removed `-Dusethreads`. Most of other parameters are copied from `perl -V | grep config_args`
1522
./Configure -Dusesitecustomize -Dinc_version_list=none -Dprefix=/home/git/binary-com/perl -Dsitelib=/home/git/regentmarkets/cpan-private/local/lib/perl5 -Dsitearch=/home/git/regentmarkets/cpan-private/local/lib/perl5/x86_64-linux -Dvendorprefix=/home/git/regentmarkets/cpan/local -Dvendorlib=/home/git/regentmarkets/cpan/local/lib/perl5 -Dvendorarch=/home/git/regentmarkets/cpan/local/lib/perl5/x86_64-linux -Duselargefiles -Dccflags="-DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security" -Dldflags=" -Wl,-z,relro" -Dlddlflags="-shared -Wl,-z,relro" -Dcccdlflags="-fPIC" -Duse64bitint -Dman1dir=none -Dman3dir=none -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Uuseithreads -Uusemultiplicity -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -des
1623
make && make test && make install
1724

0 commit comments

Comments
 (0)