From 372d077a49beb42ce8b75fa7007257e11557c68e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Thu, 25 Apr 2024 20:44:14 +0900 Subject: [PATCH] =?utf8?q?.desktop=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?utf8?q?=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +-- CHANGELOG.md | 3 +++ Makefile | 43 ++++++++++++++++++++++++++++++++++--------- main.c | 2 +- mivfx.desktop | 9 +++++++++ 5 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 mivfx.desktop diff --git a/.gitignore b/.gitignore index 474a991..d4d3cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ mivfx -.ccls-cache -*.tar.gz +release diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d93ca0..3022e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.5.0 +* .desktopファイルの追加 + # 0.4.0 * URLから画像ファイルを開ける様に * GPLv2→BSD2clouseライセンスに変更 diff --git a/Makefile b/Makefile index b5961e2..b291f4a 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,58 @@ -NAME=mivfx -VERSION=0.4.0 -# Linux、Haiku、かIllumos = /usr、FreeBSDかOpenBSD = /usr/local、NetBSD = /usr/pkg +UNAME_S!=uname -s + +NAME!=cat main.c | grep "const char\* sofname" | awk '{print $$5}' | \ + sed "s/\"//g" | sed "s/;//" +VERSION!=cat main.c | grep "const char\* version" | awk '{print $$5}' | \ + sed "s/\"//g" | sed "s/;//" PREFIX=/usr/local + +.if ${UNAME_S} == "Linux" +PREFIX=/usr +.elif ${UNAME_S} == "NetBSD" +PREFIX=/usr/pkg +.endif + CC=cc FILES=main.c -CFLAGS=-Wall -Wextra -g +CFLAGS=-Wall -Wextra -g -I${PREFIX}/include LIBS=-lSDL2 -lSDL2_image -lcurl LDFLAGS=-L${PREFIX}/lib -CPPFLAGS=-I${PREFIX}/include +MANPREFIX=${PREFIX}/share/man + +.if ${UNAME_S} == "OpenBSD" +MANPREFIX=${PREFIX}/man +LDFLAGS+=-L/usr/lib -L/usr/X11R6/lib +CFLAGS+=-I/usr/include -I/usr/X11R6/include +.elif ${UNAME_S} == "FreeBSD" +LDFLAGS+=-L/usr/lib +CFLAGS+=-I/usr/include +.elif ${UNAME_S} == "NetBSD" +LDFLAGS+=-L/usr/lib -L/usr/local/lib -L/usr/X11R7/lib +CFLAGS+=-I/usr/include -I/usr/local/include -I/usr/X11R7/include +.endif all: - ${CC} ${CFLAGS} ${CPPFLAGS} -o ${NAME} ${FILES} ${LDFLAGS} ${LIBS} + ${CC} ${CFLAGS} -o ${NAME} ${FILES} ${LDFLAGS} ${LIBS} + strip ${NAME} clean: rm -f ${NAME} dist: clean - mkdir -p ${NAME}-${VERSION} - cp -R LICENSE.txt Makefile README.md CHANGELOG.md\ + mkdir -p ${NAME}-${VERSION} release/src + cp -R LICENSE.txt Makefile README.md CHANGELOG.md ${NAME}.desktop\ *.c ${NAME}-${VERSION} - tar zcfv ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION} + tar zcfv release/src/${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION} rm -rf ${NAME}-${VERSION} install: all mkdir -p ${DESTDIR}${PREFIX}/bin cp -f ${NAME} ${DESTDIR}${PREFIX}/bin + cp -f ${NAME}.desktop ${DESTDIR}${PREFIX}/share/applications chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME} uninstall: rm -f ${DESTDIR}${PREFIX}/bin/${NAME} + rm -f ${DESTDIR}${PREFIX}/share/applications/${NAME}.desktop .PHONY: all clean install uninstall diff --git a/main.c b/main.c index 56b6109..bee2ce5 100644 --- a/main.c +++ b/main.c @@ -17,7 +17,7 @@ int screenWidth; int screenHeight; const char* sofname = "mivfx"; -const char* version = "0.4.0"; +const char* version = "0.5.0"; bool dlfile(const char* url, const char* filename) { CURL* curl = curl_easy_init(); diff --git a/mivfx.desktop b/mivfx.desktop new file mode 100644 index 0000000..7e8f1e4 --- /dev/null +++ b/mivfx.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=mivfx +GenericName=Image Viewer +GenericName[ja]=画像ビューアー +Exec=mivfx %F +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp;image/heic;image/svg+xml;application/postscript;image/jp2;image/jxl;image/avif;image/heif; +NoDisplay=true +Icon=mivfx -- 2.43.0