commit
07cc0d74d3
|
@ -0,0 +1 @@
|
|||
qmc2
|
|
@ -0,0 +1 @@
|
|||
qmc2
|
|
@ -0,0 +1 @@
|
|||
qmc2
|
|
@ -0,0 +1,182 @@
|
|||
/* CpuArch.c -- CPU specific code
|
||||
2012-05-29: Igor Pavlov : Public domain
|
||||
2015-06-21: pullmoll: Adapted to old 7z types for qmc2
|
||||
*/
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
|
||||
#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
|
||||
#define USE_ASM
|
||||
#endif
|
||||
|
||||
#if !defined(USE_ASM) && _MSC_VER >= 1500
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
|
||||
static UInt32_7z CheckFlag(UInt32_7z flag)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm mov EDX, EAX;
|
||||
__asm xor EAX, flag;
|
||||
__asm push EAX;
|
||||
__asm popfd;
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm xor EAX, EDX;
|
||||
__asm push EDX;
|
||||
__asm popfd;
|
||||
__asm and flag, EAX;
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"movl %%EAX,%%EDX\n\t"
|
||||
"xorl %0,%%EAX\n\t"
|
||||
"push %%EAX\n\t"
|
||||
"popf\n\t"
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"xorl %%EDX,%%EAX\n\t"
|
||||
"push %%EDX\n\t"
|
||||
"popf\n\t"
|
||||
"andl %%EAX, %0\n\t":
|
||||
"=c" (flag) : "c" (flag));
|
||||
#endif
|
||||
return flag;
|
||||
}
|
||||
#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False;
|
||||
#else
|
||||
#define CHECK_CPUID_IS_SUPPORTED
|
||||
#endif
|
||||
|
||||
static void MyCPUID(UInt32_7z function, UInt32_7z *a, UInt32_7z *b, UInt32_7z *c, UInt32_7z *d)
|
||||
{
|
||||
#ifdef USE_ASM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
UInt32_7z a2, b2, c2, d2;
|
||||
__asm xor EBX, EBX;
|
||||
__asm xor ECX, ECX;
|
||||
__asm xor EDX, EDX;
|
||||
__asm mov EAX, function;
|
||||
__asm cpuid;
|
||||
__asm mov a2, EAX;
|
||||
__asm mov b2, EBX;
|
||||
__asm mov c2, ECX;
|
||||
__asm mov d2, EDX;
|
||||
|
||||
*a = a2;
|
||||
*b = b2;
|
||||
*c = c2;
|
||||
*d = d2;
|
||||
|
||||
#else
|
||||
|
||||
__asm__ __volatile__ (
|
||||
#if defined(MY_CPU_X86) && defined(__PIC__)
|
||||
"mov %%ebx, %%edi;"
|
||||
"cpuid;"
|
||||
"xchgl %%ebx, %%edi;"
|
||||
: "=a" (*a) ,
|
||||
"=D" (*b) ,
|
||||
#else
|
||||
"cpuid"
|
||||
: "=a" (*a) ,
|
||||
"=b" (*b) ,
|
||||
#endif
|
||||
"=c" (*c) ,
|
||||
"=d" (*d)
|
||||
: "0" (function)) ;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
int CPUInfo[4];
|
||||
__cpuid(CPUInfo, function);
|
||||
*a = CPUInfo[0];
|
||||
*b = CPUInfo[1];
|
||||
*c = CPUInfo[2];
|
||||
*d = CPUInfo[3];
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool7z x86cpuid_CheckAndRead(Cx86cpuid *p)
|
||||
{
|
||||
CHECK_CPUID_IS_SUPPORTED
|
||||
MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]);
|
||||
MyCPUID(1, &p->ver, &p->b, &p->c, &p->d);
|
||||
return True;
|
||||
}
|
||||
|
||||
static UInt32_7z kVendors[][3] =
|
||||
{
|
||||
{ 0x756E6547, 0x49656E69, 0x6C65746E},
|
||||
{ 0x68747541, 0x69746E65, 0x444D4163},
|
||||
{ 0x746E6543, 0x48727561, 0x736C7561}
|
||||
};
|
||||
|
||||
int x86cpuid_GetFirm(const Cx86cpuid *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++)
|
||||
{
|
||||
const UInt32_7z *v = kVendors[i];
|
||||
if (v[0] == p->vendor[0] &&
|
||||
v[1] == p->vendor[1] &&
|
||||
v[2] == p->vendor[2])
|
||||
return (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Bool7z CPU_Is_InOrder()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
int firm;
|
||||
UInt32_7z family, model;
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return True;
|
||||
family = x86cpuid_GetFamily(&p);
|
||||
model = x86cpuid_GetModel(&p);
|
||||
firm = x86cpuid_GetFirm(&p);
|
||||
switch (firm)
|
||||
{
|
||||
case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && model == 0x100C));
|
||||
case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
|
||||
case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
|
||||
static Bool7z CPU_Sys_Is_SSE_Supported()
|
||||
{
|
||||
OSVERSIONINFO vi;
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
if (!GetVersionEx(&vi))
|
||||
return False;
|
||||
return (vi.dwMajorVersion >= 5);
|
||||
}
|
||||
#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
|
||||
#else
|
||||
#define CHECK_SYS_SSE_SUPPORT
|
||||
#endif
|
||||
|
||||
Bool7z CPU_Is_Aes_Supported()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return False;
|
||||
return (p.c >> 25) & 1;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,103 @@
|
|||
# Template file for 'qmc2'
|
||||
pkgname=qmc2
|
||||
version=0.52
|
||||
revision=1
|
||||
wrksrc=${pkgname}
|
||||
build_style=gnu-makefile
|
||||
make_build_args="PREFIX=/usr DATADIR=/usr/share MAN_DIR=/usr/share/man TARGET=qmc2-mame"
|
||||
make_install_args="${make_build_args}"
|
||||
hostmakedepends="rsync unzip"
|
||||
makedepends="SDL2-devel qt5-multimedia-devel qt5-script-devel qt5-svg-devel
|
||||
qt5-webkit-devel qt5-xmlpatterns-devel qt5-x11extras-devel"
|
||||
depends="rsync ${pkgname}-data mame"
|
||||
conf_files="/etc/${pkgname}/${pkgname}.ini"
|
||||
short_desc="Qt M.A.M.E. Catalog/Launcher II"
|
||||
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
|
||||
license="GPL-2"
|
||||
homepage="http://qmc2.arcadehits.net/wordpress/"
|
||||
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}/${version}/${pkgname}-${version}.tar.bz2
|
||||
http://distfiles.voidlinux.de/distfiles/qmc2_flyers-20150604.tar.xz
|
||||
http://distfiles.voidlinux.de/distfiles/qmc2_snapshots-20150604.tar.xz"
|
||||
checksum="1b878fcd725816f20217b742d878d59da07c85cfe41fc4e5794cbb21acc88c72
|
||||
e36ecd9eaef60f94207fad8cdc323b114fbd9581feeb03de437df8146dd6cf8e
|
||||
421815fce90013ebd8c63f9a597bca6efa360058f0de7fc50eb7770c0367d962"
|
||||
|
||||
pre_build() {
|
||||
# Replace sdl-config with sdl2-config
|
||||
sed -e "s;sdl-config;sdl2-config;g" -i ${wrksrc}/scripts/sdl-version.sh
|
||||
# Replace obsolete -sdlmame suffix
|
||||
sed -e "s;-sdlmame;-mame;g" -i ${wrksrc}/Makefile
|
||||
# Replace lzma/CpuArch.c with patched version (http://sourceforge.net/p/sevenzip/bugs/1338/)
|
||||
cp -av ${FILESDIR}/CpuArch.c ${wrksrc}/lzma
|
||||
}
|
||||
do_build() {
|
||||
# Print configuration info
|
||||
make ${make_build_args} config
|
||||
make ${makejobs} qchdman
|
||||
make ${make_build_args} ${makejobs}
|
||||
}
|
||||
do_install() {
|
||||
# Install /usr/bin/qmc2-mame and /etc/qmc2/qmc2.ini
|
||||
vbin qmc2-mame
|
||||
vmkdir etc/${pkgname}
|
||||
sed ${wrksrc}/inst/qmc2.ini.template \
|
||||
-e "s;DATADIR;/usr/share;" \
|
||||
> ${DESTDIR}/etc/${pkgname}/${pkgname}.ini
|
||||
|
||||
# Install qmc2 desktop file
|
||||
vmkdir usr/share/applications
|
||||
sed ${wrksrc}/inst/qmc2.desktop.template \
|
||||
-e "s;DATADIR;/usr/share;" \
|
||||
-e "s;EMULATOR;MAME;" \
|
||||
-e "s;TARGET;qmc2-mame;" \
|
||||
-e "s;EMUICO;mame.png;" \
|
||||
-e "s;GENERICNAME;$short_desc;" \
|
||||
> ${DESTDIR}/usr/share/applications/qmc2-mame.desktop
|
||||
|
||||
# Install translations
|
||||
vmkdir usr/share/${pkgname}/lng
|
||||
for qm in $(find ${wrksrc}/data/lng -name "*.qm"); do
|
||||
vinstall $qm 644 ${DESTDIR}/usr/share/${pkgname}/lng
|
||||
done
|
||||
|
||||
# Install qchdman and img
|
||||
vbin ${wrksrc}/tools/qchdman/qchdman
|
||||
vmkdir usr/share/${pkgname}
|
||||
cp -aR ${wrksrc}/data/img ${DESTDIR}/usr/share/${pkgname}
|
||||
|
||||
# Install qchdman desktop file
|
||||
vmkdir usr/share/applications
|
||||
sed ${wrksrc}/inst/qchdman.desktop.template \
|
||||
-e "s;DATADIR;/usr/share;" \
|
||||
> ${DESTDIR}/usr/share/applications/qchdman.desktop
|
||||
}
|
||||
qmc2-data_package() {
|
||||
noarch=yes
|
||||
short_desc+=" - data files"
|
||||
pkg_install() {
|
||||
local ddir
|
||||
vmove usr/share/qmc2
|
||||
for ddir in opt img doc prv fly ico cat cab ctl \
|
||||
mrq ttl sws swn gmn js; do
|
||||
cp -aR data/$ddir ${PKGDESTDIR}/usr/share/qmc2
|
||||
done
|
||||
}
|
||||
}
|
||||
qmc2-flyers_package() {
|
||||
noarch=yes
|
||||
depends="${sourcepkg}>=${version}_${revision}"
|
||||
short_desc+=" - machine flyers images"
|
||||
pkg_install() {
|
||||
mkdir -p ${PKGDESTDIR}/usr/share/qmc2
|
||||
mv -v ${XBPS_BUILDDIR}/fly ${PKGDESTDIR}/usr/share/qmc2
|
||||
}
|
||||
}
|
||||
qmc2-snapshots_package() {
|
||||
noarch=yes
|
||||
depends="${sourcepkg}>=${version}_${revision}"
|
||||
short_desc+=" - machine preview images (snapshots)"
|
||||
pkg_install() {
|
||||
mkdir -p ${PKGDESTDIR}/usr/share/qmc2
|
||||
mv -v ${XBPS_BUILDDIR}/prv ${PKGDESTDIR}/usr/share/qmc2
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue