Commit 9c4c985b authored by Oskar Skog's avatar Oskar Skog

Merge branch 'master' into 'master'

0.5.11: Mac OS X...

See merge request !27
parents 95ef3584 d04ab09a
......@@ -11,6 +11,7 @@ icon.icns
Info.plist
check.py
anonymine-wrapper
macosx1
anonymine.desktop
enginecfg.out
mkenginecfg.py
......
2019-07-13 Oskar Skog <https://oskog97.com/#contact>
0.5.11
* configure.py (find_MODULES): Support Homebrew's PyPy.
* mkenginecfg:
- Figured out which systems support which commands
- Made quiet (failed attempt to redirect to /dev/null)
* Makefile.static, desktop/Info.plist.py, desktop/macosx2:
- Modified the wrapper to clean up the terminal window
- Corrected Info.plist
* desktop/icon.icns.py: Softwaregore galore
2019-07-11 Oskar Skog <https://oskog97.com/#contact>
0.5.10
* Makefile.static (uninstall), INSTALL:
......
......@@ -47,6 +47,7 @@ https://www.macworld.co.uk/feature/mac-software/how-use-terminal-on-mac-3608274/
./configure -v
make
sudo make install
(The last one should prompt for your password)
INSTALLATION
......@@ -153,7 +154,7 @@ Advanced installation
Variable default and/or description
-------- --------------------------
prefix sys.prefix
prefix /usr/local, /usr
bindir $(prefix)/bin # NOTE 1
gamesdir $(prefix)/games
libdir $(prefix)/lib
......@@ -167,7 +168,7 @@ Advanced installation
MODULES See its own subsection
INSTALL which install(8) utility to use.
(/usr/ucb/install on Solares)
(/usr/ucb/install on Solaris and similar)
DESTDIR Pretend the root is here (staged installs)
srcdir The directory extracted from the tarball.
......@@ -176,7 +177,7 @@ Advanced installation
freedesktop 'true' or 'false'; "Linux" desktop
macosx 'true' or 'false'; Mac OS X
NOTE 1: gamesdir, bindir
gamesdir will override bindir if possible, so setting bindir
might have no effect.
......
......@@ -15,7 +15,7 @@
NAME := anonymine
NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing
VERSION := 0.5.10
VERSION := pre-0.5.11
# Four more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES
......@@ -72,15 +72,18 @@ FD_DESKTOP_STAGE := $(builddir)$(NAME).desktop
FD_DESKTOP_DEST := $(DESTDIR)$(prefix)/share/applications/$(NAME).desktop
# Mac OS X, see desktop/README
OSX_WRAPPER := $(builddir)$(NAME)-wrapper
OSX_WRAPPER1 := $(builddir)macosx1
OSX_WRAPPER2 := $(srcdir)desktop/macosx2
OSX_INFO_PLIST := $(builddir)Info.plist
OSX_MK_INFO_PLIST := $(srcdir)desktop/Info.plist.py
OSX_ICON := $(builddir)icon.icns
OSX_MK_ICON := $(srcdir)desktop/icon.icns.py
# See desktop/README
BUNDLE := /Applications/$(NAME_C).app
# make clean
ALL_STAGE := "$(MAIN_STAGE)" "$(OSX_WRAPPER)" "$(OSX_INFO_PLIST)" \
ALL_STAGE := "$(MAIN_STAGE)" "$(OSX_WRAPPER1)" "$(OSX_INFO_PLIST)" \
"$(OSX_ICON)" "$(builddir)check.py" "$(FD_DESKTOP_STAGE)" \
"$(ENGINECFG_STAGE)" "$(builddir)mkenginecfg.py" \
"$(builddir)module-symlinks"
......@@ -130,15 +133,14 @@ $(FD_DESKTOP_STAGE) : $(FD_MK_DESKTOP) $(builddir)Makefile
@"$(FD_MK_DESKTOP)" "$(FD_DESKTOP_STAGE)" $(NAME) "$(NAME_C)" \
"$(DESCRIPTION) -- version $(VERSION)"
build-macosx : $(OSX_WRAPPER) $(OSX_INFO_PLIST) $(OSX_ICON)
build-macosx : $(OSX_WRAPPER1) $(OSX_INFO_PLIST) $(OSX_ICON)
@: # Refer to desktop/README for information about the following.
@$(info) 'Mac OS X stuff created'
$(OSX_WRAPPER) : $(builddir)Makefile
@echo '#!/bin/sh' > "$(OSX_WRAPPER)"
@echo 'open -b com.apple.terminal' "$(MAIN_DEST)" >> "$(OSX_WRAPPER)"
$(OSX_WRAPPER1) : $(builddir)Makefile
@echo '#!/bin/sh' > "$(OSX_WRAPPER1)"
@echo 'open -b com.apple.terminal' "$(BUNDLE)/Contents/MacOS/macosx2" >> "$(OSX_WRAPPER1)"
$(OSX_INFO_PLIST) : $(OSX_MK_INFO_PLIST) $(builddir)Makefile
@$(python) "$(OSX_MK_INFO_PLIST)" "$(OSX_INFO_PLIST)" "$(NAME_C)" \
"$(NAME_C) - $(DESCRIPTION)" $(VERSION) $(NAME)
@$(python) "$(OSX_MK_INFO_PLIST)" "$(OSX_INFO_PLIST)" "$(DESCRIPTION)" "$(VERSION)"
$(OSX_ICON) : $(srcdir)/desktop/$(NAME)*.png $(OSX_MK_ICON) $(builddir)Makefile
@$(python) "$(OSX_MK_ICON)" "$(OSX_ICON)" "$(srcdir)desktop/$(NAME)"
......@@ -197,8 +199,6 @@ FD_ICON_SRC256 := $(srcdir)desktop/$(NAME)-256x256.png
FD_ICON_DESTDIR256 := $(DESTDIR)$(prefix)/share/icons/hicolor/256x256/apps
FD_ICON_DEST256 := $(FD_ICON_DESTDIR256)/$(NAME).png
# See desktop/README
BUNDLE := $(DESTDIR)/Applications/$(NAME_C).app
check-install-cfg : $(builddir)Makefile FORCE
@cd "$(builddir)" && $(MAKE) _check-install-cfg >/dev/null
......@@ -234,9 +234,9 @@ _install-dirs : FORCE
mkdir -p "$(DESTDIR)$(prefix)/share/pixmaps" || true; \
fi
@if "$(macosx)"; then \
$(INSTALL) -d "$(BUNDLE)/Contents"; \
$(INSTALL) -d "$(BUNDLE)/Contents/MacOS"; \
$(INSTALL) -d "$(BUNDLE)/Contents/Resources"; \
$(INSTALL) -d "$(DESTDIR)$(BUNDLE)/Contents"; \
$(INSTALL) -d "$(DESTDIR)$(BUNDLE)/Contents/MacOS"; \
$(INSTALL) -d "$(DESTDIR)$(BUNDLE)/Contents/Resources"; \
fi
install : $(builddir)Makefile FORCE
......@@ -268,11 +268,13 @@ _install : _all _check-install-cfg _install-dirs
@if "$(macosx)"; then \
$(info) 'Installing app/bundle'; \
$(INSTALL) -m 644 "$(OSX_INFO_PLIST)" \
"$(BUNDLE)/Contents/Info.plist"; \
$(INSTALL) -m 755 "$(OSX_WRAPPER)" \
"$(BUNDLE)/Contents/MacOS/$(NAME)-wrapper"; \
"$(DESTDIR)$(BUNDLE)/Contents/Info.plist"; \
$(INSTALL) -m 755 "$(OSX_WRAPPER1)" \
"$(DESTDIR)$(BUNDLE)/Contents/MacOS/macosx1"; \
$(INSTALL) -m 755 "$(OSX_WRAPPER2)" \
"$(DESTDIR)$(BUNDLE)/Contents/MacOS/macosx2"; \
$(INSTALL) -m 644 "$(OSX_ICON)" \
"$(BUNDLE)/Contents/Resources/icon.icns"; \
"$(DESTDIR)$(BUNDLE)/Contents/Resources/icon.icns"; \
fi
@$(POST_INSTALL)
@if "$(freedesktop)"; then \
......@@ -289,12 +291,12 @@ _uninstall : FORCE
xdg-desktop-menu uninstall --novendor --mode system \
"$(FD_DESKTOP_DEST)" || true; \
fi
@-pypy symlinks uninstall
@-pypy3 symlinks uninstall
@-pypy2 symlinks uninstall
@-python symlinks uninstall
@-python3 symlinks uninstall
@-python2 symlinks uninstall
@pypy symlinks uninstall 2>/dev/null || true
@pypy3 symlinks uninstall 2>/dev/null || true
@pypy2 symlinks uninstall 2>/dev/null || true
@python symlinks uninstall 2>/dev/null || true
@python3 symlinks uninstall 2>/dev/null || true
@python2 symlinks uninstall 2>/dev/null || true
@$(NORMAL_UNINSTALL)
@-rm "$(ENGINE_DEST)" "$(SOLVER_DEST)" "$(FIELDS_DEST)" "$(MAIN_DEST)"
......
#!/usr/bin/python
# Copyright (c) Oskar Skog, 2016-2018
# Copyright (c) Oskar Skog, 2016-2019
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
......@@ -365,15 +365,25 @@ def find_MODULES(Makefile, flags):
prefixes = [libdir + '/python']
try:
import platform
prefixes.append(libdir+'/'+platform.python_implementation().lower())
prefixes.append(libdir+'/'+platform.python_implementation())
prefixes.append(prefix+'/'+platform.python_implementation().lower())
prefixes.append(prefix+'/'+platform.python_implementation())
Implementation = platform.python_implementation()
implementation = Implementation.lower()
# Homebrew
prefixes.append(prefix+'/Cellar/'+implementation)
prefixes.append(prefix+'/Cellar/'+Implementation)
if sys.version_info[0] == 3:
prefixes.append(prefix+'/Cellar/'+implementation+'3')
prefixes.append(prefix+'/Cellar/'+Implementation+'3')
# Standard
prefixes.append(libdir+'/'+implementation)
prefixes.append(libdir+'/'+Implementation)
prefixes.append(prefix+'/'+implementation)
prefixes.append(prefix+'/'+Implementation)
except ImportError:
pass
except AttributeError:
pass
suffixes = ['/site-packages', '/dist-packages']
# Homebrew Standard Debian
suffixes = ['/libexec/site-packages', '/site-packages', '/dist-packages']
for suffix in suffixes:
for prefix in prefixes:
......
#!/usr/bin/python
# Build Info.plist for Mac OS X.
# Info.plist.py outfile human_name description_name version tech_name
# Info.plist.py outfile slogan version
import sys
f = open(sys.argv[1], 'w')
outfile = sys.argv[1]
slogan = sys.argv[2]
version_in = sys.argv[3]
# Apple wants the major number to be greater than zero.
try:
assert False # But it works without this conversion too.
if version_in.startswith('pre-') or version_in.startswith('test-'):
alpha = True
version_in = version_in.split('-')[1]
else:
alpha = False
major, minor, micro = tuple(map(int, version_in.split('.')))
apple_version = '{0}.{1}{2}'.format(
100*major + minor,
micro,
'd'*alpha
)
except:
apple_version=version_in
f = open(outfile, 'w')
f.write('''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key> <string>{2}</string>
<key>CFBundleDisplayName</key> <string>{3}</string>
<key>CFBundleVersion</key> <string>{4}</string>
<!-- -->
<key>CFBundleName</key> <string>Anonymine</string>
<key>CFBundleIdentifier</key> <string>com.oskog97.anonymine</string>
<key>CFBundleDisplayName</key> <string>Anonymine - {0}</string>
<key>CFBundleVersion</key> <string>{1}</string>
<key>CFBundleShortVersionString</key> <string>{1}</string>
<!--
https://cocoadev.github.io/CFBundleSignature/
<key>CFBundleSignature</key> <string>boom</string>
-->
<key>CFBundlePackageType</key> <string>APPL</string>
<key>CFBundleExecutable</key> <string>{5}-wrapper</string>
<key>CFBundleExecutable</key> <string>macosx1</string>
<key>CFBundleIconFile</key> <string>icon.icns</string>
<key>LSApplicationCategoryType</key><string>public.app-category.puzzle-games</string>
<!-- -->
<key>NSHumanReadableCopyright</key>
<string>
Copyright (c) 2016, Oskar Skog
Copyright (c) 2016-2019, Oskar Skog
This software is released under the FreeBSD license (2-clause BSD).
</string>
</dict>
</plist>
'''.format(*sys.argv))
'''.format(slogan, apple_version))
f.close()
......@@ -29,10 +29,10 @@ def be32(x):
PNGs = [
('icp4', '-16x16.png'), # Since Mac OS X 10.7
('icp5', '-32x32.png'), # Since Mac OS X 10.7
('icp6', '-64x64.png'), # Since Mac OS X 10.7
('ic08', '-256x256.png'), # ** Since Mac OS X 10.5
# ('icp4', '-16x16.png'), # Since Mac OS X 10.7, broken in terminal title bar
# ('icp5', '-32x32.png'), # Since Mac OS X 10.7, broken in "Get info"
# ('icp6', '-64x64.png'), # Since Mac OS X 10.7, broken in "Get info"
('ic08', '-256x256.png'), # Since Mac OS X 10.5
]
data = bytes()
......@@ -40,11 +40,12 @@ data = bytes()
def infomsg():
data = bytes()
msg = '''\0\0\0\0\0\0\0\0\n
Copyright (C) 2016-2018 Oskar Skog, released under Creative Commons Attribution
Copyright (C) 2016-2019 Oskar Skog, released under Creative Commons Attribution
CC-BY 4.0
Created by custom script, contains
16x16, 32x32, 64x64 as PNGs as well as 256x256 as PNG
There were supposed to be 16x16, 32x32 and 64x64 PNGs here too, but some parts
of OS X didn't like them. But having a message like this is apparently not a
problem... SMH
\n\0\0\0\0'''
if sys.version_info[0] == 3:
msg = msg.encode('utf-8')
......
#!/bin/bash
clear
printf "\033]2; ------- Anonymine ------- \007"
anonymine
clear
echo ")-:"
echo "Sorry, this window can't close itself"
echo; echo
......@@ -15,7 +15,7 @@ NAME="anonymine"
subdirs="desktop windows-beta"
files="${NAME}.py ${NAME}_engine.py ${NAME}_fields.py ${NAME}_solver.py \
configure.py Makefile.static install-cfg enginecfg.fallback cursescfg \
test.py testcfg desktop/Info.plist.py desktop/icon.icns.py \
test.py testcfg desktop/Info.plist.py desktop/icon.icns.py desktop/anonymine-wrapper2 \
ChangeLog FAQ INSTALL NEWS README LICENSE desktop/FILES \
desktop/README RELEASE-NOTES INSTALL.Haiku INSTALL.Windows.txt \
configure check.sh desktop/desktop.sh desktop/${NAME}-*.png \
......
#!/bin/sh
if [ $# -ne 4 ]; then
cat >&2 <<__EOF__
# ./mkenginecfg python_interpreter srcdir builddir hiscorefile
# This shell script is a wrapper around a Python script that will be spit
# out.
__EOF__
exit 1
echo "./mkenginecfg python_interpreter srcdir builddir hiscorefile" >&2
exit 1
fi
python=$1
......@@ -74,17 +69,17 @@ __EOF__
# succeed! (wc -l says there are zero processors.)
# BUG *1: sysctl(1) on OpenBSD does not fail, the first sysctl command
# must work.
# NOTICE v: Don't forget the semicolon!
_n0 () { nproc --all; } # Debian
_n1 () { lscpu && lscpu -p | grep -v '#' | wc -l; } # (Linux)/Debian
_n2 () { sysctl -n hw.ncpufound; } # OpenBSD, BUG *1
_n3 () { sysctl -n kern.smp.cpus; } # BSD (Should I use this?)
_n4 () { sysctl -n hw.logicalcpu; } # BSD
_n5 () { sysctl -n hw.ncpu; } # BSD (fallback)
_n6 () { psrinfo && psrinfo | wc -l; } # (OpenSolaris)/openidiana
# NOTICE v: Don't forget the semicolon!
_n0 () { nproc; } # GNU coreutils
_n1 () { lscpu && lscpu -p | grep -v '#' | wc -l;} # util-linux
_n2 () { sysctl -n hw.ncpufound; } # OpenBSD (BUG *1)
_n3 () { sysctl -n kern.smp.cpus; } # FreeBSD
_n4 () { sysctl -n hw.logicalcpu; } # Mac OS X
_n5 () { sysctl -n hw.ncpu; } # OpenBSD, NetBSD, DragonflyBSD, Mac OS X
_n6 () { psrinfo && psrinfo | wc -l;} # (OpenSolaris)/openidiana
n=0; last=6
while [ $n -le $last ]; do
ncpus=`_n$n` 2> /dev/null && break
ncpus="$(_n$n 2>/dev/null)" && break
n=$(($n + 1))
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment