Project

General

Profile

Actions

Feature request #330

open

Feature request #426: Packaging (Parent task)

Create package as an APP(Bundle) in DMG or as a PKG installer for MacOSX

Added by François Cerbelle 12 months ago. Updated 5 months ago.

Status:
Nouveau
Priority:
Normal
Target version:
Start date:
07/29/2024
Due date:
09/15/2024 (about 3 months late)
% Done:

0%

Estimated time:
5:00 h
Actions #1

Updated by François Cerbelle 12 months ago

  • Assignee set to François Cerbelle
Actions #3

Updated by François Cerbelle 12 months ago

  • Subject changed from Create DMG or PKG file for MacOSX to Create package as an APP(Bundle) in DMG or as a PKG installer for MacOSX
  • Estimated time changed from 3:00 h to 10:00 h
Actions #4

Updated by François Cerbelle 11 months ago

  • Estimated time changed from 10:00 h to 5:00 h
Actions #5

Updated by François Cerbelle 11 months ago

  • Target version changed from 0.0.1 to Later
Actions #6

Updated by François Cerbelle 6 months ago

  • Target version changed from Later to 0.0.1
Actions #7

Updated by François Cerbelle 6 months ago

  • Target version changed from 0.0.1 to 0.0.2
Actions #8

Updated by François Cerbelle 5 months ago

  • Due date set to 09/15/2024
  • Start date changed from 12/24/2023 to 07/29/2024
Actions #9

Updated by François Cerbelle 5 months ago

  • Parent task set to #426
Actions #10

Updated by François Cerbelle 5 months ago

From the following prompt :
Dans un projet utilisant les autotools, autoconf, automake, autogen, autopoint, gettext et libtool pour cross-compiler un programme principal chargeant des bibliothèques partagées avec osxcross sous linux, quelles ligne ajouter dans les fichiers configure.ac et Makefile.am pour generer un bundle MacOS.

ChatGPT recommended to add the following lines to configure.ac :

# Charger les macros nécessaires
AC_PREREQ([2.69])
AC_INIT([MonProjet], [1.0], [monprojet@example.com])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Configurer les outils de cross-compilation pour macOS
AC_CANONICAL_TARGET
case $target in
  *-apple-darwin*)
    AC_MSG_NOTICE([Configuring for macOS cross-compilation])
    CC=o64-clang
    CXX=o64-clang++
    LD=o64-clang
    ;;
  *)
    AC_MSG_ERROR([Unsupported target: $target])
    ;;
esac

# Activer libtool
LT_INIT

# Vérifier les bibliothèques nécessaires
AC_CHECK_LIB([mylib], [myfunc])

# Configurer gettext
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.21])

# Détection des autres dépendances, outils, etc.
# ...

# Générer le fichier de configuration
AC_OUTPUT([
Makefile
src/Makefile
])

and the following lines to Makefile.am :

# Nom du programme et fichiers sources
bin_PROGRAMS = monprogramme
monprogramme_SOURCES = main.c mylib.c

# Utiliser libtool pour créer des bibliothèques partagées
lib_LTLIBRARIES = libmylib.la
libmylib_la_SOURCES = mylib.c
libmylib_la_LDFLAGS = -avoid-version -module

# Configurer les règles pour créer le bundle macOS
bundle: $(bin_PROGRAMS)
    mkdir -p MonProgramme.app/Contents/MacOS
    mkdir -p MonProgramme.app/Contents/Resources
    cp $(bin_PROGRAMS) MonProgramme.app/Contents/MacOS/
    # Copier les autres fichiers nécessaires, par exemple des ressources
    # cp path/to/resource MonProgramme.app/Contents/Resources/
    # Créer un fichier Info.plist pour le bundle
    echo '<?xml version="1.0" encoding="UTF-8"?>' > MonProgramme.app/Contents/Info.plist
    echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> MonProgramme.app/Contents/Info.plist
    echo '<plist version="1.0">' >> MonProgramme.app/Contents/Info.plist
    echo '<dict>' >> MonProgramme.app/Contents/Info.plist
    echo '  <key>CFBundleExecutable</key>' >> MonProgramme.app/Contents/Info.plist
    echo '  <string>monprogramme</string>' >> MonProgramme.app/Contents/Info.plist
    echo '</dict>' >> MonProgramme.app/Contents/Info.plist
    echo '</plist>' >> MonProgramme.app/Contents/Info.plist

# Indiquer que la cible `bundle` dépend de l'exécutable
.PHONY: bundle

# Installer le bundle
install-exec-hook:
    $(mkinstalldirs) $(DESTDIR)$(prefix)/Applications
    cp -r MonProgramme.app $(DESTDIR)$(prefix)/Applications/

# Nettoyage des fichiers de bundle
clean-local:
    rm -rf MonProgramme.app

Actions

Also available in: Atom PDF