Skip to content

Commit 5583ca0

Browse files
authored
Merge pull request #165 from hugoholgersson/mac_os_port
Port of Diffuse to macOS
2 parents 993d825 + d94df84 commit 5583ca0

File tree

15 files changed

+282
-98
lines changed

15 files changed

+282
-98
lines changed

.markdownlint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"default": true,
3+
"no-duplicate-heading": false,
4+
"no-inline-html": false,
5+
"no-emphasis-as-heading": false
6+
}

data/icons/diffuse.icns

138 KB
Binary file not shown.

data/icons/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ install_data(
1111
join_paths(symbolic_dir, ('@[email protected]').format(application_id)),
1212
install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir)
1313
)
14+
15+
if build_machine.system() == 'darwin'
16+
install_data('diffuse.icns', install_dir: '/Applications/Diffuse.app/Contents/Resources')
17+
endif

data/meson.build

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
22

3-
desktop_file = i18n.merge_file(
4-
input: 'io.github.mightycreak.Diffuse.desktop.in',
5-
output: 'io.github.mightycreak.Diffuse.desktop',
6-
type: 'desktop',
7-
po_dir: '../po',
8-
install: true,
9-
install_dir: join_paths(get_option('datadir'), 'applications')
10-
)
11-
12-
desktop_utils = find_program('desktop-file-validate', required: false)
13-
if desktop_utils.found()
14-
test('Validate desktop file', desktop_utils,
15-
args: [desktop_file]
3+
if build_machine.system() == 'linux'
4+
desktop_file = i18n.merge_file(
5+
input: 'io.github.mightycreak.Diffuse.desktop.in',
6+
output: 'io.github.mightycreak.Diffuse.desktop',
7+
type: 'desktop',
8+
po_dir: '../po',
9+
install: true,
10+
install_dir: join_paths(get_option('datadir'), 'applications')
1611
)
17-
endif
1812

19-
appstream_file = i18n.merge_file(
20-
input: 'io.github.mightycreak.Diffuse.appdata.xml.in',
21-
output: 'io.github.mightycreak.Diffuse.appdata.xml',
22-
po_dir: '../po',
23-
install: true,
24-
install_dir: join_paths(get_option('datadir'), 'appdata')
25-
)
26-
27-
appstream_util = find_program('appstream-util', required: false)
28-
if appstream_util.found()
29-
test('Validate appstream file', appstream_util,
30-
args: ['validate', appstream_file]
13+
desktop_utils = find_program('desktop-file-validate', required: false)
14+
if desktop_utils.found()
15+
test('Validate desktop file', desktop_utils,
16+
args: [desktop_file]
17+
)
18+
endif
19+
20+
appstream_file = i18n.merge_file(
21+
input: 'io.github.mightycreak.Diffuse.appdata.xml.in',
22+
output: 'io.github.mightycreak.Diffuse.appdata.xml',
23+
po_dir: '../po',
24+
install: true,
25+
install_dir: join_paths(get_option('datadir'), 'appdata')
3126
)
27+
28+
appstream_util = find_program('appstream-util', required: false)
29+
if appstream_util.found()
30+
test('Validate appstream file', appstream_util,
31+
args: ['validate', appstream_file]
32+
)
33+
endif
3234
endif
3335

3436
# Diffuse config file

docs/developers/developers-setup.md

Lines changed: 86 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ Diffuse depends on these projects:
88
* PyPi
99
* Cairo and GObject Introspection development headers
1010
* Meson
11-
* Flatpak and Flatpak builder
11+
* Flatpak and Flatpak builder (Linux only)
1212

13-
### Install the distribution dependencies
13+
## Install the dependencies
1414

15-
It's a bit difficult to get the command lines for all the distributions and
16-
their releases, but it should be enough to find the packages on other
17-
distributions.
15+
### Install the system dependencies
16+
17+
It's a bit difficult to get the command lines for all the systems, but these
18+
examples should be enough to find the packages on most systems.
1819

1920
<details>
2021
<summary>Debian/Ubuntu</summary>
@@ -32,7 +33,19 @@ _Note: Tested on Debian 11 (Buster) and Ubuntu 20.04 (Focal)_
3233
sudo dnf install python-pip cairo-devel cairo-gobject-devel meson flatpak flatpak-builder
3334
```
3435

35-
_Note: Tested on Fedora 34_
36+
_Note: Tested on Fedora 36_
37+
</details>
38+
39+
<details>
40+
<summary>Mac OS</summary>
41+
42+
On Mac, all dependencies can be installed using [Homebrew](https://docs.brew.sh/):
43+
44+
```sh
45+
brew install meson python3 py3cairo pygobject3 gtk+3 librsvg
46+
```
47+
48+
_Note: Tested on macOS 12.5 (Monterey)_
3649
</details>
3750

3851
### Install the project dependencies
@@ -49,34 +62,42 @@ For developer tools, run this one instead (it includes requirements.txt):
4962
pip install -r requirements.dev.txt
5063
```
5164

52-
## Setup on Linux
65+
## Setup
66+
67+
### Setup on Linux using Flatpak
5368

54-
### Build, test and install using Flatpak
69+
#### Build, test and install
5570

56-
To install Diffuse locally:
71+
To build, test and install Diffuse locally:
5772

5873
```sh
5974
flatpak install runtime/org.gnome.Sdk/$(uname -p)/42
6075
flatpak-builder --user --install build-flatpak io.github.mightycreak.Diffuse.yml
6176
```
6277

78+
#### Run
79+
6380
To run Diffuse through Flatpak:
6481

6582
```sh
6683
flatpak run io.github.mightycreak.Diffuse
6784
```
6885

86+
#### Uninstall
87+
6988
To uninstall Diffuse:
7089

7190
```sh
7291
flatpak remove io.github.mightycreak.Diffuse
7392
```
7493

75-
### Build, test and install using Meson
94+
### Setup on Linux using Meson
95+
96+
#### Build and test
7697

77-
Diffuse build system is meson.
98+
Diffuse is using Meson as its build system.
7899

79-
To compile and test Diffuse:
100+
To build and test Diffuse:
80101

81102
```sh
82103
meson setup build
@@ -85,36 +106,81 @@ meson compile
85106
meson test
86107
```
87108

109+
#### Install on system and run
110+
88111
To install Diffuse on your system (e.g. `/usr/local/`):
89112

90113
```sh
91114
meson install # requires admin privileges
115+
```
116+
117+
To run Diffuse:
92118

93-
# Run Diffuse
119+
```sh
94120
diffuse
95121
```
96122

97-
To install Diffuse on a custom directory (e.g. `~/bin/diffuse`):
123+
#### Install in a custom directory and run
124+
125+
Meson allows to change the default installation directories, see
126+
[command-line documentation](https://mesonbuild.com/Commands.html#configure).
127+
128+
To install Diffuse in a custom directory (e.g. `~/bin/diffuse`):
98129

99130
```sh
100131
meson install --destdir ~/bin/diffuse
132+
```
101133

102-
# Run Diffuse
134+
To run Diffuse:
135+
136+
```sh
137+
export PYTHONPATH=$HOME/bin/diffuse/usr/local/share/diffuse
103138
cd ~/bin/diffuse/usr/local/bin
104-
PYTHONPATH=$HOME/bin/diffuse/usr/local/share/diffuse ./diffuse
139+
./diffuse
105140
```
106141

107-
To uninstall diffuse afterwards:
142+
#### Uninstall
143+
144+
To uninstall Diffuse afterwards:
108145

109146
```sh
110147
sudo ninja uninstall -C build
111148
sudo rm -v /usr/local/share/locale/*/LC_MESSAGES/diffuse.mo
112149
```
113150

114-
Meson allows to change the default installation directories, see
115-
[command-line documentation](https://mesonbuild.com/Commands.html#configure).
151+
### Setup on Mac OS
152+
153+
#### Build and test
154+
155+
Diffuse is using Meson as its build system.
156+
157+
To build and test Diffuse:
158+
159+
```sh
160+
meson setup build
161+
cd build
162+
meson compile
163+
meson test
164+
```
165+
166+
#### Install on system and run
167+
168+
To install Diffuse on your system (e.g. `/usr/local/`):
169+
170+
```sh
171+
meson install # requires admin privileges
172+
```
173+
174+
To run Diffuse:
175+
176+
```sh
177+
diffuse
178+
```
179+
180+
_Note: The `diffuse` command can be used to launch Diffuse as a native Mac app_
181+
_that is installed into `/Applications/Diffuse.app`._
116182

117-
## Setup on Windows
183+
### Setup on Windows (deprecated)
118184

119185
_Note:_ The Windows port is not maintained and would need some love.
120186
Contributions are very welcome! 😉

docs/developers/release-process.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ few manual steps.
1919
- data/usr/share/gnome/help/diffuse/*/diffuse.xml
2020
- data/usr/share/omf/diffuse/diffuse-*.omf
2121
- utils/book2manual.xsl
22-
3. Update CHANGELOG.md
22+
4. Update CHANGELOG.md
2323
- Add new line under `## Unreleased` following this syntax: `## x.y.z - YYYY-MM-DD`
2424
- Copy the content of the changes for this release
25-
4. Update AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in:
25+
5. Update AppData release notes in data/io.github.mightycreak.Diffuse.appdata.xml.in:
2626
- Create a new `<release>` tag under `<releases>`, fill the `version` and
2727
`date` attributes
2828
- Create a new `<description>` tag under the new `<release>` tag
2929
- Add one paragraph to sum the release in one sentence (e.g. highlights, ...)
3030
- Paste the changes from the changelog and adapt it to HTML
31-
5. Create new branch and PR
31+
6. Create new branch and PR
3232

3333
## Create new release on GitHub
3434

docs/translators.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Use `update-translations.py` to validate one or more PO files.
7070
Here is an example with `ja.po` and `ko.po`:
7171

7272
Command-line:
73+
7374
```sh
7475
./update-translations.py --check-only ja.po ko.po
7576
```
@@ -99,8 +100,10 @@ POSIX platforms. The conversion tools insert some English text that gets
99100
localized using search and replace. Manually add new search and replace rules
100101
to these files:
101102

102-
../windows-installer/translations.txt
103-
../utils/translations.txt
103+
```text
104+
../windows-installer/translations.txt
105+
../utils/translations.txt
106+
```
104107

105108
The format of each line is: \<language id\>:\<English text\>:\<localised text\>
106109

docs/users.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ The Diffuse package statuses for every distributions can been seen on
2222

2323
Huge thanks to [@bongochong](https://github.com/bongochong) for maintaining the
2424
Diffuse package on Fedora.
25+
26+
## Integrate with Git
27+
28+
Diffuse is compatible with `git difftool` command-line. To use Diffuse as Git
29+
diff tool, run:
30+
31+
```sh
32+
git config --global diff.tool diffuse
33+
```

meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ subdir('data')
1010
subdir('src')
1111
subdir('po')
1212

13-
meson.add_install_script('build-aux/meson/postinstall.py')
13+
if build_machine.system() == 'linux'
14+
meson.add_install_script('build-aux/meson/postinstall.py')
15+
endif
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>mac_launcher.sh</string>
9+
<key>CFBundleIconFile</key>
10+
<string>diffuse.icns</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>io.github.mightycreak.Diffuse</string>
13+
<key>CFBundleName</key>
14+
<string>Diffuse</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>@VERSION@</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>NSAppleScriptEnabled</key>
20+
<string>NO</string>
21+
</dict>
22+
</plist>

0 commit comments

Comments
 (0)