quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test1022.pl (2460B)


      1 #!/usr/bin/env perl
      2 #***************************************************************************
      3 #                                  _   _ ____  _
      4 #  Project                     ___| | | |  _ \| |
      5 #                             / __| | | | |_) | |
      6 #                            | (__| |_| |  _ <| |___
      7 #                             \___|\___/|_| \_\_____|
      8 #
      9 # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
     10 #
     11 # This software is licensed as described in the file COPYING, which
     12 # you should have received as part of this distribution. The terms
     13 # are also available at https://curl.se/docs/copyright.html.
     14 #
     15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
     16 # copies of the Software, and permit persons to whom the Software is
     17 # furnished to do so, under the terms of the COPYING file.
     18 #
     19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     20 # KIND, either express or implied.
     21 #
     22 # SPDX-License-Identifier: curl
     23 #
     24 ###########################################################################
     25 # Determine if curl-config --version matches the curl --version
     26 if($#ARGV != 2) {
     27     print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
     28     exit 3;
     29 }
     30 
     31 my $what=$ARGV[2];
     32 
     33 # Read the output of curl --version
     34 open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
     35 $_ = <CURL>;
     36 chomp;
     37 /libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/;
     38 my $version = $1;
     39 close CURL;
     40 
     41 my $curlconfigversion;
     42 
     43 # Read the output of curl-config --version/--vernum
     44 open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
     45 $_ = <CURLCONFIG>;
     46 chomp;
     47 my $filever=$_;
     48 if($what eq "version") {
     49     if($filever =~ /^libcurl ([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)$/) {
     50         $curlconfigversion = $1;
     51     }
     52     else {
     53         $curlconfigversion = "illegal value";
     54     }
     55 }
     56 else { # "vernum" case
     57     # Convert hex version to decimal for comparison's sake
     58     if($filever =~ /^(..)(..)(..)$/) {
     59         $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
     60     }
     61     else {
     62         $curlconfigversion = "illegal value";
     63     }
     64 
     65     # Strip off the -DEV and -rc suffixes from the curl version if they're there
     66     $version =~ s/-\w*$//;
     67 }
     68 close CURLCONFIG;
     69 
     70 my $different = $version ne $curlconfigversion;
     71 if($different || !$version) {
     72     print "Mismatch in --version:\n";
     73     print "curl:        $version\n";
     74     print "curl-config: $curlconfigversion\n";
     75     exit 1;
     76 }