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
15 changes: 8 additions & 7 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
FROM golang:1.23
FROM golang:1.24

WORKDIR /usr/local/src

RUN BUILD_DEPS="make gcc"
ENV DEBIAN_FRONTEND=noninteractive
ENV BUILD_DEPS="make gcc"
RUN apt-get update \
&& apt-get install -y --no-install-recommends "${BUILD_DEPS}" libmagickwand-dev ncurses-dev jq imagemagick
&& apt-get install -y --no-install-recommends $BUILD_DEPS libmagickwand-dev ncurses-dev jq imagemagick

RUN git clone --depth 1 https://github.com/denilsonsa/img2xterm \
RUN git clone -q --depth 1 https://github.com/denilsonsa/img2xterm \
&& (cd img2xterm && make && make install) \
&& rm -rf img2xterm \
&& apt purge -y "${BUILD_DEPS}" \
&& apt-get purge -y --auto-remove \
&& apt-get purge -y $BUILD_DEPS \
&& apt-get autoremove --purge -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* /var/tmp/*

RUN git clone --depth 1 https://github.com/msikma/pokesprite /tmp/original/pokesprite
RUN git clone -q --depth 1 https://github.com/msikma/pokesprite /tmp/original/pokesprite

WORKDIR /usr/local/src/
ADD src/ /usr/local/src/src/
Expand Down
12 changes: 10 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_TAG ?= latest
DOCKER_IMAGE=$(DOCKER_REPO)/pokesay:$(DOCKER_TAG)


all: build/docker build/cows build/assets test build/release
all: build/docker build/cows build/assets test build/release build/deb

build/docker:
echo "Building $(DOCKER_IMAGE)"
Expand Down Expand Up @@ -37,11 +37,19 @@ build/release: build/assets
build/scripts/build.sh
tree $(PWD)/bin/

build/deb: build/release
docker run \
-v $(PWD)/../:/usr/local/src \
--rm --name pokesay \
$(DOCKER_IMAGE) \
build/scripts/build_debs.sh
tree $(PWD)/deb/

test:
docker run \
-v $(PWD)/../:/usr/local/src \
--rm --name pokesay-test \
$(DOCKER_IMAGE) \
gotestsum --format dots

.PHONY: all build/docker build/cows build/assets build/release test
.PHONY: all build/docker build/cows build/assets build/release build/deb test
49 changes: 49 additions & 0 deletions build/scripts/build_debs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -euo pipefail

function get_latest_version() {
curl -s https://api.github.com/repos/tmck-code/pokesay/releases/latest \
| grep tag_name \
| cut -d "\"" -f 4- \
| sed -E 's/",$|v//g'
}

VERSION="$(get_latest_version)"
MAINTAINER="Tom McKeesick <tmck01@gmail.com>"
DESCRIPTION="Print pokemon in the CLI! An adaptation of the classic 'cowsay'"

OUTPUT_DIR="build/deb"
mkdir -p "$OUTPUT_DIR"

function build_deb() {
local os=$1
local arch=$2
local suffix=${3:-}

local bin="build/bin/pokesay-${os}-${arch}${suffix}"
local pkg_name="pokesay-${os}-${arch}"

mkdir -p "$pkg_name" "$pkg_name/pokesay/DEBIAN" "$pkg_name/pokesay/usr/bin"

cp "$bin" "$pkg_name/pokesay/usr/bin/pokesay"

cat > "$pkg_name/pokesay/DEBIAN/control" <<EOF
Package: pokesay
Version: $VERSION
Standards-Version: $VERSION
Section: utils
Priority: optional
Architecture: $arch
Maintainer: $MAINTAINER
Description: $DESCRIPTION
EOF

dpkg-deb --build "$pkg_name/pokesay/" "$OUTPUT_DIR/pokesay_${VERSION}_${arch}.deb"

rm -rf "$pkg_name"
}

build_deb linux amd64 &
build_deb android arm64 &
wait
2 changes: 1 addition & 1 deletion src/bin/convert/png_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ func main() {
pokedex.WriteToCowfile(data, destDirpath, destFpath)
pbar.Add(1)
}
fmt.Println("Finished converting", len(fpaths), "pokesprite PNGs -> cowfiles")
fmt.Println("\nFinished converting", len(fpaths), "pokesprite PNGs -> cowfiles")
fmt.Println("(skipped", nDuplicates, "duplicates and", nFailures, "failures)")
}
6 changes: 3 additions & 3 deletions src/bin/pokedex/pokedex.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func main() {
pbar.Add(1)
}

fmt.Println("- Writing entries to file")
fmt.Println("\n- Writing entries to file")
pbar = bin.NewProgressBar(len(cowfileFpaths))
for i, fpath := range cowfileFpaths {
data, err := os.ReadFile(fpath)
Expand All @@ -147,8 +147,8 @@ func main() {

pokedex.WriteStructToFile(uniqueNames, "build/assets/names.txt")

// 2. Create the category struct using the cowfile paths, pokemon names and indexes\
fmt.Println("- Writing categories to file")
// 2. Create the category struct using the cowfile paths, pokemon names and indexes
fmt.Println("\n- Writing categories to file")
categories := pokedex.CreateCategoryStruct(args.FromDir, pokemonMetadata, args.Debug)
pokedex.WriteStructToFile(categories, "build/assets/category_keys.txt")

Expand Down
Loading