Skip to content

Commit

Permalink
Remove OpenSSL dependency
Browse files Browse the repository at this point in the history
```
musl-gcc -Os -static -s dzr.c
```

This produce a 78KiB statically linked binary

TODO: find a blowfish lib
  • Loading branch information
yne committed Mar 9, 2020
1 parent 1343001 commit e24f393
Show file tree
Hide file tree
Showing 4 changed files with 988 additions and 50 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: push

on: [push]
on:
push:
branches:
- master

jobs:
build:
Expand All @@ -18,11 +21,21 @@ jobs:
choco install llvm
choco install openssl.light
- name: build
run: cc dzr.c -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -lssl -lcrypto -o dzr
if: startsWith(matrix.os, 'mac')
run: |
cc dzr.c -Os -s -DUSE_SSL -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include -lssl -lcrypto -o dzr
brew install musl* upx*
musl-gcc -Os -s -static dzr.c -o dzr_static
- name: build
if: startsWith(matrix.os, 'ubuntu')
run: |
cc dzr.c -Os -s -DUSE_SSL -lssl -lcrypto -o dzr
sudo apt install musl*
musl-gcc -Os -s -static dzr.c -o dzr_static
- name: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_FILES: dzr
RELEASE_FILES: dzr dzr_static
run: |
RELEASE_TAG="$(date +%y%m%d)"
curl -svL -XPOST -d '{"tag_name": "'$RELEASE_TAG'"}' \
Expand All @@ -31,7 +44,7 @@ jobs:
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases"
RELEASE_ID=$(curl -svL https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$RELEASE_TAG | jq .id)
for RELEASE_FILE in $RELEASE_FILES; do \
curl -svL -XPOST -T $RELEASE_FILE \
[ -x $RELEASE_FILE ] && curl -svL -XPOST -T $RELEASE_FILE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type:application/octet-stream" \
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/$RELEASE_ID/assets?&name=$RELEASE_FILE-$OS" ; \
Expand Down
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<img width=100% height=200 src=.logo.svg>
<p align=center>Your favorite flows, straight from shell</p>

> ⚠️ For legal reasons, `dzr` does contain any encryption/decryption keys,
> so you must [find them](https://github.com/yne/dzr/wiki) by yourself.
> If you think this project break any legal rules: open an issue to discuss
> ⚠️ For legal reasons, `dzr` does not contain any private keys,
> so [find them](https://github.com/yne/dzr/wiki) yourself.
# Preview

Expand All @@ -15,34 +14,31 @@

See [release](https://github.com/yne/dzr/releases) for the prebuild binary.

You can also build it yourself:
# Build

```bash
apt install gcc libssl1* libssl-dev # build deps
gcc dzr.c -lssl -lcrypto -o dzr
cc dzr.c # HTTP only, work with DZR_API method
```
# Setup

Be sure to have set the `DZR_AES` and `DZR_CBC` environement variables.
<details><summary>Build with HTTPS support via LibSSL</summary>

* **I want to use my account:**
you shall also set your `DZR_SID`.
* **I don't have/want an account:**
set the `DZR_LUT` to point to the `dzr-db` binary (see bellow).
```bash
apt install gcc libssl1* libssl-dev
gcc dzr.c -DUSE_SSL -lssl -lcrypto -o dzr
```

Once complete, you should have the following variable set in your `.bashrc`:
</details>

# Setup

- `DZR_AES` = `jo..............` [HOWTO](https://github.com/yne/dzr/wiki)
- `DZR_CBC` = `g4el............` [HOWTO](https://github.com/yne/dzr/wiki)
- `DZR_LUT` = `/path/to/dzr-db %s`
- `DZR_SID` = your_sid (optional) [HOWTO](https://github.com/yne/dzr/wiki)
- `DZR_FMT` = `0` (can be: 128Kb:`0`, 320Kb:`3`, AAC96:`8`, FLAC:`9`)
Setup `dzr` environement variables using the
[wiki](https://github.com/yne/dzr/wiki) in your `.bashrc`/`.zshrc`.

# Usage

```sh
dzr 997764 > my.mp3
dzr 997764 | mpv --cache-secs 360 -
dzr 997764 | mpv -
DZR_FMT=9 dzr 997764 > my.flac
dzr-api artist pink floyds | xargs dzr | mpv -
```
Expand Down
Loading

0 comments on commit e24f393

Please sign in to comment.