Skip to content

Commit

Permalink
fix(release): adapt to cosmopolitan
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Apr 5, 2024
1 parent b9e0224 commit f3eaa19
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
steps:

- name: Checkout Code
id: checkout
uses: actions/checkout@v2

- name: Setup Build Tools
Expand All @@ -27,7 +28,7 @@ jobs:
run: |
gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
-fno-omit-frame-pointer -pg -mnop-mcount -D__cosmopolitan \
-DBASE16384_VERSION="${{ github.ref }}" -DBASE16384_VERSION_DATE="`date +"%Y%b/%d"`"\
-DBASE16384_VERSION=\"${{ steps.checkout.outputs.VERSION }}\" -DBASE16384_VERSION_DATE=\"`date +"%Y%b/%d"`\"\
-o base16384.com.dbg base16384.c file.c base1432.c -fuse-ld=bfd -Wl,-T,ape.lds \
-include cosmopolitan.h crt.o ape.o cosmopolitan.a
objcopy -S -O binary base16384.com.dbg base16384.com
Expand Down
7 changes: 4 additions & 3 deletions base1432.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __cosmopolitan
#include <string.h>
#endif

#include "binary.h"

union remainder {
typedef union {
uint8_t buf[4];
uint32_t val;
};
typedef union remainder remainder;
} remainder;

int base16384_encode_safe(const char* data, int dlen, char* buf) {
int outlen = dlen / 7 * 8;
Expand Down
7 changes: 4 additions & 3 deletions base1464.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __cosmopolitan
#include <string.h>
#endif

#include "binary.h"

union remainder {
typedef union {
uint8_t buf[8];
uint64_t val;
};
typedef union remainder remainder;
} remainder;

int base16384_encode_safe(const char* data, int dlen, char* buf) {
int outlen = dlen / 7 * 8;
Expand Down
8 changes: 7 additions & 1 deletion base16384.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ static base16384_err_t print_usage() {
#ifndef BASE16384_VERSION_DATE
#define BASE16384_VERSION_DATE "unknown date"
#endif
fputs("Copyright (c) 2022-2024 Fumiama Minamoto.\nBase16384 "BASE16384_VERSION" ("BASE16384_VERSION_DATE"). Usage:\n", stderr);
fputs(
"Copyright (c) 2022-2024 Fumiama Minamoto.\nBase16384 "
BASE16384_VERSION
" ("
BASE16384_VERSION_DATE
"). Usage:\n", stderr
);
fputs("base16384 [-edtn] [inputfile] [outputfile]\n", stderr);
fputs(" -e\t\tencode (default)\n", stderr);
fputs(" -d\t\tdecode\n", stderr);
Expand Down

0 comments on commit f3eaa19

Please sign in to comment.