1.构建一个规范的软件目录
1)新建文件夹 com.appname.version 例如 com.mimouse.1.0.0
2)在com.mimouse.1.0.0文件夹下 新建 com.mimouse 目录
3)在com.mimouse目录下新建entries files两个文件夹和info 文件
4)在entries 下新建applications文件夹 (用来存放桌面文件)
[Desktop Entry]
Name=MiMouse
Comment=application for mimouse
Exec=/opt/apps/com.mimouse/files/MiMouse
Icon=/opt/apps/com.mimouse/files/logo.png
Terminal=false
Categories=Utility;
Type=Application
桌面文件注意不要乱填,否则系统不会在启动器里识别到
5)将库和二进制可执行文件放在files目录(二进制可以执行的文件)
6)info文件
info
{
"appid":"com.mimouse",
"name":"MiMouse",
"version":"1.0.0",
"arch":["mips64"],
"permissions":
{
"autostart":false,
"notification":false,
"trayicon":true,
"clipboard":true,
"account":false,
"bluetooth":false,
"camera":false,
"audio_record":true,
"installed_apps":false
}
}
二、在com.mimouse.1.0.0目录下运行命令
dh_make --createorig -s
需要预先安装apt install dh_make
确认信息输入y即可
三、
修改自动生成debian目录下的control文件
Source: com.mimouse
Section: utils
Priority: optional
Maintainer: unknown
Build-Depends: debhelper (>= 11)
Standards-Version: 4.1.3
Homepage:
#Vcs-Browser: https://salsa.debian.org/debian/com.mimouse
#Vcs-Git: https://salsa.debian.org/debian/com.mimouse.git
Package: com.mimouse
Architecture: mips64el
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: application for mimouse
注意Section Priority Architecture Package
四、在debian 目录下新建install文件
touch install
在install文件指定安装路径,这里填写
com.mimouse/ /opt/apps
com.mimouse/entries/applications/mimouse.desktop /usr/share/applications
将com.mimouse目录安装到/opt/apps目录下
五、rules文件
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
override_dh_auto_build:
override_dh_shlibdeps:
override_dh_strip:
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
override了三处。
六、 删除所有ex EX结尾的文件
rm *.EX *.ex
在com.mimouse.1.0.0目录下执行(777权限可能导致失败)
dpkg-source -b .
可能由于gcc版本的问题出错,别管它,执行下面的命令
dpkg-buildpackage -us -uc -nc
七、
fakeroot dpkg-deb -R pkg.deb a
解压到a目录下
mv a/usr/share/doc a/opt/apps/com.mimouse/files
rm -rf a/usr
最后
fakeroot dpkg-deb -b a com.mimouse_1.0.0_mips64el.deb