Skip to content

Commit

Permalink
qnx: add new download section
Browse files Browse the repository at this point in the history
- checks the dl/ subdirectory to figure out the latest release
- generates files.gen with file information
- _index.html uses defines from files.gen

Closes #362
  • Loading branch information
bagder committed Jul 3, 2024
1 parent f3c31ad commit 0ea4347
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ all: $(PAGES)
cd rfc && make
cd dev && make
cd windows && make
cd qnx && make
cd tiny && make
cd logo && make
cd trurl && make
Expand Down
20 changes: 20 additions & 0 deletions qnx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ROOT=..

SRCROOT=$(ROOT)/cvssource
DOCROOT=$(SRCROOT)/docs

include $(ROOT)/mainparts.mk
include $(ROOT)/setup.mk

PAGES=index.html

all: $(PAGES)

index.html: _index.html $(MAINPARTS) files.gen
$(ACTION)

files.gen: mkfiles.pl dl/*
./mkfiles.pl >$@

clean:
rm -f $(PAGES) *.gen
95 changes: 95 additions & 0 deletions qnx/_index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#include "_doctype.html"
<html>
<head> <title>curl for QNX</title>
#include "css.t"
<style type="text/css">
a.qnxdl {
font-size: 200%;
}
</style>
</head>

#define CURL_URL /qnx
#define QNX_MAIN

#include "_menu.html"
#include "setup.t"
#include "files.gen"

WHERE2(Download, "/download.html", QNX)

TITLE(curl for QNX)
<div class="relatedbox">
<b>Related:</b>
<br><a href="/changes.html">Changelog</a>
<br><a href="/docs/copyright.html">License</a>
<br><a href="/support.html">Support</a>
</div>
<p>
These are <b>official</b> curl and libcurl builds for QNX.

<p>

#ifdef QNX_SDK70_DATE
# define QNX_CURLDATE QNX_SDK70_DATE
#else
# ifdef QNX_SDK71_DATE
# define QNX_CURLDATE QNX_SDK71_DATE
# else
# define QNX_CURLDATE QNX_SDK80_DATE
# endif
#endif

<!-- version: QNX_CURLVER -->

<table>
<tr><td> <b>curl version</b> </td><td> QNX_CURLVER </td></tr>
<tr><td> <b>Build</b> </td><td> QNX_CURLVER_PACKAGE </td></tr>
<tr><td> <b>Date</b> </td><td> QNX_CURLDATE </td></tr>
<tr><td> <b>Changes</b> </td><td> <a href="/changes.html#QNX_CURLVER_LINK">QNX_CURLVER changelog</a> </td></tr>
</table>

#ifdef QNX_SDK80_FILENAME
<p class="qnxdl">
<a href="QNX_SDK80_FILENAME"><img src="/pix/GS-Download-icon.svg" alt="curl for SDK 8.0" width="90" height="120" style="float:left;"></a>
<a href="QNX_SDK80_FILENAME" class="qnxdl">curl QNX_CURLVER for SDK 8.0</a> <br>
#ifdef QNX_SDK80_SIG
<b>GPG signature</b>: <a href="QNX_SDK80_SIG">here</a><br>
#endif
<b>Size</b>: QNX_SDK80_SIZE<br>
<b>sha256</b>: QNX_SDK80_SHA256
#endif

#ifdef QNX_SDK71_FILENAME
<p class="qnxdl">
<a href="QNX_SDK71_FILENAME"><img src="/pix/GS-Download-icon.svg" alt="curl for SDK 7.1" width="90" height="120" style="float:left;"></a>
<a href="QNX_SDK71_FILENAME" class="qnxdl">curl QNX_CURLVER for SDK 7.1</a> <br>
#ifdef QNX_SDK71_SIG
<b>GPG signature</b>: <a href="QNX_SDK71_SIG">here</a><br>
#endif
<b>Size</b>: QNX_SDK71_SIZE<br>
<b>sha256</b>: QNX_SDK71_SHA256
#endif

#ifdef QNX_SDK70_FILENAME
<p class="qnxdl">
<a href="QNX_SDK70_FILENAME"><img src="/pix/GS-Download-icon.svg" alt="curl for SDK 7.0" width="90" height="120" style="float:left;"></a>
<div>
<a href="QNX_SDK70_FILENAME" class="qnxdl">curl QNX_CURLVER for SDK 7.0</a>
<br>
#ifdef QNX_SDK70_SIG
<b>GPG signature</b>: <a href="QNX_SDK70_SIG">here</a><br>
#endif
<b>Size</b>: QNX_SDK70_SIZE<br>
<b>sha256</b>: QNX_SDK70_SHA256
</div>
#endif

SUBTITLE(Contents)
<p>
The download archives contain curl and libcurl for all supported targets for
each indvidual SDK branch - as gzipped tarballs.

#include "_footer.html"
</body>
</html>
106 changes: 106 additions & 0 deletions qnx/mkfiles.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/perl

#use Time::localtime;
use POSIX qw(strftime);

my $url="/qnx/";

sub getdl {
my ($dir)=@_; # where the download files are
opendir(DIR, $dir) || return "";
my @files = readdir(DIR);
closedir DIR;
return @files;
}

sub filetime {
my ($filename)=@_;

my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);

return $mtime;
}

sub filesize {
my ($filename)=@_;

my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);

return $size;
}

sub checksum {
my ($f) = @_;
my @o = `sha256sum $f 2>/dev/null`;
my $sh = $o[0];
$sh =~ s/([^ ]*).*/$1/;
chomp $sh;
return $sh;
}


my $dl = "dl";
my @files = getdl($dl);

for(@files) {
my $file = $_;
if($file =~ /^curl-([0-9.-]+)-qnxsdp(\S+)\.(tar\.gz)$/) {
my ($version, $sdk, $ext)=($1, $2, $3, $4);
$sdk =~ s/[^0-9]//; # remove non-digits from SDK
$sdk{$version}.="$sdk,";
$file{$version.$sdk}=$file;
my $fsize = filesize("$dl/$file");

$size{$version.$sdk}=sprintf("%.1f MB", $fsize/(1024*1024));

my $when = filetime("$dl/$file");
my $d = strftime "%Y-%m-%d", gmtime($when);
$date{$version.$sdk}=$d;
$versions{$version}++;
if(-e "$dl/$file.asc") {
# a GPG signature
$gpg{$version.$sdk}="$dl/$file.asc";
}
}
}

sub num {
my ($t)=@_;
if($t =~ /^(\d)\.(\d+)\.(\d+)-(\d+)/) {
return 1000000*$1 + 10000*$2 + 100+$3 + $4;
}
return 0;
}

my $gen=0;
for my $version (reverse sort { num($a) <=> num($b) } keys %versions) {
my $build = 1;
my $officialver = $version;
if($officialver =~ s/-(\d)\z//g) {
$build = $1;
}
my $link = $officialver;
$link =~ s/\./_/g;
print "#define QNX_CURLVER $officialver\n";
print "#define QNX_CURLVER_PACKAGE $version\n";
print "#define QNX_CURLVER_LINK curl-$link\n\n";

for my $s (sort split(',', $sdk{$version})) {
printf("#define QNX_SDK%s_FILENAME dl/%s\n", $s, $file{$version.$s});
printf("#define QNX_SDK%s_SIZE %s\n", $s, $size{$version.$s});
printf("#define QNX_SDK%s_DATE %s\n", $s, $date{$version.$s});

if($gpg{$version.$s}) {
printf("#define QNX_SDK%s_SIG %s\n", $s, $gpg{$version.$s});
}

my $sha = checksum("$dl/$file{$version.$s}");
printf("#define QNX_SDK%s_SHA256 %s\n", $s, $sha);
}
last;
}

0 comments on commit 0ea4347

Please sign in to comment.