Skip to content

Commit

Permalink
Improved packaging: now build native executables
Browse files Browse the repository at this point in the history
  • Loading branch information
TiBeN committed Apr 20, 2016
1 parent f1513c5 commit a7ca5d9
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 135 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
CHANGELOG
=========

Current
-------
0.4
---

- Improved packaging: Now build ia-mame as a native exe binary file for
window and self-contained executable script+jar for \*nix
- Added a downloading counter progression
- Removed the use of a configuration file and defined MAME\_EXEC env var
instead
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ Installation
- Make sure your Mame rompath is writable. If not, make it writable or
add another writable one on the 'rompath' directive of the `mame.ini`.

- Download the
[release tarball](https://github.com/TiBeN/ia-mame/releases/latest) and
unzip it somewhere.
- Download the binary matching your OS on the
[release page](https://github.com/TiBeN/ia-mame/releases/latest)

- Tell IaMame where is your Mame executable by making it available on your
$PATH environment variable — its name must match mame[64][.exe] — or by
Expand All @@ -57,6 +56,9 @@ $ cd /path/to/ia-mame
$ mvn package
```

The binary files ia-mame (Linux/OS X) and ia-mame.exe (Windows) and the
executable jar are available on the `target` directory.

Usage
-----

Expand All @@ -69,7 +71,6 @@ and will download them before launching Mame.
Let's try Street Fighter 2 arcade board:

```bash
$ cd /path/to/ia-mame/bin
$ export MAME_EXEC=/path/to/mame64
$ ia-mame sf2

Expand All @@ -82,9 +83,8 @@ Downloading 668kB / ??kB, progress: ??"
Let's try Columns on the Sega Master System:

```batch
C:\> cd \path\to\ia-mame\bin
C:\> SET MAME_EXEC=C:\path\to\your\Mame
C:\> ia-mame.bat sms columns
C:\> ia-mame.exe sms columns
INFO: Download from archive.org missing rom files: [sms] for machine "Master...
Downloading 25kB / ??kB, progress: ??
Expand Down Expand Up @@ -117,4 +117,3 @@ I'm facing issues on some CHD collections (psx, saturn) due to version
differences between the collection and the Mame executable.
It is especially true if the delta of the version is high.
(PSX CHDs will work great using Mame v0.161 but not with 0.170 for example)

4 changes: 0 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ TODO
- Add support for Mame CHD collections
- Do some pretty basic GUI to ease the use on Windows or by users not
confortable with command line
- IaMame Launcher: conditionnaly point iamame.jar to target/ dir
- Support for auto-completion
- Create deb/rpm/msi distributions packages
- Handle the configuration parameters (ie rompath and so one) set from
the command line too.
- Create simple screencast to demonstrate usage
- Reduce the line size of the INFO traces
- Rethink the packaging/distribution following the Alda and Clojure build
tool 'Boot' projects as examples.
- Get asynchronously the length of the download via the zipview
(not given by archive.org via HTTP headers)
30 changes: 0 additions & 30 deletions bin/ia-mame

This file was deleted.

33 changes: 0 additions & 33 deletions bin/ia-mame.bat

This file was deleted.

97 changes: 74 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,104 @@
<finalName>ia-mame</finalName>
</configuration>
</plugin>
<!-- Copy all dependencies on the lib directory when "package" -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.tibennetwork.iamame.IaMame</mainClass>
<systemProperties>
<systemProperty>
<key>iamame.debug</key>
<value>1</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<!-- Create executable überjar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
<goal>shade</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.tibennetwork.iamame.IaMame</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- Create binary release -->
<!-- Create Windows executable -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptor>src/assembly/release.xml</descriptor>
</configuration>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.8</version>
<executions>
<execution>
<id>create-archive</id>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/ia-mame.exe</outfile>
<jar>target/ia-mame.jar</jar>
<errTitle>ia-mame</errTitle>
<classPath>
<mainClass>org.tibennetwork.iamame.IaMame</mainClass>
<addDependencies>false</addDependencies>
<preCp>anything</preCp>
</classPath>
<jre>
<minVersion>1.7.0</minVersion>
</jre>
<versionInfo>
<fileVersion>0.0.0.1</fileVersion>
<txtFileVersion>first</txtFileVersion>
<fileDescription>IaMame executable</fileDescription>
<copyright>github.com/TiBeN</copyright>
<productVersion>0.0.${project.version}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>IaMame</productName>
<internalName>IaMame</internalName>
<originalFilename>ia-mame.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<!-- Delete the library directory when clean project -->
<!-- Create *nix executable -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<groupId>org.skife.maven</groupId>
<artifactId>really-executable-jar-maven-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/lib</directory>
</fileset>
</filesets>
<programFile>ia-mame</programFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>really-executable-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
35 changes: 0 additions & 35 deletions src/assembly/release.xml

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/org/tibennetwork/iamame/IaMame.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static void main (String[] args)
}

// Launch Mame if not in dry-run mode
if (System.getProperty("iamame.dryrun").equals("0")) {
String dryRun = System.getProperty("iamame.dryrun");
if (dryRun == null || !dryRun.equals("1")) {
try {
mame.execute(args);
} catch (IOException | InterruptedException e) {
Expand Down

0 comments on commit a7ca5d9

Please sign in to comment.