Updated Makefile to change 'build' command to 'compile'
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2023-02-11 15:33:08 -05:00
parent b52a1ef08e
commit fa4e51a0e8
2 changed files with 61 additions and 30 deletions

View File

@ -2,7 +2,7 @@ BINARY_NAME=adept
all: build test
build:
compile:
go build -o ${BINARY_NAME} adept.go
test:
@ -31,7 +31,8 @@ uninstall:
rm /usr/bin/${BINARY_NAME}
rm /etc/systemd/system/${BINARY_NAME}.service
rm -rf /etc/${BINARY_NAME}
clean:
go clean
rm ${BINARY_NAME}
.PHONY: all test clean

View File

@ -11,34 +11,64 @@ if [[ "${VERSION:0:1}" == "v" ]]; then
VERSION="${VERSION:1}"
fi
# Create workspace for our deb package
WORKDIR="adept_$VERSION"
mkdir "$WORKDIR"
# Copy build sources into workspace
cp -r build/etc "$WORKDIR/"
mkdir -p "$WORKDIR/usr/bin/"
cp "dist/adept-linux-amd64-v$VERSION" "$WORKDIR/usr/bin/adept"
# Tar up source files
mkdir rpm-temp
cp -r cmd config transcoder util adept.go go.mod go.sum LICENSE Makefile README.md rpm-temp/
tar cvzf "adept-$VERSION.tar.gz" rpm-temp/*
mv "adept-$VERSION.tar.gz" ~/rpmbuild/SOURCES/
# Create debian control file
mkdir "$WORKDIR/DEBIAN"
cat > "$WORKDIR/DEBIAN/control"<< EOF
Package: adept
Version: $VERSION
Section: video
Priority: optional
Architecture: amd64
Depends: ffmpeg (>= 4), lsof
Maintainer: Gregory Ballantine <gballantine@bitgoblin.tech>
Description: Bit Goblin video transcoding service.
cat > "./adept.spec"<< EOF
Name: adept
Version: $VERSION
Release: 1%{?dist}
Summary: Bit Goblin video transcoding service
License: BSD 2-Clause
Source0: %{name}-%{version}.tar.gz
BuildRequires: golang
BuildRequires: systemd-rpm-macros
Provides: %{name} = %{version}
%description
Bit Goblin video transcoding service
%global debug_package %{nil}
%prep
%autosetup
%build
go build -v -o %{name}
%install
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dpm 0755 build/etc/%{name}/%{name}.toml %{buildroot}%{_sysconfdir}/%{name}/%{name}.toml
install -Dpm 644 build/etc/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
%check
# go test should be here... :)
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%files
%dir %{_sysconfdir}/%{name}
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.toml
%changelog
* Thu Nov 17 2022 Gregory Ballantine $VERSION
- check git.metaunix.net/BitGoblin/adept for a changelog
EOF
# Copy maintainer scripts
cp build/scripts/* "$WORKDIR/DEBIAN/"
#chmod +rx "$WORKDIR"/DEBIAN/pre*
chmod +rx "$WORKDIR"/DEBIAN/post*
# Build deb package!
dpkg-deb --build "$WORKDIR"
# Cleanup
rm -rf "$WORKDIR"
rpmbuild -ba adept.spec