philpem / printer-driver-ptouch

P-Touch PT-series and QL-series printer driver for Linux (under CUPS)
GNU General Public License v2.0
97 stars 25 forks source link

Patch for macOS build #6

Closed andrew867 closed 3 years ago

andrew867 commented 3 years ago

I haven't done this before but here is a patch to allow the software to compile on macOS using homebrew GCC and autoconf/automake.

diff -Naru ../printer-driver-ptouch-master/foomaticalize b/foomaticalize
--- a/foomaticalize 2020-09-08 10:12:16.000000000 -0230
+++ b/foomaticalize 2021-01-06 21:07:24.000000000 -0330
@@ -36,7 +36,6 @@
 use XML::LibXML;
 use File::Basename;
 use File::Path qw(make_path);
-use POSIX qw(round);

 sub find_or_create_node($$) {
     my ($obj, $type) = @_;
@@ -209,7 +208,7 @@
            if ($driverval->textContent =~
            /^\s*(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)\s*$/) {
            $driverval->removeChildNodes();
-           $driverval->appendText(round($1) . ' ' . round($2));
+           $driverval->appendText(sprintf("%.0f", $1) . ' ' . sprintf("%.0f", $2));
            }
        }
        }
diff -Naru a/ptexplain.c b/ptexplain.c
--- a/ptexplain.c   2020-09-08 10:12:16.000000000 -0230
+++ b/ptexplain.c   2021-01-06 21:01:52.000000000 -0330
@@ -14,6 +14,10 @@
 #include <assert.h>
 #include <getopt.h>

+#if __APPLE__
+  #include <libgen.h>
+#endif
+
 #if HAVE_LIBPNG
 # include <png.h>
 #endif
diff -Naru a/rastertoptch.c b/rastertoptch.c
--- a/rastertoptch.c    2020-09-08 10:12:16.000000000 -0230
+++ b/rastertoptch.c    2021-01-06 21:02:07.000000000 -0330
@@ -274,6 +274,10 @@
 #include <stdbool.h>
 #include <getopt.h>

+#if __APPLE__
+  #include <libgen.h>
+#endif
+
 static const char* progname;

 /** Length of a PostScript point in mm */
philpem commented 3 years ago

Can you please submit this as a pull request? (Or at least attach it as a patch so I don't have to copy-paste and fix all the character substitutions)

To do that -- create a fork (this creates a copy of this repository but owned by you) - make your changes on your fork - then open your forked repo on the Github website and click "open pull request".

This enables a bunch of review features which make merging a lot simpler :)

OSX build/install instructions would also be appreciated, if you have them.