# - Lots of Linux distros don't have a new enough boost (1.64 or above)
# - On Centos 6 we can't build lwext4 because it needs a new CMake which Centos 6's g++ is not new enough to build.
# - On Centos 7 there is a build error in lwext4 related to __unused
- return target.platform == 'windows' or (target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['18.04', '18.10', '19.04'])
+ return target.platform == 'windows' or target.platform == 'osx' or (target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['18.04', '18.10', '19.04'])
def packages(name, packages, f):
s = '%s: ' % name
# I worry that this will cause ABI problems but I don't have
# a better solution.
opt += ' --force-cpp11'
+ elif target.platform == 'osx' and target.bits == 64:
+ opt += ' --force-cpp11'
if not options['gui']:
opt += ' --disable-gui'
#include <sys/sysctl.h>
#include <mach-o/dyld.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
+#include <DiskArbitration/DADisk.h>
+#include <DiskArbitration/DiskArbitration.h>
#endif
#ifdef DCPOMATIC_POSIX
#include <sys/types.h>
const char* name = DADiskGetBSDName (disk);
if (name) {
list<Drive>* drives = reinterpret_cast<list<Drive>*> (context);
- drives->push_back (name, 0, false, optional<string>(), optional<string>());
+ drives->push_back (Drive(name, 0, false, optional<string>(), optional<string>()));
}
}
#endif
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.05, 0);
DAUnregisterCallback(session, (void *) disk_appeared, &drives);
CFRelease(session);
-}
#endif
#ifdef DCPOMATIC_LINUX
#include <lwext4/ext4_debug.h>
#include <lwext4/ext4.h>
}
-#ifndef WIN32
+
+#ifdef DCPOMATIC_POSIX
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <linux/fs.h>
+#ifdef DCPOMATIC_OSX
+#undef nil
#endif
-#include <polkit/polkit.h>
#include <glibmm.h>
+#endif
+
+#ifdef DCPOMATIC_LINUX
+#include <linux/fs.h>
+#include <polkit/polkit.h>
+#endif
+
#include <unistd.h>
#include <sys/types.h>
#include <poll.h>
using std::min;
using std::string;
+#ifdef DCPOMATIC_LINUX
static PolkitAuthority* polkit_authority = 0;
+#endif
static boost::filesystem::path dcp_path;
static std::string device;
static uint64_t const block_size = 4096;
static
void
write ()
+try
{
// ext4_dmask_set (DEBUG_ALL);
throw CopyError ("Failed to write MBR", r);
}
-#ifdef WIN32
+#ifdef DCPOMATIC_WINDOWS
struct ext4_mbr_bdevs bdevs;
r = ext4_mbr_scan (bd, &bdevs);
if (r != EOK) {
}
file_windows_partition_set (bdevs.partitions[0].part_offset, bdevs.partitions[0].part_size);
-#else
+#endif
+
+#ifdef DCPOMATIC_LINUX
/* Re-read the partition table */
int fd = open(device.c_str(), O_RDONLY);
ioctl(fd, BLKRRPART, NULL);
close(fd);
+#endif
+#ifdef DCPOMATIC_POSIX
string partition = device;
/* XXX: don't know if this logic is sensible */
if (partition.size() > 0 && isdigit(partition[partition.length() - 1])) {
cout << DIST_WRITER_OK "\n";
cout.flush ();
+} catch (CopyError& e) {
+ cout << DIST_WRITER_ERROR "\n" << e.message() << "\n" << e.number() << "\n";
+ cout.flush ();
+} catch (VerifyError& e) {
+ cout << DIST_WRITER_ERROR "\n" << e.message() << "\n" << e.number() << "\n";
+ cout.flush ();
}
+#ifdef DCPOMATIC_LINUX
static
void
polkit_callback (GObject *, GAsyncResult* res, gpointer)
{
PolkitAuthorizationResult* result = polkit_authority_check_authorization_finish (polkit_authority, res, 0);
if (result && polkit_authorization_result_get_is_authorized(result)) {
- try {
- write ();
- } catch (CopyError& e) {
- cout << DIST_WRITER_ERROR "\n" << e.message() << "\n" << e.number() << "\n";
- cout.flush ();
- } catch (VerifyError& e) {
- cout << DIST_WRITER_ERROR "\n" << e.message() << "\n" << e.number() << "\n";
- cout.flush ();
- }
+ write ();
}
if (result) {
g_object_unref (result);
}
}
+#endif
bool
idle ()
getline (cin, s);
device = "/dev/" + s;
+#ifdef DCPOMATIC_LINUX
polkit_authority = polkit_authority_get_sync (0, 0);
PolkitSubject* subject = polkit_unix_process_new (getppid());
polkit_authority_check_authorization (
polkit_authority, subject, "com.dcpomatic.write-drive", 0, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, 0, polkit_callback, 0
);
+#else
+ write ();
+#endif
}
return true;
}