mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Initial work on supporting haiku
This commit is contained in:
commit
511bb93d4a
75
icons/calibre_haiku.rdef
Normal file
75
icons/calibre_haiku.rdef
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
resource(<your resource id here>) #'VICN' array {
|
||||
$"6E6369660C035B757B050003C6490502001600000000B4240934240900000046"
|
||||
$"CC714B5C4D020116003B0BE5A9E62321324B327F604901F6477F20020116003A"
|
||||
$"B4ABA97CE720E14E323BF7C8526C4B420E020116002E6276BBD25A3A0E232C90"
|
||||
$"974901F64A6F530379ABFF030C11BA03D6B8650201160040525ABAB75A32B50C"
|
||||
$"385062D1580E4C470B020116003D7EB5B802CC30304635CDBF4A1F424403D320"
|
||||
$"0A04BA20B65ABF0BB65ABF0BCA6ABA20CA6A0A04BA20B65ABF0BB65ABF0BCA6A"
|
||||
$"BA20CA6A0A04B477B444BA02B444BA02CA6AB477CA6A0A04B477B444BA02B444"
|
||||
$"BA02CA6AB477CA6A0A04B471B59FBA07B59FBA07B682B471B6820A04B471B59F"
|
||||
$"BA07B59FBA07B682B471B6820A04B470C7FAB9F7C7FAB9F7C8DEB470C8DE0A04"
|
||||
$"B470C7FAB9F7C7FAB9F7C8DEB470C8DE0A04BA1BB852BF10B852BF10B8D2BA1B"
|
||||
$"B8D20A04BA1BB852BF10B852BF10B8D2BA1BB8D20A04BA20C80CBF0CC80CBF0C"
|
||||
$"C88CBA20C88C0A04BA20C80CBF0CC80CBF0CC88CBA20C88C0205B2D7B268B2D8"
|
||||
$"B290B2D6B251B30FB241B2ECB242B327B241B361B255B345B248B382B265B395"
|
||||
$"B28FB395B279B396B2A6B360B2B7B381B2B6B31EB2B80205B2D7B268B2D8B290"
|
||||
$"B2D6B251B30FB241B2ECB242B327B241B361B255B345B248B382B265B395B28F"
|
||||
$"B395B279B396B2A6B360B2B7B381B2B6B31EB2B80211B3D9B22EB3D9B22EB3D9"
|
||||
$"B22EB3DFB238B3DFB238B3F5B25FB3F9B26CB3F8B265B3F9B273B3E9B277B3F3"
|
||||
$"B277B3DFB277B393B266B3DFB277B33BB253B337B253B33BB253B333B253B331"
|
||||
$"B25AB331B256B331B26421B2B4B345B28521B2B4B376B2B4B376B2B4B362B292"
|
||||
$"B361B28BB362B290B361B286B36BB284B365B284B373B284B39CB28DB37BB285"
|
||||
$"B400B2A5B40FB2A5B400B2A5B41DB2A5B426B297B426B29FB426B28DB40AB260"
|
||||
$"B41EB27EB402B255B3F4B240B3FBB24AB3F1B23BB3E9B230B3EEB237B3E9B230"
|
||||
$"0211B3D9B22EB3D9B22EB3D9B22EB3DFB238B3DFB238B3F5B25FB3F9B26CB3F8"
|
||||
$"B265B3F9B273B3E9B277B3F3B277B3DFB277B393B266B3DFB277B33BB253B337"
|
||||
$"B253B33BB253B333B253B331B25AB331B256B331B26421B2B4B345B28521B2B4"
|
||||
$"B376B2B4B376B2B4B362B292B361B28BB362B290B361B286B36BB284B365B284"
|
||||
$"B373B284B39CB28DB37BB285B400B2A5B40FB2A5B400B2A5B41DB2A5B426B297"
|
||||
$"B426B29FB426B28DB40AB260B41EB27EB402B255B3F4B240B3FBB24AB3F1B23B"
|
||||
$"B3E9B230B3EEB237B3E9B2300206B2C0B2BBB2C0B2BBB2E4B2EBB2EC1FB2ECB2"
|
||||
$"F7B2ECB307B2D3B30CB2E4B30CB2C0B30DB291B303B2ABB30AB257B2F5B239B2"
|
||||
$"C1B239B2DFB238B2B6B247B2A3B23CB2AFB247B2A30206B2C0B2BBB2C0B2BBB2"
|
||||
$"E4B2EBB2EC1FB2ECB2F7B2ECB307B2D3B30CB2E4B30CB2C0B30DB291B303B2AB"
|
||||
$"B30AB257B2F5B239B2C1B239B2DFB238B2B6B247B2A3B23CB2AFB247B2A30205"
|
||||
$"B2D7B268B2D8B290B2D6B251B30FB241B2ECB242B327B241B361B255B345B248"
|
||||
$"B382B265B395B28FB395B279B396B2A6B360B2B7B381B2B6B31EB2B80205B2D7"
|
||||
$"B268B2D8B290B2D6B251B30FB241B2ECB242B327B241B361B255B345B248B382"
|
||||
$"B265B395B28FB395B279B396B2A6B360B2B7B381B2B6B31EB2B80209B2BAB2B0"
|
||||
$"B2B0B2ADB2C9B2C4B2D1B2CEB2D1B2CEB2DEB2E1B2E6B2F7B2E6B2F0B2E6B301"
|
||||
$"B2CAB307B2DCB306B2ACB307B265B2F2B28620B245B2E5B238B2C5B239B2D8B2"
|
||||
$"38B2BAB23EB294B23AB2A7B268B29EB27AB2A2B278B2A2B289B2A6B2A6B2ABB2"
|
||||
$"97B2A8B2A9B2AC0209B2BAB2B0B2B0B2ADB2C9B2C4B2D1B2CEB2D1B2CEB2DEB2"
|
||||
$"E1B2E6B2F7B2E6B2F0B2E6B301B2CAB307B2DCB306B2ACB307B265B2F2B28620"
|
||||
$"B245B2E5B238B2C5B239B2D8B238B2BAB23EB294B23AB2A7B268B29EB27AB2A2"
|
||||
$"B278B2A2B289B2A6B2A6B2ABB297B2A8B2A9B2AC0A04C31FBBFAC888BB01CB68"
|
||||
$"C97FC5FFCA780A04C31FBBFAC888BB01CB68C97FC5FFCA780A05C689C2C5C6FF"
|
||||
$"C1C5C7C2C28FC687BB62C54EBB980A05C689C2C5C6FFC1C5C7C2C28FC687BB62"
|
||||
$"C54EBB980209C1C9B3D0C1EEB3D2C1C3B3CFC1B8B3D045B3CFC1B8B3D0BF15B4"
|
||||
$"27BF15B427BEE9B42CBECFB480BECAB454BECFB480C195CA24C195CA24C19BCA"
|
||||
$"50C1EFCA6AC1C3CA6FC1EFCA6AC493CA13C493CA13C4BFCA0DC4D8C9B9C4DEC9"
|
||||
$"E5C4D8C9B9C212B415C212B415C20DB3EF0209C1C9B3D0C1EEB3D2C1C3B3CFC1"
|
||||
$"B8B3D045B3CFC1B8B3D0BF15B427BF15B427BEE9B42CBECFB480BECAB454BECF"
|
||||
$"B480C195CA24C195CA24C19BCA50C1EFCA6AC1C3CA6FC1EFCA6AC493CA13C493"
|
||||
$"CA13C4BFCA0DC4D8C9B9C4DEC9E5C4D8C9B9C212B415C212B415C20DB3EF0209"
|
||||
$"C1C9B3D0C1EEB3D2C1C3B3CFC1B8B3D045B3CFC1B8B3D0BF15B427BF15B427BE"
|
||||
$"E9B42CBECFB480BECAB454BECFB480C195CA24C195CA24C19BCA50C1EFCA6AC1"
|
||||
$"C3CA6FC1EFCA6AC493CA13C493CA13C4BFCA0DC4D8C9B9C4DEC9E5C4D8C9B9C2"
|
||||
$"12B415C212B415C20DB3EF0209C1C9B3D0C1EEB3D2C1C3B3CFC1B8B3D045B3CF"
|
||||
$"C1B8B3D0BF15B427BF15B427BEE9B42CBECFB480BECAB454BECFB480C195CA24"
|
||||
$"C195CA24C19BCA50C1EFCA6AC1C3CA6FC1EFCA6AC493CA13C493CA13C4BFCA0D"
|
||||
$"C4D8C9B9C4DEC9E5C4D8C9B9C212B415C212B415C20DB3EF0209C1C9B3D0C1EE"
|
||||
$"B3D2C1C3B3CFC1B8B3D045B3CFC1B8B3D0BF15B427BF15B427BEE9B42CBECFB4"
|
||||
$"80BECAB454BECFB480C195CA24C195CA24C19BCA50C1EFCA6AC1C3CA6FC1EFCA"
|
||||
$"6AC493CA13C493CA13C4BFCA0DC4D8C9B9C4DEC9E5C4D8C9B9C212B415C212B4"
|
||||
$"15C20DB3EF0209C1C9B3D0C1EEB3D2C1C3B3CFC1B8B3D045B3CFC1B8B3D0BF15"
|
||||
$"B427BF15B427BEE9B42CBECFB480BECAB454BECFB480C195CA24C195CA24C19B"
|
||||
$"CA50C1EFCA6AC1C3CA6FC1EFCA6AC493CA13C493CA13C4BFCA0DC4D8C9B9C4DE"
|
||||
$"C9E5C4D8C9B9C212B415C212B415C20DB3EF160A000100000A01010110011780"
|
||||
$"00040A020102000A0101031001178000040A010104000A010105100117800004"
|
||||
$"0A010106000A0101071001178000040A050108000A0101091001178000040A05"
|
||||
$"010A000A01010B1001178000040A070116000A0101171001178000040A080118"
|
||||
$"000A0101191001178000040A09011A000A02011B1001178000040A03011C000A"
|
||||
$"01011D1001178000040A09011E000A01011F100117800004"
|
||||
};
|
@ -15,7 +15,8 @@ isfreebsd = 'freebsd' in sys.platform
|
||||
isnetbsd = 'netbsd' in sys.platform
|
||||
isdragonflybsd = 'dragonfly' in sys.platform
|
||||
isbsd = isnetbsd or isfreebsd or isdragonflybsd
|
||||
islinux = not isosx and not iswindows and not isbsd
|
||||
ishaiku = 'haiku1' in sys.platform
|
||||
islinux = not isosx and not iswindows and not isbsd and not ishaiku
|
||||
sys.setup_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC = os.path.abspath(os.path.join(os.path.dirname(sys.setup_dir), 'src'))
|
||||
sys.path.insert(0, SRC)
|
||||
|
@ -9,8 +9,8 @@ __docformat__ = 'restructuredtext en'
|
||||
import textwrap, os, shlex, subprocess, glob, shutil, re, sys, json
|
||||
from collections import namedtuple
|
||||
|
||||
from setup import Command, islinux, isbsd, isosx, SRC, iswindows, __version__
|
||||
isunix = islinux or isosx or isbsd
|
||||
from setup import Command, islinux, isbsd, isosx, ishaiku, SRC, iswindows, __version__
|
||||
isunix = islinux or isosx or isbsd or ishaiku
|
||||
|
||||
py_lib = os.path.join(sys.prefix, 'libs', 'python%d%d.lib' % sys.version_info[:2])
|
||||
|
||||
@ -81,7 +81,7 @@ def is_ext_allowed(ext):
|
||||
only = ext.get('only', '')
|
||||
if only:
|
||||
only = only.split()
|
||||
q = 'windows' if iswindows else 'osx' if isosx else 'bsd' if isbsd else 'linux'
|
||||
q = 'windows' if iswindows else 'osx' if isosx else 'bsd' if isbsd else 'haiku' if ishaiku else 'linux'
|
||||
return q in only
|
||||
return True
|
||||
|
||||
@ -100,6 +100,8 @@ def parse_extension(ext):
|
||||
ans = ext.pop('osx_' + k, ans)
|
||||
elif isbsd:
|
||||
ans = ext.pop('bsd_' + k, ans)
|
||||
elif ishaiku:
|
||||
ans = ext.pop('haiku_' + k, ans)
|
||||
else:
|
||||
ans = ext.pop('linux_' + k, ans)
|
||||
return ans
|
||||
@ -156,6 +158,12 @@ def init_env():
|
||||
cflags.append('-I'+sysconfig.get_python_inc())
|
||||
ldflags.append('-lpython'+sysconfig.get_python_version())
|
||||
|
||||
if ishaiku:
|
||||
cflags.append('-lpthread')
|
||||
ldflags.append('-shared')
|
||||
cflags.append('-I'+sysconfig.get_python_inc())
|
||||
ldflags.append('-lpython'+sysconfig.get_python_version())
|
||||
|
||||
if isosx:
|
||||
cflags.append('-D_OSX')
|
||||
ldflags.extend('-bundle -undefined dynamic_lookup'.split())
|
||||
@ -329,7 +337,7 @@ class Build(Command):
|
||||
|
||||
def build_headless(self):
|
||||
from setup.parallel_build import cpu_count
|
||||
if iswindows or isosx:
|
||||
if iswindows or isosx or ishaiku:
|
||||
return # Dont have headless operation on these platforms
|
||||
from setup.build_environment import glib_flags, fontconfig_flags, ft_inc_dirs, QMAKE
|
||||
from PyQt5.QtCore import QT_VERSION
|
||||
|
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
||||
import os, subprocess, re, sys, sysconfig
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setup import isosx, iswindows, is64bit, islinux
|
||||
from setup import isosx, iswindows, is64bit, islinux, ishaiku
|
||||
is64bit
|
||||
|
||||
NMAKE = RC = msvc = MT = win_inc = win_lib = None
|
||||
@ -37,7 +37,7 @@ QMAKE = os.environ.get('QMAKE', QMAKE)
|
||||
|
||||
PKGCONFIG = find_executable('pkg-config')
|
||||
PKGCONFIG = os.environ.get('PKG_CONFIG', PKGCONFIG)
|
||||
if islinux and not PKGCONFIG:
|
||||
if (islinux or ishaiku) and not PKGCONFIG:
|
||||
raise SystemExit('Failed to find pkg-config on your system. You can use the environment variable PKG_CONFIG to point to the pkg-config executable')
|
||||
|
||||
def run_pkgconfig(name, envvar, default, flag, prefix):
|
||||
@ -97,8 +97,8 @@ def get_sip_dir():
|
||||
pyqt['pyqt_sip_dir'] = get_sip_dir()
|
||||
pyqt['sip_inc_dir'] = os.environ.get('SIP_INC_DIR', sysconfig.get_path('include'))
|
||||
|
||||
glib_flags = subprocess.check_output([PKGCONFIG, '--libs', 'glib-2.0']).strip() if islinux else ''
|
||||
fontconfig_flags = subprocess.check_output([PKGCONFIG, '--libs', 'fontconfig']).strip() if islinux else ''
|
||||
glib_flags = subprocess.check_output([PKGCONFIG, '--libs', 'glib-2.0']).strip() if islinux or ishaiku else ''
|
||||
fontconfig_flags = subprocess.check_output([PKGCONFIG, '--libs', 'fontconfig']).strip() if islinux or ishaiku else ''
|
||||
qt_inc = pyqt['inc']
|
||||
qt_lib = pyqt['lib']
|
||||
ft_lib_dirs = []
|
||||
@ -121,7 +121,7 @@ QT_DLLS = ['Qt5' + x for x in (
|
||||
'WebKit', 'WebKitWidgets', 'Widgets', 'Multimedia', 'MultimediaWidgets', 'Xml', # 'XmlPatterns',
|
||||
)]
|
||||
QT_PLUGINS = ('imageformats', 'audio', 'iconengines', 'mediaservice', 'platforms', 'playlistformats', 'printsupport', 'sqldrivers')
|
||||
if islinux:
|
||||
if islinux or ishaiku:
|
||||
# platformthemes cause crashes in Ubuntu
|
||||
QT_PLUGINS += ('platforminputcontexts', 'generic',)
|
||||
|
||||
|
@ -201,13 +201,13 @@
|
||||
},
|
||||
{
|
||||
"name": "libusb",
|
||||
"only": "osx linux",
|
||||
"only": "osx linux haiku",
|
||||
"sources": "calibre/devices/libusb/libusb.c",
|
||||
"libraries": "usb-1.0"
|
||||
},
|
||||
{
|
||||
"name": "libmtp",
|
||||
"only": "osx linux",
|
||||
"only": "osx linux haiku",
|
||||
"sources": "calibre/devices/mtp/unix/devices.c calibre/devices/mtp/unix/libmtp.c",
|
||||
"headers": "calibre/devices/mtp/unix/devices.h calibre/devices/mtp/unix/upstream/music-players.h calibre/devices/mtp/unix/upstream/device-flags.h",
|
||||
"libraries": "mtp"
|
||||
@ -218,6 +218,8 @@
|
||||
"inc_dirs": "unrar",
|
||||
"defines": "SILENT RARDLL UNRAR _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE",
|
||||
"windows_defines": "SILENT RARDLL UNRAR",
|
||||
"haiku_defines": "LITTLE_ENDIAN SILENT RARDLL UNRAR _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE _BSD_SOURCE",
|
||||
"haiku_libraries": "bsd",
|
||||
"optimize_level": 2,
|
||||
"windows_libraries": "User32 Advapi32 kernel32 Shell32"
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import sys, os, textwrap, subprocess, shutil, tempfile, atexit, glob
|
||||
|
||||
from setup import (Command, islinux, isbsd, basenames, modules, functions,
|
||||
from setup import (Command, islinux, isbsd, ishaiku, basenames, modules, functions,
|
||||
__appname__, __version__)
|
||||
|
||||
HEADER = '''\
|
||||
@ -115,7 +115,7 @@ class Develop(Command):
|
||||
self.info('\tSHARE:', self.staging_sharedir)
|
||||
|
||||
def pre_sub_commands(self, opts):
|
||||
if not (islinux or isbsd):
|
||||
if not (islinux or isbsd or ishaiku):
|
||||
self.info('\nSetting up a source based development environment is only '
|
||||
'supported on linux. On other platforms, see the User Manual'
|
||||
' for help with setting up a development environment.')
|
||||
|
@ -22,9 +22,10 @@ isfreebsd = 'freebsd' in _plat
|
||||
isnetbsd = 'netbsd' in _plat
|
||||
isdragonflybsd = 'dragonfly' in _plat
|
||||
isbsd = isfreebsd or isnetbsd or isdragonflybsd
|
||||
islinux = not(iswindows or isosx or isbsd)
|
||||
ishaiku = 'haiku1' in _plat
|
||||
islinux = not(iswindows or isosx or isbsd or ishaiku)
|
||||
isfrozen = hasattr(sys, 'frozen')
|
||||
isunix = isosx or islinux
|
||||
isunix = isosx or islinux or ishaiku
|
||||
isportable = os.environ.get('CALIBRE_PORTABLE_BUILD', None) is not None
|
||||
ispy3 = sys.version_info.major > 2
|
||||
isxp = iswindows and sys.getwindowsversion().major < 6
|
||||
|
@ -1,23 +1,30 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import sys, os, time, socket, traceback, re
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from functools import partial
|
||||
|
||||
import apsw
|
||||
from PyQt5.Qt import (
|
||||
QCoreApplication, QIcon, QObject, QTimer)
|
||||
from PyQt5.Qt import QCoreApplication, QIcon, QObject, QTimer
|
||||
|
||||
from calibre import prints, plugins, force_unicode
|
||||
from calibre.constants import (iswindows, __appname__, isosx, DEBUG, islinux,
|
||||
filesystem_encoding, get_portable_base)
|
||||
from calibre.utils.ipc import gui_socket_address, RC
|
||||
from calibre import force_unicode, plugins, prints
|
||||
from calibre.constants import (
|
||||
DEBUG, __appname__, filesystem_encoding, get_portable_base, islinux, isosx,
|
||||
iswindows
|
||||
)
|
||||
from calibre.gui2 import (
|
||||
initialize_file_icon_provider, Application, choose_dir,
|
||||
error_dialog, question_dialog, gprefs, setup_gui_option_parser)
|
||||
Application, choose_dir, error_dialog, gprefs, initialize_file_icon_provider,
|
||||
question_dialog, setup_gui_option_parser
|
||||
)
|
||||
from calibre.gui2.main_window import option_parser as _option_parser
|
||||
from calibre.gui2.splash_screen import SplashScreen
|
||||
from calibre.utils.config import prefs, dynamic
|
||||
from calibre.utils.config import dynamic, prefs
|
||||
from calibre.utils.ipc import RC, gui_socket_address
|
||||
|
||||
if iswindows:
|
||||
winutil = plugins['winutil'][0]
|
||||
|
@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
|
||||
Secure access to locked files from multiple processes.
|
||||
'''
|
||||
|
||||
from calibre.constants import iswindows, __appname__, islinux, win32api, win32event, winerror, fcntl
|
||||
from calibre.constants import iswindows, __appname__, islinux, ishaiku, win32api, win32event, winerror, fcntl
|
||||
import time, atexit, os, stat, errno
|
||||
|
||||
|
||||
@ -228,6 +228,10 @@ elif islinux:
|
||||
fcntl.fcntl(fd, fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)
|
||||
atexit.register(sock.close)
|
||||
return True
|
||||
elif ishaiku:
|
||||
def singleinstance(name):
|
||||
# Somebody should fix this.
|
||||
return True
|
||||
else:
|
||||
def singleinstance_path(name):
|
||||
home = os.path.expanduser('~')
|
||||
|
Loading…
x
Reference in New Issue
Block a user