Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for macOS build #6

Closed
andrew867 opened this issue Jan 7, 2021 · 1 comment
Closed

Patch for macOS build #6

andrew867 opened this issue Jan 7, 2021 · 1 comment

Comments

@andrew867
Copy link

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
Copy link
Owner

philpem commented Jan 7, 2021

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.

philpem added a commit that referenced this issue Mar 30, 2021
Fixes build on macOS. See #6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants