Weeks of work finally finished

Woo the fucking hoo.
This commit is contained in:
Lexi 2011-07-09 15:51:25 +01:00
parent 9a6de6452e
commit 7bba5c21b8
10 changed files with 1415 additions and 12 deletions

1151
MacBuild/GPL.res Normal file

File diff suppressed because it is too large Load diff

18
MacBuild/HOWTO Normal file
View file

@ -0,0 +1,18 @@
Don't.
If you still want to, here's my terse step by step guide. I only know that this works in Snow Leopard on my mac. It might not work for you.
1) Get python 2.6 from http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
2) Compile it, using configure_python.sh in this directory. It expects to be placed one directory up from python, simply because I compiled everything from ~/python_compile/
3) export PATH=/Library/Frameworks/Python.framework/Versions/2.6/bin/:$PATH for both you and root. Confirm with `which python`
4) sudo su; easy_install pygame; easy_install py2app
5) Get the QT library from http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x/. Do not even consider
trying to compile this whore of a library yourself, it's not worth it. Get the precompiled for your system. Install it.
6) Get SIP from http://www.riverbankcomputing.co.uk/software/sip/download and compile it, making sure to use configure_sip.sh.
7) Get PyQt4 from http://www.riverbankcomputing.co.uk/software/pyqt/download and compile it, also with my configure script (configure_pyqt4.sh). This will take ages.
8) ./py2app.sh and wait for it to build everything and make itself into a purdy DMG
9) Rejoice that you didn't have to spend two weeks compiling hundreds of versions of all things mentioned here, including an entire day simply waiting for QT to compile by
itself on the offchance that this would make it work.
If you want to make a nicer looking dmg file, play with dmg_background.png
~Lex

20
MacBuild/configure_pyqt4.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
echo "Lexi's lazy configuration. This is not an official configure script. Press enter to confirm this."
read confirm
if [ ! -d pyqt4 ]
then
echo "Rename your pyqt4 folder to pyqt4."
exit 1
fi
cd pyqt4
if [ -e makefile ]
then
make clean
fi
python configure.py \
--confirm-license \
--use-arch=i386 \
--use-arch=x86_64 \
--destdir=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages \
--verbose
echo "---~ Done ~---"

23
MacBuild/configure_python.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
#
# Lexi's ./configure script
#
echo "Lexi's lazy configuration. This is not an official configure script. Press enter to confirm this."
read confirm
if [ ! -d python ]
then
echo "Rename your python folder to python."
exit 1
fi
cd python
if [! -d python ]
then
echo "Rename your python folder to python."
exit 1
fi
if [ -e makefile ]
then
make clean
fi
./configure --enable-framework --enable-universalsdk=/ --with-universal-archs=intel MACOSX_DEPLOYMENT_TARGET=10.6
echo "---~ Done ~---"

21
MacBuild/configure_sip.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
#
# Lexi's Configurations
#
echo "Lexi's lazy configuration. This is not an official configure script. Press enter to confirm this."
read confirm
if [ ! -d sip ]
then
echo "Rename your sip folder to sip."
exit 1
fi
cd sip
if [ -e makefile ]
then
make clean
fi
python configure.py --arch=i386 --arch=x86_64 \
--universal --deployment-target=10.6 \
--destdir=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
echo "---~ Done ~---"

BIN
MacBuild/dmg_background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
MacBuild/dmg_background.xcf Normal file

Binary file not shown.

View file

@ -47,3 +47,7 @@ Mac Bugs
* SS: in the one-on-one pester it resizes with the window * SS: in the one-on-one pester it resizes with the window
* SS: but the memo one doesn't resize * SS: but the memo one doesn't resize
* SS: and the arrows next to the time thing overlap the CLOSE button * SS: and the arrows next to the time thing overlap the CLOSE button
* Make the quirks/ folder be in the data location
* Make it so data can be loaded from both the data location and the
internal location so that built in data (such as default python
quirks) can be loaded as well as user defined data (again pyquirx)

144
py2app.sh
View file

@ -1,9 +1,139 @@
#!/bin/sh #!/bin/sh
## Cleanup
rm -rf build/ dist/
rm -f Pesterchum.dmg
### Force build with custom installed frameworky python not system python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python setup-py2app.py py2app
#python setup-py2app.py py2app
#
### Do some .app tings
touch dist/Pesterchum.app/Contents/Resources/qt.conf
find dist/Pesterchum.app -iname "*_debug" -exec rm -f '{}' \;
## Create a dmg file to hold everything
VERSION="3.41.2 Beta 5"
SIZE=2000
name="Pesterchum"
title="${name} ${VERSION}"
CHANGELOG="Changelog.rtf"
PYQUIRKS="Python Quirks.rtf"
TODO="To Do.rtf"
README="Read Me!.rtf"
## Make a proper installer dmg not just effectively a zip file.
#
# Most of this is from http://stackoverflow.com/questions/96882/
# I've fiddled with it a little
# Store the background picture (in PNG format) in a folder called ".background"
# in the DMG, and store its name in the "backgroundPictureName" variable.
mkdir dist/.background
cp MacBuild/dmg_background.png dist/.background/display.png
# Convert markdown files to rich text files
convert=~/Library/Haskell/bin/pandoc
if ! test -e "${convert}"
then
echo "Please install pandoc from http://johnmacfarlane.net/pandoc/" 1>&2
exit 1
fi
echo "Converting CHANGELOG . . . "
$convert --standalone --smart --from=markdown --to=rtf --output="dist/${CHANGELOG}" CHANGELOG.mkdn
echo "Converting PYQUIRKS . . ."
$convert --standalone --smart --from=markdown --to=rtf --output="dist/${PYQUIRKS}" PYQUIRKS.mkdn
echo "Converting TODO . . ."
$convert --standalone --smart --from=markdown --to=rtf --output="dist/${TODO}" TODO.mkdn
echo "Converting README . . ."
$convert --standalone --smart --from=markdown --to=rtf --output="dist/${README}" README.mkdn
# Create a R/W DMG. It must be larger than the result will be.
# In this example, the bash variable "size" contains the size
# in Kb and the contents of the folder in the "source" bash
# variable will be copied into the DMG:
# Note: I've removed the size argument
echo "Creating initial DMG file . . ."
hdiutil create -srcfolder "./dist" -volname "${title}" -fs HFS+ \
-fsargs "-c c=64,a=16,e=16" -format UDRW pack.temp.dmg
# Mount the disk image, and store the device name
# (you might want to use sleep for a few seconds after this operation):
echo "Mounting initial DMG file . . ."
device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
sleep 2
# Use AppleScript to set the visual styles (name of .app must be in bash variable
# "applicationName", use variables for the other properties as needed):
base=100
iconsize=72
padding=18
echo "Making DMG file pretty with Applescript . . ."
echo '
tell application "Finder"
tell disk "'${title}'"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 430}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
set background picture of theViewOptions to file ".background:display.png"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
-- Positions
set position of item "'${name}'.app" of container window to {100, 100}
set position of item "Applications" of container window to {375, 100}
set position of item "'${README}'" of container window to {'${base}+${iconsize}*0+${padding}*0', 244}
set position of item "'${CHANGELOG}'" of container window to {'${base}+${iconsize}*1+${padding}*1', 244}
set position of item "'${PYQUIRKS}'" of container window to {'${base}+${iconsize}*2+${padding}*2', 244}
set position of item "'${TODO}'" of container window to {'${base}+${iconsize}*3+${padding}*3', 244}
-- Visibility
set extension hidden of item "'${CHANGELOG}'" of container window to true
set extension hidden of item "'${PYQUIRKS}'" of container window to true
set extension hidden of item "'${TODO}'" of container window to true
set extension hidden of item "'${README}'" of container window to true
close
open
update without registering applications
delay 5
eject
end tell
end tell
' | osascript
# This took so long to work out how to do ._.
# Stolen from http://lists.apple.com/archives/darwin-userlevel/2007/Oct/msg00000.html
# Set the SLA to read only (dunno why)
echo "Converting initial DMG file to a UDRO one . . ."
hdiutil convert -ov -format UDRO -o "sla.temp.dmg" "pack.temp.dmg"
# Inflate the dmg
echo "Inflating UDRO DMG file . . ."
hdiutil unflatten "sla.temp.dmg"
# Attach the GPL
echo "Attaching GPL licence . . ."
Rez -a MacBuild/GPL.res -o "sla.temp.dmg"
# Steamroller again
echo "Deflating UDRO DMG file . . ."
hdiutil flatten "sla.temp.dmg"
# Finialize the DMG by setting permissions properly, compressing and releasing it:
#chmod -Rf go-w /Volumes/"${title}"
sync
#hdiutil detach ${device}
echo "Compressing UDRO DMG file to UDZO for release . . ."
hdiutil convert "sla.temp.dmg" -format UDZO -imagekey zlib-level=6 -o "${name}.dmg"
# Get rid of the bits
echo "Cleaning up . . ."
rm -f pack.temp.dmg
rm -f sla.temp.dmg
rm -rf build/ dist/ rm -rf build/ dist/
python setup-py2app.py py2app
touch dist/pesterchum.app/Contents/Resources/qt.conf
find dist/pesterchum.app -iname "*_debug" -exec rm -f '{}' \;
rm -rf Pesterchum
mv dist Pesterchum
rm -f pesterchum.dmg
hdiutil create pesterchum.dmg -srcdir Pesterchum -format UDZO

View file

@ -8,14 +8,50 @@ Usage:
from setuptools import setup from setuptools import setup
APP = ['pesterchum.py'] APP = ['pesterchum.py']
DATA_FILES = ['pesterchum.js', 'profiles', 'themes', 'smilies', 'logs'] #DATA_FILES = ['pesterchum.js', 'profiles', 'themes', 'smilies', 'logs']
OPTIONS = {'argv_emulation': False, 'includes': ['sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui'], DATA_FILES = ['quirks']
'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon'], # TODO: Grep this version out of version.py
'iconfile': 'trayicon32.icns'} SHORT_VERSION = '3.41.2B5'
LONG_VERSION = '3.41.2 Beta 5 Bleeding Edge'
OPTIONS = {
'argv_emulation': False,
'prefer_ppc': True,
'includes': [
'sip',
'PyQt4',
'PyQt4.QtCore',
'PyQt4.QtGui'
],
'excludes': [
'PyQt4.QtDesigner',
'PyQt4.QtNetwork',
'PyQt4.QtOpenGL',
'PyQt4.QtScript',
'PyQt4.QtSql',
'PyQt4.QtTest',
'PyQt4.QtWebKit',
'PyQt4.QtXml',
'PyQt4.phonon'
],
'iconfile': 'trayicon32.icns'
# ,
# 'plist': {
# 'CFBundleDisplayName': 'Pesterchum v3',
# 'NSHumanReadableCopyright': 'GPLv3',
# 'CFBundleGetInfoString': 'o_O???',
# 'CFBundleIdentifier': 'org.pythonmac.pesterchum',
# 'CFBundleVersion': LONG_VERSION,
# 'CFBundleShortVersionString': SHORT_VERSION
# }
}
setup( setup(
name='Pesterchum',
description='A client for the pesterchum network',
version=LONG_VERSION,
license='GPL v3',
app=APP, app=APP,
data_files=DATA_FILES, data_files=DATA_FILES,
platforms=['i386', 'x86_64'],
options={'py2app': OPTIONS}, options={'py2app': OPTIONS},
setup_requires=['py2app'], setup_requires=['py2app'],
) )