Monday, September 17, 2018

OpenWrt automake patch

- Error
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at ./bin/automake.tmp line 3938.


- Patch
tools/automake/patches$ cat 0002-port-to-perl-5.22-and-later.patch
Without this change, Perl 5.22 complains "Unescaped left brace in
regex is deprecated" and this is planned to become a hard error in
Perl 5.26.  See:
http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#A_literal_%22{%22_should_now_be_escaped_in_a_pattern
* bin/automake.in (substitute_ac_subst_variables): Escape left brace.

Backported from:
http://git.savannah.gnu.org/cgit/automake.git/commit/?id=13f00eb4493c217269b76614759e452d8302955e
Original author: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Adam Duskett <aduskett@gmail.com>

diff --git a/bin/automake.in b/bin/automake.in
index a3a0aa3..2c8f31e 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker
 sub substitute_ac_subst_variables
 {
   my ($text) = @_;
-  $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+  $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
   return $text;
 }

OpenWrt ocaml - remove v4 and install v3


0.
sudo add-apt-repository ppa:npalix/coccinelle
sudo apt-get update

http://coccinelle.lip6.fr/download.php
https://github.com/coccinelle/coccinelle/releases

1.
sudo apt-get install gcc g++ binutils patch bzip2 flex make gettext pkg-config unzip zlib1g-dev libc6-dev subversion libncurses5-dev gawk sharutils curl libxml-parser-perl ocaml-nox ocaml-nox ocaml ocaml-findlib libpcre3-dev binutils-gold python-yaml

2.
sudo rm -rf /usr/bin/ocaml* /usr/lib/ocaml/

3.
sudo apt-get purge camlp4 camlp4-extra libfindlib-ocaml libfindlib-ocaml-dev libmenhir-ocaml-dev libpcre-ocaml libpcre-ocaml-dev ocaml ocaml-base ocaml-base-nox ocaml-compiler-libs ocaml-findlib ocaml-interp ocaml-native-compilers ocaml-nox

4.
wget https://launchpadlibrarian.net/86710925/ocaml_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710921/ocaml-nox_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710928/ocaml-native-compilers_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710929/ocaml-interp_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710930/ocaml-compiler-libs_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710927/ocaml-base_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710926/ocaml-base-nox_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710923/camlp4_3.12.1-2ubuntu2_amd64.deb
wget https://launchpadlibrarian.net/86710924/camlp4-extra_3.12.1-2ubuntu2_amd64.deb

wget http://mirrors.kernel.org/ubuntu/pool/main/t/tcl8.5/libtcl8.5_8.5.15-2ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/t/tcl8.5/tcl8.5_8.5.15-2ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/t/tk8.5/tk8.5_8.5.15-2ubuntu3_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/t/tk8.5/libtk8.5_8.5.15-2ubuntu3_amd64.deb

5.
sudo dpkg -i ocaml-base-nox_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i ocaml-interp_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i ocaml-nox_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i ocaml-compiler-libs_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i ocaml-native-compilers_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i camlp4_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i camlp4-extra_3.12.1-2ubuntu2_amd64.deb

sudo dpkg -i libtcl8.5_8.5.15-2ubuntu1_amd64.deb
sudo dpkg -i tcl8.5_8.5.15-2ubuntu1_amd64.deb
sudo dpkg -i libtk8.5_8.5.15-2ubuntu3_amd64.deb
sudo dpkg -i tk8.5_8.5.15-2ubuntu3_amd64.deb

sudo dpkg -i ocaml-base_3.12.1-2ubuntu2_amd64.deb
sudo dpkg -i ocaml_3.12.1-2ubuntu2_amd64.deb

6.
sudo apt-get install global python-dev python-yaml
sudo apt-get install ocaml-findlib menhir libmenhir-ocaml-dev libpycaml-ocaml-dev libpcre-ocaml-dev


*** It failed... :-(
via opam

$ sudo apt-get install opam
ocaml-nox is already the newest version (4.02.3-5ubuntu2)
$opam init --comp=4.02.3
$ opam switch 4.02.3


tools/coccinelle/Makefile

PKG_VERSION:=1.0.7
#https://github.com/coccinelle/coccinelle/archive/1.0.7.tar.gz

PKG_SOURCE:=$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/coccinelle/coccinelle/archive/
under build_dir/coccinelle-1.0.7/
./autogen
./configure
./make
./make install -->> run OpenWrt/make V=s -->> it will run "make install"


openwrt/build_dir/host/coccinelle-1.0.7$ ./configure --prefix=/home/openwrt/staging_dir/host --disable-opt
openwrt/build_dir/host/coccinelle-1.0.7$ make
openwrt/build_dir/host/coccinelle-1.0.7$ make install