Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add deb creater #1

Merged
merged 2 commits into from
Aug 18, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode/
*.user
deb_root
*.deb
8 changes: 8 additions & 0 deletions deb/build/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname $0); pwd)
cd $SCRIPT_DIR

git clone https://github.com/Kotakku/FT_SCServo_Debug_Qt.git
cd FT_SCServo_Debug_Qt/
qmake .
make
34 changes: 34 additions & 0 deletions deb/create_deb.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname $0); pwd)
COPY_TARGET_BIN=FT_SCServo_Debug_Qt
# amd64 or arm64
ARCH=${1:-amd64}
MOUNT_TARGET=./build
DEB_ROOT=./deb_root
VERSION=${2:-0.0.1}
DEB_NAME=ft-scservo-debug-qt_${VERSION}_${ARCH}

if [ ${ARCH} == "arm64" ]; then
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
fi

# select arch
docker build -t deb_build -f ${SCRIPT_DIR}/dockerfile.${ARCH} ${SCRIPT_DIR}
docker run -it --rm -v ${MOUNT_TARGET}:/build deb_build /build/build.bash

mkdir -p ${DEB_ROOT}/usr/bin ${DEB_ROOT}/DEBIAN/
cp ${MOUNT_TARGET}/FT_SCServo_Debug_Qt/FT_SCServo_Debug_Qt ${DEB_ROOT}/usr/bin/

echo "Package: ft-scservo-debug-qt" > ${DEB_ROOT}/DEBIAN/control
echo "Version: $VERSION" >> ${DEB_ROOT}/DEBIAN/control
echo "Section: base" >> ${DEB_ROOT}/DEBIAN/control
echo "Priority: optional" >> ${DEB_ROOT}/DEBIAN/control
echo "Architecture: $ARCH" >> ${DEB_ROOT}/DEBIAN/control
echo "Depends: libqt5serialport5-dev, qtbase5-dev" >> ${DEB_ROOT}/DEBIAN/control
echo "Maintainer: Kotakku <Kotakkucu@gmail.com>" >> ${DEB_ROOT}/DEBIAN/control
echo "Description: FeeTech Servo Debug Qt" >> ${DEB_ROOT}/DEBIAN/control

dpkg-deb --build -Z xz --root-owner-group ${DEB_ROOT} ${SCRIPT_DIR}/${DEB_NAME}.deb

sudo rm -rf build/FT_SCServo_Debug_Qt deb_root/
echo "Create deb package done!"
23 changes: 23 additions & 0 deletions deb/dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:22.04

ENV TZ=Asia/Tokyo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install locales && \
locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
apt -y clean && \
rm -rf /var/lib/apt/lists/*
ENV LANG=en_US.UTF-8

RUN apt update && \
apt install -y \
libqt5serialport5 \
libqt5serialport5-dev \
qt5-qmake \
g++ \
cmake \
git

WORKDIR /build
23 changes: 23 additions & 0 deletions deb/dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM arm64v8/ubuntu:jammy

ENV TZ=Asia/Tokyo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install locales && \
locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
apt -y clean && \
rm -rf /var/lib/apt/lists/*
ENV LANG=en_US.UTF-8

RUN apt update && \
apt install -y \
libqt5serialport5 \
libqt5serialport5-dev \
qt5-qmake \
g++ \
cmake \
git

WORKDIR /build