annotate Building.html @ 60:d0b83fc1d62a default tip

Remember our input directory on a per-invocation basis.
author David Barts <n5jrn@me.com>
date Sun, 26 Jul 2020 15:14:03 -0700
parents 4997ae108653
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
1 <!DOCTYPE html>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
2 <!-- Skeleton or template web page, in the standard style. -->
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
3 <html>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
4 <head>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
5 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
6 <title>Building JpegWasher</title>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
7 <style>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
8 html { font-family: "TeX Gyre Schola", serif; }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
9 h1, h2, h3, h4, h5, h6 { font-family: "Avenir Next", sans-serif; }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
10 pre, code, kbd, samp { font-family: "Menlo", monospace; ; font-size: 85%; }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
11 </style>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
12 </head>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
13 <body>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
14 <h1>Building JpegWasher</h1>
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
15 <h2>In General</h2>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
16 <p>Building JpegWasher is a bit more involved than building your
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
17 run-of-the-mill Java application, because JpegWasher is not a pure Java
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
18 application. The latter is for the simple reason that there are no pure
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
19 Java libraries that allow one to both read <em>and modify</em> image
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
20 metadata. (This deficiency is one of the reasons I put off writing
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
21 JpegWasher for so long, despite my awareness of the need for such a
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
22 utility.)</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
23 <p>At any rate, this has several implications:</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
24 <ol>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
25 <li>Building JpegWasher takes part in two phases: compiling and linking
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
26 the native-mode code, then compiling the Kotlin code to JVM bytecodes.</li>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
27 <li>The result of a build will not be portable; it will only run on the
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
28 same type of platform as you used to build it.</li>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
29 </ol>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
30 <p>The second point is not <em>strictly</em> true; it is possible, if you
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
31 are careful, to build an executable jar that will run on multiple
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
32 platforms, but the procedure for doing so is not automated and the results
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
33 are not as satisfactory as applications bundled for a specific target. See
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
34 “Building a (Somewhat) Universal Jar” below.<em></em></p>
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
35 <h2>Prerequisites</h2>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
36 <ul>
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
37 <li><a href="https://ant.apache.org/">Apache Ant</a></li>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
38 <li><a href="http://launch4j.sourceforge.net/">Launch4j</a>, if you are
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
39 building on Windows</li>
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
40 <li>Java JDK 1.8 or better (see notes).</li>
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
41 <li><a href="https://kotlinlang.org/">Kotlin</a></li>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
42 <li><a href="https://www.exiv2.org/">Exiv2</a></li>
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
43 <li>A C++ Compiler</li>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
44 <li>Make (Nmake on Windows)</li>
59
4997ae108653 Add where Osdep is.
David Barts <n5jrn@me.com>
parents: 50
diff changeset
45 <li>Osdep (found in a <a href="http://koosah.info/cgi-bin/hgweb.cgi/Osdep/">neighboring
4997ae108653 Add where Osdep is.
David Barts <n5jrn@me.com>
parents: 50
diff changeset
46 repository</a> to this one).</li>
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
47 </ul>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
48 <h2>Which Version of Java to Use?</h2>
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
49 <p>In short, Java 1.8. Most systems don’t yet have OpenJDK 11 or greater
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
50 installed, so using a compiler newer than 1.8 is asking for trouble. All
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
51 code <em>should</em> build on OpenJDK 11 or greater, with the exception
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
52 of the OS-dependent code for the Macintosh (which will have to be recoded
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
53 to use the <code>java.awt.Desktop</code> class). The latter would be a
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
54 net win, as it is portable, and would spell the death of the only bit of
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
55 OS-dependent Kotlin code in this application.</p>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
56 <p>In another year or two, I will probably make OpenJDK 11 or greater the
50
fb407182ba76 Add help menu item, UNTESTED.
David Barts <davidb@stashtea.com>
parents: 46
diff changeset
57 preferred version.</p>
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
58 <h2>Build Procedure</h2>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
59 <h3>Install Prerequisites</h3>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
60 <p>See the “Prerequisites” section above for the details of what you will
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
61 need.</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
62 <p>If you are building on Windows and are tempted to use a binary
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
63 distribution of Exiv2, the MSVC version is preferred, as it will result in
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
64 a fully native Windows application which does not require Cygwin or MinGW
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
65 to be present. For the same reason, Visual Studio (the free-to-download
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
66 “community” version suffices) is the preferred compiler to compile <code>src/name/blackcap/exifwasher/exiv2/native.cpp</code>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
67 with.</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
68 <h3>Define Environment Variables</h3>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
69 <p>The <code>build.xml</code> Ant script expects several environment
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
70 variable to be set, and for your PATH to allow the command-line utilities
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
71 for the prerequisites to be found. Look in <code>setup.sh</code> and/or <code>setup.cmd</code>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
72 for examples.</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
73 <h3>Compile C++ Source</h3>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
74 <p>This is done by running <code>make</code> (on Windows, <code>nmake</code>)
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
75 on the appropriate Makefile (<code>Makefile.linux</code>, <code>Makefile.mac</code>,
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
76 or <code>Makefile.win</code>). On Windows, make sure you are in the
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
77 correct sort of command prompt window for the compiler you wish to run
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
78 (these are found in the menu under Visual Studio; the standard command
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
79 prompt will not work, because it won’t have the Visual Studio command-line
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
80 tools in its PATH).</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
81 <h3>Compile Kotlin Source and Bundle an App</h3>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
82 <p>Just type <code>ant macapp</code>, <code>ant winapp</code>, or <code>ant
50
fb407182ba76 Add help menu item, UNTESTED.
David Barts <davidb@stashtea.com>
parents: 46
diff changeset
83 deb</code> depending on whether you are building on a Mac, Windows, or
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
84 Debian Linux (note that Ubuntu is a Debian variant).</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
85 <h3>That’s It!</h3>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
86 <p>If all went well, a system-specific bundle should be found in the <code>dist</code>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
87 directory.</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
88 <h2>Building a (Somewhat) Universal Jar</h2>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
89 <p>It is possible to build an executable jar that will run on both Windows
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
90 and Linux systems, but the process for doing so is not automated. What you
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
91 will have to do is build non-portable Jar files for both Windows and Linux
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
92 by running ant jar on both types of system, then to combine files in both
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
93 jars to create a jar whose <code>name/blackcap/exifwasher/binaries </code>contents
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
94 are their superset and thus contains native-mode code for both systems.</p>
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
95 <p>The drawback here is that the result is nowhere near as nice as the
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
96 bundled applications the standard Ant tasks build. It won’t show up as a
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
97 normal, native-mode application with a nice icon. It is also not possible
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
98 to add the Macintosh to that list of systems, as for sake of human
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
99 interface consistency, the Mac code must contain calls to proprietary
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 39
diff changeset
100 classes which are not present on non-Mac systems.</p>
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
101 </body>
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
102 </html>