Fixed bad value of "Start in" field after pinning; plus various fixed:

- version information consolidated into version.h
- removed strip from Makefile
- updated PKGBUILD
- fixed minor things in launcher.c
- added header guards
This commit is contained in:
David Macek 2015-11-04 12:11:00 +01:00
parent 551bb174b0
commit a05668dffc
6 changed files with 40 additions and 22 deletions

View File

@ -11,7 +11,6 @@ msys2.res: launcher.rc msys2.ico
$(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MSYS -DICONFILE=msys2.ico $(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MSYS -DICONFILE=msys2.ico
msys2.exe: launcher.c msys2.res msys2.exe: launcher.c msys2.res
$(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^ $(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^
$(PREFIX)strip $@
mingw32.ini: launcher.ini mingw32.ini: launcher.ini
cp -f $^ $@ cp -f $^ $@
@ -20,7 +19,6 @@ mingw32.res: launcher.rc mingw32.ico
$(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MINGW32 -DICONFILE=mingw32.ico $(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MINGW32 -DICONFILE=mingw32.ico
mingw32.exe: launcher.c mingw32.res mingw32.exe: launcher.c mingw32.res
$(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^ $(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^
$(PREFIX)strip $@
mingw64.ini: launcher.ini mingw64.ini: launcher.ini
cp -f $^ $@ cp -f $^ $@
@ -29,4 +27,3 @@ mingw64.res: launcher.rc mingw64.ico
$(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MINGW64 -DICONFILE=mingw64.ico $(PREFIX)windres -O COFF -o $@ $< -DMSYSTEM=MINGW64 -DICONFILE=mingw64.ico
mingw64.exe: launcher.c mingw64.res mingw64.exe: launcher.c mingw64.res
$(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^ $(PREFIX)gcc -std=c11 -Wall -Wextra -Werror -static -municode -mwindows -o $@ $^
$(PREFIX)strip $@

View File

@ -1,24 +1,35 @@
pkgname=("msys2-launcher") _realname="msys2-launcher"
pkgver=0.2 pkgname=("${_realname}-git")
pkgver=0.3.15.551bb17
pkgrel=1 pkgrel=1
pkgdesc="Helper for launching MSYS2 shells" pkgdesc="Helper for launching MSYS2 shells"
arch=('x86_64' 'i686') arch=('x86_64' 'i686')
license=('MIT') license=('MIT')
provides=("${_realname}")
conflicts=("${_realname}")
depends=("mintty>=2.2.1")
makedepends=('mingw-w64-cross-gcc') makedepends=('mingw-w64-cross-gcc')
source=(launcher.c launcher.ini launcher.rc macros.h Makefile {mingw32,mingw64,msys2}.ico) source=(launcher.{c,ini,rc} {macros,version}.h Makefile {mingw32,mingw64,msys2}.ico)
md5sums=('8c08150729060c402f492451786749ec' md5sums=('052ba00d62b07adca186d57615b43834'
'b7fb06d6faaf530c187b817088228ce6' 'b7fb06d6faaf530c187b817088228ce6'
'7ebf52f48d7184bb33e6db327bc091dc' '3a3c9fd8d083716e5efd759641eb4f31'
'6cec0c5886d59f8ac929a4955108d679' '57a40ae9972dac94df0830a1ab480895'
'dc25fea701fa71381b364ed9c5ae5399' 'fef245f65b6826502b953b81fb397d97'
'8d3fa1f8eb06343a13b72299c164f6cd'
'797a8ea3012b22705caadcb17b1291c2' '797a8ea3012b22705caadcb17b1291c2'
'0237b204a9d09dcadc955b435cefd311' '0237b204a9d09dcadc955b435cefd311'
'292ad5cdd78abac9d694cc06819a96fc') '292ad5cdd78abac9d694cc06819a96fc')
pkgver() {
local _major=$(cat version.h | grep -F 'VER_MAJOR' | head -1 | sed -e 's/.* //')
local _minor=$(cat version.h | grep -F 'VER_MINOR' | head -1 | sed -e 's/.* //')
printf "%s.%s.%s.%s" "${_major}" "${_minor}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() { build() {
make PREFIX=/opt/bin/${CARCH}-w64-mingw32- make PREFIX=/opt/bin/${CARCH}-w64-mingw32-
} }
package() { package() {
cp "${srcdir}"/{mingw32,mingw64,msys2}.{exe,ini} "${pkgdir}" cp {mingw32,mingw64,msys2}.{exe,ini} "${pkgdir}"
} }

View File

@ -138,9 +138,6 @@ int wmain(int argc, wchar_t* argv[]) {
wchar_t exepath[PATH_MAX]; wchar_t exepath[PATH_MAX];
wchar_t confpath[PATH_MAX]; wchar_t confpath[PATH_MAX];
UNUSED(argc);
UNUSED(argv);
code = GetModuleFileName(NULL, exepath, sizeof(exepath) / sizeof(exepath[0])); code = GetModuleFileName(NULL, exepath, sizeof(exepath) / sizeof(exepath[0]));
if (code == 0) { if (code == 0) {
ShowLastError(L"Could not determine executable path"); ShowLastError(L"Could not determine executable path");
@ -149,15 +146,15 @@ int wmain(int argc, wchar_t* argv[]) {
tmp = exepath; tmp = exepath;
while (true) { while (true) {
tmp = wcschr(tmp, L'\\'); tmp = wcschr(tmp, L'/');
if (tmp == NULL) { if (tmp == NULL) {
break; break;
} }
*tmp = L'/'; *tmp = L'\\';
} }
wcscpy(msysdir, exepath); wcscpy(msysdir, exepath);
tmp = wcsrchr(msysdir, L'/'); tmp = wcsrchr(msysdir, L'\\');
if (tmp == NULL) { if (tmp == NULL) {
ShowError(L"Could not find root directory", msysdir, 0); ShowError(L"Could not find root directory", msysdir, 0);
return __LINE__; return __LINE__;
@ -195,11 +192,11 @@ int wmain(int argc, wchar_t* argv[]) {
// can break, but hopefully won't for most use cases // can break, but hopefully won't for most use cases
args = GetCommandLine(); args = GetCommandLine();
if (args[0] == '"') { if (args[0] == L'"') {
args++; args++;
} }
args += wcslen(argv[0]); args += wcslen(argv[0]);
if (args[0] == '"') { if (args[0] == L'"') {
args++; args++;
} }
@ -212,7 +209,7 @@ int wmain(int argc, wchar_t* argv[]) {
ShowError(L"Could not allocate memory", L"", 0); ShowError(L"Could not allocate memory", L"", 0);
return __LINE__; return __LINE__;
} }
code = swprintf(buf, buflen, L"%s/usr/bin/mintty.exe -i '%s' -o 'AppLaunchCmd=%s' -o 'AppID=MSYS2.Shell.%s.%d' -o 'AppName=MSYS2 %s Shell' --store-taskbar-properties -- /usr/bin/bash --login %s %s", msysdir, exepath, exepath, msystem, APPID_REVISION, msystem, argc == 1 ? L"-i" : L"-c '$0 \"$@\"'", args); code = swprintf(buf, buflen, L"%s\\usr\\bin\\mintty.exe -i '%s' -o 'AppLaunchCmd=%s' -o 'AppID=MSYS2.Shell.%s.%d' -o 'AppName=MSYS2 %s Shell' --store-taskbar-properties -- /usr/bin/bash --login %s %s", msysdir, exepath, exepath, msystem, APPID_REVISION, msystem, argc == 1 ? L"-i" : L"-c '$0 \"$@\"'", args);
buflen *= 2; buflen *= 2;
} }
if (code < 0) { if (code < 0) {

View File

@ -1,7 +1,8 @@
#include "macros.h" #include "macros.h"
#include "version.h"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 0,2,0,0 FILEVERSION VER_MAJOR,VER_MINOR,0,0
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
@ -9,7 +10,7 @@ BEGIN
BEGIN BEGIN
VALUE "ProductName", "MSYS2" VALUE "ProductName", "MSYS2"
VALUE "FileDescription", "MSYS2 " STRINGIFY_A(MSYSTEM) " shell launcher" VALUE "FileDescription", "MSYS2 " STRINGIFY_A(MSYSTEM) " shell launcher"
VALUE "FileVersion", "0.2" VALUE "FileVersion", STRINGIFY_A(VER_MAJOR) "." STRINGIFY_A(VER_MINOR)
END END
END END

View File

@ -1,3 +1,6 @@
#ifndef M2L_MACROS_H
#define M2L_MACROS_H
#define UNUSED(x) ((void)(x)) #define UNUSED(x) ((void)(x))
#define STRINGIFY_A_(x) #x #define STRINGIFY_A_(x) #x
@ -5,3 +8,5 @@
#define STRINGIFY_W_(x) L ## #x #define STRINGIFY_W_(x) L ## #x
#define STRINGIFY_W(x) STRINGIFY_W_(x) #define STRINGIFY_W(x) STRINGIFY_W_(x)
#endif

7
version.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef M2L_VERSION_H
#define M2L_VERSION_H
#define VER_MAJOR 0
#define VER_MINOR 3
#endif