Skip to content

Commit c7644ad

Browse files
committed
SGarnotel misc changes
- Don't seem to impact CI directly - Most appear to be formatting changes
1 parent 8ea8f0a commit c7644ad

File tree

6 files changed

+335
-275
lines changed

6 files changed

+335
-275
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
*freefem++.pref
4141
WHERE*
4242
CheckAll-out
43+
build
4344
examples/*/*.b
4445
examples/*/*.dat
4546
examples/*/*.dt

3rdparty/getall

Lines changed: 72 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424

2525
use strict;
2626
use Getopt::Std;
27-
use Digest::MD5 qw(md5_hex); # [[http://perldoc.perl.org/Digest/MD5.html]]
27+
use Digest::MD5 qw(md5_hex); # [[http://perldoc.perl.org/Digest/MD5.html]]
2828

2929
# This download script needs to be able to work on platforms that do not have threads (eg Mingw).
3030

31-
my $can_use_threads=eval 'use threads;use threads::shared;1';
31+
my $can_use_threads = eval 'use threads;use threads::shared;1';
3232

3333
my %opts;
34-
getopts('afho:',\%opts);
34+
getopts( 'afho:', \%opts );
3535

36-
if($opts{h}){
37-
print <<EOF;
36+
if ( $opts{h} ) {
37+
print <<EOF;
3838
getall [options]: Download third-party packages independently of the FreeFEM configuration procedure
3939
4040
Available options:
@@ -45,34 +45,34 @@ Available options:
4545
-o name,name,... = only download packages with the given names
4646
4747
EOF
48-
exit 0;
48+
exit 0;
4949
}
5050

5151
# Accumulate errors and print them all at the end of the script
5252

53-
my $errors='';
54-
if($can_use_threads){share(\$errors)}
53+
my $errors = '';
54+
if ($can_use_threads) { share( \$errors ) }
5555

5656
# Accumulate errors and print them all at the end of the script
5757

58-
my $errors='';
59-
if($can_use_threads){share(\$errors)}
58+
my $errors = '';
59+
if ($can_use_threads) { share( \$errors ) }
6060

6161
# list required packages
62-
my $only=0;
62+
my $only = 0;
6363
my %packs;
64-
if(defined $opts{o}){
65-
$only=1;
66-
foreach(split(/,/,$opts{o})){$packs{$_}=1}
64+
if ( defined $opts{o} ) {
65+
$only = 1;
66+
foreach ( split( /,/, $opts{o} ) ) { $packs{$_} = 1 }
6767
}
6868

6969
# can be run from the parent directory
7070

71-
if(-x "3rdparty/getall"){chdir "3rdparty"}
71+
if ( -x "3rdparty/getall" ) { chdir "3rdparty" }
7272

7373
# can be run from any of the child directories
7474

75-
if(-x "../getall"){chdir ".."}
75+
if ( -x "../getall" ) { chdir ".." }
7676

7777
system "mkdir -p pkg";
7878
my @downloads;
@@ -99,9 +99,6 @@ download('OpenBLAS','http://github.com/xianyi/OpenBLAS/archive/v0.3.6.tar.gz',
9999
'8a110a25b819a4b94e8a9580702b6495',
100100
'BAD_CERT');
101101

102-
download('FFTW','http://www.fftw.org/fftw-3.3.8.tar.gz',
103-
'http://www.fftw.org',
104-
'fftw-3.3.8.tar.gz','8aac833c943d8e90d51b697b27d4384d');
105102
# 3.3.2 '6977ee770ed68c85698c7168ffa6e178');
106103
download('freeYams','https://www.ljll.fr/frey/ftp/archives/freeyams.2012.02.05.tgz',
107104
'https://www.ljll.fr/frey/software.html',
@@ -181,11 +178,13 @@ download('htool','https://github.com/htool-ddm/htool/archive/f9a7e48eaa90cad7e23
181178
'htool.zip',
182179
'f0b977c3ab24f26e23b5e7398577d0f4');
183180

184-
185-
download('hpddm','https://codeload.github.com/hpddm/hpddm/zip/7113b9a6b77fceee3f52490cb27941a87b96542f',
186-
'https://codeload.github.com/hpddm',
187-
'hpddm.zip',
188-
'6910b7b974f0b60d9c247c666e7f3862');
181+
download(
182+
'hpddm',
183+
'https://codeload.github.com/hpddm/hpddm/zip/7113b9a6b77fceee3f52490cb27941a87b96542f',
184+
'https://codeload.github.com/hpddm',
185+
'hpddm.zip',
186+
'6910b7b974f0b60d9c247c666e7f3862'
187+
);
189188

190189
download('bemtool','https://github.com/PierreMarchand20/BemTool/archive/6e61fbf86d8cd53994d9f597e60fde537650ba14.zip',
191190
'https://github.com/PierreMarchand20/BemTool',
@@ -203,53 +202,61 @@ download('libpthread-google','https://www.ljll.fr/hecht/pkg/libpthread-google.ta
203202
'libpthread-google.tar.gz',
204203
'945c006d898983d1a710aabf52a32d9c');
205204

205+
download(
206+
'libpthread-google',
207+
'https://www.ljll.fr/hecht/pkg/libpthread-google.tar.gz',
208+
'https://www.ljll.fr/hecht/pkg/',
209+
'libpthread-google.tar.gz',
210+
'945c006d898983d1a710aabf52a32d9c'
211+
);
206212

207213
# run all downloads concurrently
208214

209-
if($can_use_threads){
210-
my @threads;
211-
foreach(@downloads){push @threads,threads->create(\&downloadone,$_)}
212-
foreach(@threads){$_->join()}
215+
if ($can_use_threads) {
216+
my @threads;
217+
foreach (@downloads) { push @threads, threads->create( \&downloadone, $_ ) }
218+
foreach (@threads) { $_->join() }
213219
}
214-
else{
215-
foreach(@downloads){downloadone($_)}
220+
else {
221+
foreach (@downloads) { downloadone($_) }
216222
}
217223

218-
if($errors ne ''){
219-
print "\n$errors";
220-
exit 1;
224+
if ( $errors ne '' ) {
225+
print "\n$errors";
226+
exit 1;
221227
}
222228

223-
sub download{
224-
my($title,$url,$lic,$pkg,$md5,$opts)=@_;
225-
226-
# skip packages that have not been requested explicitely
227-
return if($only && !defined $packs{$title});
228-
229-
# skip packages that are already present
230-
if(-f "pkg/$pkg" && !$opts{f}){
231-
my $md5check=md5_hex(`cat pkg/$pkg`);
232-
if( ( $md5 eq "none") || ($md5check eq $md5)){
233-
print "$title $pkg done\n";
234-
return;
235-
}
236-
else {
237-
print "$title $pkg md5 change => reget \n";
238-
}
239-
}
240-
241-
# we do not store the answers to these questions. To repeat the same downloads without manual input, options "-a" and
242-
# "-o names" are provided.
243-
244-
if(!$opts{a}){
245-
print "$title: please check the licence at $lic. Do you want to download $url? (yN)\n";
246-
my $ans=uc <STDIN>;
247-
chomp $ans;
248-
return if $ans ne 'Y';
249-
}
250-
251-
# uses [[file:../bin/build/download]]
252-
push @downloads,"$url,$pkg,$md5,$opts";
229+
sub download {
230+
my ( $title, $url, $lic, $pkg, $md5, $opts ) = @_;
231+
232+
# skip packages that have not been requested explicitely
233+
return if ( $only && !defined $packs{$title} );
234+
235+
# skip packages that are already present
236+
if ( -f "pkg/$pkg" && !$opts{f} ) {
237+
my $md5check = md5_hex(`cat pkg/$pkg`);
238+
if ( ( $md5 eq "none" ) || ( $md5check eq $md5 ) ) {
239+
print "$title $pkg done\n";
240+
return;
241+
}
242+
else {
243+
print "$title $pkg md5 change => reget \n";
244+
}
245+
}
246+
247+
# we do not store the answers to these questions. To repeat the same downloads without manual input, options "-a" and
248+
# "-o names" are provided.
249+
250+
if ( !$opts{a} ) {
251+
print
252+
"$title: please check the licence at $lic. Do you want to download $url? (yN)\n";
253+
my $ans = uc <STDIN>;
254+
chomp $ans;
255+
return if $ans ne 'Y';
256+
}
257+
258+
# uses [[file:../bin/build/download]]
259+
push @downloads, "$url,$pkg,$md5,$opts";
253260
}
254261

255262
sub downloadone{
@@ -260,7 +267,7 @@ sub downloadone{
260267
system $cmd;
261268
if($?){
262269
print "Download failed from $url of $pkg\n";
263-
my $url="https://www.ljll.fr/hecht/pkg/$pkg";
270+
my $url="https://joliv.et/freefem/pkg/$pkg";
264271
my $cmd="../bin/build/download $url pkg/$pkg $opts";
265272
print "Try other site: $url\n";
266273
system $cmd;
@@ -280,7 +287,7 @@ sub downloadone{
280287
my $md5check=md5_hex(`cat pkg/$pkg`);
281288
if( ( $md5 ne "none") && ($md5check ne $md5)){
282289
print "Download failed (MD5 check $md5check ) from $url of $pkg\n";
283-
my $url="https://www.ljll.fr/hecht/pkg/$pkg";
290+
my $url="https://joliv.et/freefem/pkg/$pkg";
284291
my $cmd="../bin/build/download $url pkg/$pkg $opts";
285292
print "Try other site: $url\n";
286293
system $cmd;

bin/change-dylib-gfortran

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/bash
2-
## change path gfortran lib in freefem install
1+
#!/bin/bash
2+
## change path gfortran lib in freefem install
33
## usage : change-dylibgfortran oldlibdir newlibdir libnam1 libnam2 list of dylyb file pathname to change ...
4-
## F. hecht sep. 2023 on MoOS Ventura , Monterey
5-
## remark the file $oldlibdir/$libnam1 , ... must exist ...
4+
## F. hecht sep. 2023 on MoOS Ventura , Monterey
5+
## remark the file $oldlibdir/$libnam1 , ... must exist ...
66
olddir=$1
77
shift
88
newdir=$1
@@ -14,36 +14,35 @@ shift
1414
lib3=$1
1515
shift
1616

17-
18-
if test -f "$olddir/$lib1" -a -f "$olddir/$lib2" -a -f "$olddir/$lib3" \
19-
-a -f "$newdir/$lib1" -a -f "$newdir/$lib2" -a -f "$newdir/$lib3" ; then
20-
for ff in $@; do
21-
ch=0
22-
for lib in $lib1 $lib2 $lib3; do
23-
old=$olddir/$lib
24-
new=$newdir/$lib
25-
nnl=`otool -L $ff|grep $lib|awk '{print $1}'`
26-
case $nnl in
27-
/* ) old=$nnl
28-
esac
29-
# echo "old .. " $old $nnl
30-
# otool -L $ff|awk "/$lib/ "'{print $1}'
31-
nn=`otool -L $ff|grep $old|wc -l`
32-
# echo "nn=" $nn $nnl $old
33-
otool -L $ff| grep brew
34-
if test $nn -ne 0 ; then
35-
# echo ..change $old to $new in $ff
36-
ch=1
37-
echo change $old to $new1 in $ff
38-
install_name_tool -change $old $new $ff
39-
fi
40-
done
41-
if test $ch -eq 1 ; then
42-
codesign --remove-signature $ff
43-
codesign -s - $ff
44-
fi
45-
done
17+
if test -f "$olddir/$lib1" -a -f "$olddir/$lib2" -a -f "$olddir/$lib3" \
18+
-a -f "$newdir/$lib1" -a -f "$newdir/$lib2" -a -f "$newdir/$lib3"; then
19+
for ff in $@; do
20+
ch=0
21+
for lib in $lib1 $lib2 $lib3; do
22+
old=$olddir/$lib
23+
new=$newdir/$lib
24+
nnl=$(otool -L $ff | grep $lib | awk '{print $1}')
25+
case $nnl in
26+
/*) old=$nnl ;;
27+
esac
28+
# echo "old .. " $old $nnl
29+
# otool -L $ff|awk "/$lib/ "'{print $1}'
30+
nn=$(otool -L $ff | grep $old | wc -l)
31+
# echo "nn=" $nn $nnl $old
32+
otool -L $ff | grep brew
33+
if test $nn -ne 0; then
34+
# echo ..change $old to $new in $ff
35+
ch=1
36+
echo change $old to $new1 in $ff
37+
install_name_tool -change $old $new $ff
38+
fi
39+
done
40+
if test $ch -eq 1; then
41+
codesign --remove-signature $ff
42+
codesign -s - $ff
43+
fi
44+
done
4645
else
47-
echo "$olddir/$lib1" "$olddir/$lib2" "$olddir/$lib3" do some not exist!
48-
echo "$newdir/$lib1" "$newdir/$lib2" "$newdir/$lib3" do not exist!
49-
fi
46+
echo "$olddir/$lib1" "$olddir/$lib2" "$olddir/$lib3" do some not exist!
47+
echo "$newdir/$lib1" "$newdir/$lib2" "$newdir/$lib3" do not exist!
48+
fi

0 commit comments

Comments
 (0)