Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
COMMIT?=v0.6.0
COMMIT?=v0.6.1
TARGETS=linux darwin win32
WORKDIR=bin

all: clean darwin linux win32 versions
all: clean clone darwin linux win32 versions

clean:
rm -rf *.tar.gz *.zip bin/p2pd-* bin/go-libp2p-daemon
Expand All @@ -13,14 +13,14 @@ $(WORKDIR)/go-libp2p-daemon:
clone: $(WORKDIR)/go-libp2p-daemon
git clone https://github.com/libp2p/go-libp2p-daemon.git bin/go-libp2p-daemon; cd $(WORKDIR)/go-libp2p-daemon && git checkout $(COMMIT)

darwin: clone
darwin:
cd $(WORKDIR)/go-libp2p-daemon/p2pd && \
GOOS=$@ GOARCH=amd64 go build -o p2pd-$@-amd64 && \
GOOS=$@ GOARCH=arm64 go build -o p2pd-$@-arm64 && \
lipo -create -output p2pd-$@ p2pd-$@-amd64 p2pd-$@-arm64 && \
mv p2pd-* ../../ && \
cd ../../../ && \
tar -czf p2pd-$(COMMIT)-$@.tar.gz $(WORKDIR)/p2pd-$@
node scripts/archive.js p2pd-$(COMMIT)-$@.tar.gz $(WORKDIR)/p2pd-$@

linux: clone
cd $(WORKDIR)/go-libp2p-daemon/p2pd && \
Expand All @@ -29,9 +29,9 @@ linux: clone
GOARCH=386 GOOS=$@ go build -o p2pd-$@-386 && \
mv p2pd-* ../../ && \
cd ../../../ && \
tar -czf p2pd-$(COMMIT)-$@-amd64.tar.gz $(WORKDIR)/p2pd-linux-amd64 && \
tar -czf p2pd-$(COMMIT)-$@-arm64.tar.gz $(WORKDIR)/p2pd-linux-arm64 && \
tar -czf p2pd-$(COMMIT)-$@-386.tar.gz $(WORKDIR)/p2pd-linux-386
node scripts/archive.js p2pd-$(COMMIT)-$@-amd64.tar.gz $(WORKDIR)/p2pd-linux-amd64 && \
node scripts/archive.js p2pd-$(COMMIT)-$@-arm64.tar.gz $(WORKDIR)/p2pd-linux-arm64 && \
node scripts/archive.js p2pd-$(COMMIT)-$@-386.tar.gz $(WORKDIR)/p2pd-linux-386

win32:
cd $(WORKDIR)/go-libp2p-daemon/p2pd && \
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"p-retry": "^6.2.0",
"package-config": "^5.0.0",
"tar-fs": "^3.0.6",
"tar-stream": "^3.1.7",
"uint8arrays": "^5.0.3",
"unzip-stream": "^0.3.0"
},
Expand Down
35 changes: 35 additions & 0 deletions scripts/archive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable no-console */

// Mac OS X tar doesn't support `--owner=0` etc so use a script to do something
// similar in a cross-platform way

import fs from 'node:fs'
import tar from 'tar-stream'

if (process.argv.length !== 4) {
throw new Error('Not enough arguments')
}

const outputFile = process.argv[2]
const inputFile = process.argv[3]
const pack = tar.pack()
const stat = fs.statSync(inputFile)

const entry = pack.entry({
name: inputFile,
mode: 0o755,
mtime: new Date('1970-01-01'),
size: stat.size
}, (err) => {
if (err) {
console.error(err)
process.exit(1)
}

pack.finalize()
})

fs.createReadStream(inputFile)
.pipe(entry)

pack.pipe(fs.createWriteStream(outputFile))
4 changes: 2 additions & 2 deletions scripts/update-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import fs from 'node:fs'
import { join, resolve } from 'node:path'
import * as url from 'node:url'
import { hashFile } from '../src/hash-file.js'
import { ARCHITECTURES } from '../src/arches.js'
import { hashFile } from '../src/hash-file.js'

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const versionsPath = join(__dirname, '..', 'src', 'versions.json')

const version = fs.readFileSync(join(__dirname, '..', 'Makefile'), {
const version = fs.readFileSync(join(__dirname, '..', 'Makefile'), {
encoding: 'utf8'
})
.split('\n')
Expand Down
11 changes: 10 additions & 1 deletion src/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"latest": "v0.6.0",
"latest": "v0.6.1",
"versions": {
"v0.6.1": {
"darwin": "bafybeidivrf3tx6kosfvetoch3rlodfaiuugnk3bkhgwtphgga2sz6b74q",
"linux-386": "bafybeihmn6is6l7npw3le7mzyd63zxwkz5absk3k5hcrm2j3jt5yrbgi6y",
"linux-amd64": "bafybeifbrtxu7ez7xvobpp67lbxrrgjpvzjxmq7jyz76pecewyfaetqra4",
"linux-arm64": "bafybeifpvd2mumtvb6iqcfs22psbtnax75uwq3lyhfdar3kndo3yz7g7tq",
"win32-386": "bafybeibidsujejkkkplmdkvrw7qwsyvpz4idep2gwdhov4ttlzu72hcmmy",
"win32-amd64": "bafybeiabupok4gttrflrtuyfi2nmewaxs5lioccejqaqqmxakrydzbqdle",
"win32-arm64": "bafybeibe3c6rwk65d7yft5opwdnd7zutaptmepkr3cnz3kgdu76y5zedam"
},
"v0.6.0": {
"darwin": "bafybeieplo3tqhpdfptzvflxbdlvw32vivyq7qkcukytby2iwjuhxwl3dy",
"linux-386": "bafybeibexjcu5cznafpkzdhqy4kr4yvuzta4fbl23pvpafyghpenpljyye",
Expand Down