Skip to content

Commit

Permalink
Merge pull request #14 from iraf-community/x11iraf-apps
Browse files Browse the repository at this point in the history
Create proper apps for x11iraf
  • Loading branch information
olebole authored Mar 24, 2024
2 parents 7a07c95 + 0190e00 commit ee052ec
Show file tree
Hide file tree
Showing 41 changed files with 240 additions and 29 deletions.
79 changes: 57 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ PATH += :$(BINDIR)

all: iraf-$(RELEASE)-$(MACARCH).pkg

PKGS = core.pkg x11iraf.pkg ctio.pkg fitsutil.pkg mscred.pkg \
PKGS = core.pkg ximtool.pkg xgterm.pkg ctio.pkg fitsutil.pkg mscred.pkg \
rvsao.pkg sptable.pkg st4gem.pkg xdimsum.pkg


core.pkg:
mkdir -p $(BUILDDIR)/iraf
curl -L https://github.com/iraf-community/iraf/archive/refs/tags/v2.17.1.tar.gz | \
tar xzf - -C $(BUILDDIR)/iraf --strip-components=1
patch -d $(BUILDDIR)/iraf -p1 < patches/core/0001-fix-DESTDIR-in-Makefile.patch
patch -d $(BUILDDIR)/iraf -p1 < patches/core/0002-Create-bindir-and-includedir-on-libvotable-install.patch
patch -d $(BUILDDIR)/iraf -p1 < core/patches/0001-fix-DESTDIR-in-Makefile.patch
patch -d $(BUILDDIR)/iraf -p1 < core/patches/0002-Create-bindir-and-includedir-on-libvotable-install.patch
$(MAKE) -C $(BUILDDIR)/iraf
mkdir -p $(INSTDIR)/iraf
$(MAKE) -C $(BUILDDIR)/iraf DESTDIR=$(INSTDIR)/iraf install
Expand All @@ -61,27 +61,62 @@ core.pkg:
--version 2.17.1 \
$@

x11iraf.pkg: core.pkg
ximtool.pkg: core.pkg
mkdir -p $(BUILDDIR)/x11iraf
curl -L https://github.com/iraf-community/x11iraf/archive/refs/tags/v2.1.tar.gz | \
tar xzf - -C $(BUILDDIR)/x11iraf --strip-components=1
patch -d $(BUILDDIR)/x11iraf -p1 < patches/x11iraf/0001-Force-setting-of-local-terminfo-database.patch
patch -d $(BUILDDIR)/x11iraf -p1 < \
xgterm/patches/0001-Force-setting-of-local-terminfo-database.patch
$(MAKE) -C $(BUILDDIR)/x11iraf
mkdir -p $(INSTDIR)/x11/usr/local/bin $(INSTDIR)/x11/usr/local/share/man/man1 $(INSTDIR)/x11/usr/local/share/terminfo
install -m755 $(BUILDDIR)/x11iraf/xgterm/xgterm $(INSTDIR)/x11/usr/local/bin
install -m755 $(BUILDDIR)/x11iraf/xgterm/xgterm.man $(INSTDIR)/x11/usr/local/share/man/man1/xgterm.1
install -m755 $(BUILDDIR)/x11iraf/ximtool/ximtool $(INSTDIR)/x11/usr/local/bin
install -m755 $(BUILDDIR)/x11iraf/ximtool/ximtool.man $(INSTDIR)/x11/usr/local/share/man/man1/ximtool.1
install -m755 $(BUILDDIR)/x11iraf/ximtool/clients/ism_wcspix.e $(INSTDIR)/x11/usr/local/bin
TERMINFO=$(INSTDIR)/x11/usr/local/share/terminfo tic $(BUILDDIR)/x11iraf/xgterm/xgterm.terminfo
find $(INSTDIR)/x11 -name \*.[eao] -type f \
-exec codesign -s - -i community.iraf.x11iraf {} \;
pkgbuild --identifier community.iraf.x11iraf \
--root $(INSTDIR)/x11 \
--install-location / \

mkdir -p $(INSTDIR)/ximtool/XImtool.app/Contents/MacOS
mkdir -p $(INSTDIR)/ximtool/XImtool.app/Contents/Resources/bin
mkdir -p $(INSTDIR)/ximtool/XImtool.app/Contents/Resources/man
install -m755 ximtool/XImtool $(INSTDIR)/ximtool/XImtool.app/Contents/MacOS
install -m755 $(BUILDDIR)/x11iraf/ximtool/ximtool \
$(INSTDIR)/ximtool/XImtool.app/Contents/Resources/bin
install -m755 $(BUILDDIR)/x11iraf/ximtool/clients/ism_wcspix.e \
$(INSTDIR)/ximtool/XImtool.app/Contents/Resources/bin
install ximtool/Info.plist $(INSTDIR)/ximtool/XImtool.app/Contents/Info.plist
iconutil --convert icns \
--output $(INSTDIR)/ximtool/XImtool.app/Contents/Resources/XImtool.icns \
ximtool/XImtool.iconset/
install $(BUILDDIR)/x11iraf/ximtool/ximtool.man \
$(INSTDIR)/ximtool/XImtool.app/Contents/Resources/man/ximtool.1
codesign -s - -i community.iraf.ximtool $(INSTDIR)/ximtool/XImtool.app
pkgbuild --identifier community.iraf.ximtool \
--root $(INSTDIR)/ximtool \
--install-location /Applications \
--scripts ximtool/scripts \
$(PKGBUILD_ARG) \
--version 2.1+ \
$@
--version 2.1 \
ximtool.pkg

xgterm.pkg: ximtool.pkg # This re-uses the same build as ximtool
mkdir -p $(INSTDIR)/xgterm/XGTerm.app/Contents/MacOS
mkdir -p $(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/bin
mkdir -p $(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/man
mkdir -p $(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/terminfo
install -m755 $(BUILDDIR)/x11iraf/xgterm/xgterm \
$(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/bin
install -m755 xgterm/XGTerm $(INSTDIR)/xgterm/XGTerm.app/Contents/MacOS
install xgterm/Info.plist $(INSTDIR)/xgterm/XGTerm.app/Contents/Info.plist
iconutil --convert icns \
--output $(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/XGTerm.icns \
xgterm/XGTerm.iconset/
install $(BUILDDIR)/x11iraf/xgterm/xgterm.man \
$(INSTDIR)/xgterm/XGTerm.app/Contents/Resources/man/xgterm.1
TERMINFO=$(INSTDIR)/xgterm/XGTerm.app/Resources/terminfo tic \
$(BUILDDIR)/x11iraf/xgterm/xgterm.terminfo
codesign -s - -i community.iraf.xgterm $(INSTDIR)/xgterm/XGTerm.app
pkgbuild --identifier community.iraf.xgterm \
--root $(INSTDIR)/xgterm \
--install-location /Applications \
--scripts xgterm/scripts \
$(PKGBUILD_ARG) \
--version 2.1 \
xgterm.pkg


ctio.pkg: core.pkg
mkdir -p $(BUILDDIR)/ctio
Expand Down Expand Up @@ -142,7 +177,7 @@ rvsao.pkg: core.pkg
mkdir -p $(BUILDDIR)/rvsao
curl -L http://tdc-www.harvard.edu/iraf/rvsao/rvsao-2.8.5.tar.gz | \
tar xzf - -C $(BUILDDIR)/rvsao --strip-components=1
patch -d $(BUILDDIR)/rvsao -p1 < patches/rvsao/0001-Add-NOAO-into-build-search-path.patch
patch -d $(BUILDDIR)/rvsao -p1 < rvsao/patches/0001-Add-NOAO-into-build-search-path.patch
( cd $(BUILDDIR)/rvsao && \
rm -rf bin* && \
mkdir -p bin.$(IRAFARCH) && \
Expand Down Expand Up @@ -217,8 +252,8 @@ xdimsum.pkg: core.pkg
distribution-$(MACARCH).plist: distribution.plist
sed "s/@@MACARCH@@/$(MACARCH)/g;s/@@RELEASE@@/$(RELEASE)/g;s/@@MINVERSION@@/$(MINVERSION)/g" $< > $@

iraf-$(RELEASE)-$(MACARCH).pkg: $(PKGS) distribution-$(MACARCH).plist conclusion.html welcome.html logo.png
productbuild --distribution distribution-$(MACARCH).plist --resources . $@
iraf-$(RELEASE)-$(MACARCH).pkg: $(PKGS) distribution-$(MACARCH).plist
productbuild --distribution distribution-$(MACARCH).plist --resources resources $@

clean:
rm -rf $(PKGS) iraf-$(RELEASE)-$(MACARCH).pkg distribution-$(MACARCH).plist bin $(INSTDIR) $(BUILDDIR)
3 changes: 2 additions & 1 deletion distribution.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
</choice>
<choice id="community.iraf.x11iraf" title="X11IRAF"
description="X11 terminal emulator (xgterm) and interactive image display (ximtool)">
<pkg-ref id="community.iraf.x11iraf">x11iraf.pkg</pkg-ref>
<pkg-ref id="community.iraf.xgterm">xgterm.pkg</pkg-ref>
<pkg-ref id="community.iraf.ximtool">ximtool.pkg</pkg-ref>
</choice>
<choice id="community.iraf.ctio" title="External: ctio"
description="Tools from the Cerro Tololo Inter-American Observatory"
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
38 changes: 38 additions & 0 deletions xgterm/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>CFBundleIdentifier</key>
<string>community.iraf.xgterm</string>
<key>CFBundleName</key>
<string>XGTerm</string>
<key>CFBundleDisplayName</key>
<string>XGTerm</string>
<key>CFBundleVersion</key>
<string>2.1</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<key>NSHumanReadableCopyright</key>
<string>1986-2014 Association of Universities for Research in Astronomy Inc.</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>CFBundleIconFile</key>
<string>XGTerm.icns</string>
<key>CFBundleExecutable</key>
<string>XGTerm</string>
<key>LSEnvironment</key>
<dict>
<key>LC_CTYPE</key>
<string>UTF-8</string>
</dict>
</dict>
</plist>

31 changes: 31 additions & 0 deletions xgterm/XGTerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# XGTerm.app start script

SCRIPT_DIR=$(dirname -- "${0}")
CONTENT_DIR=$(dirname -- "${SCRIPT_DIR}")
RESOURCES_DIR=$(dirname -- "${SCRIPT_DIR}")/Resources
APP_DIR=$(dirname -- "${CONTENT_DIR}")
APP_NAME=$(echo $(basename -- "$APP_DIR") | sed 's/\.app$//')

function xquartz_error() {
osascript <<EOT
set theCaption to "XQuartz required but not found"
set theMessage to "Please install it and re-login before running $0."
display alert theCaption message theMessage as critical buttons {"Quit", "XQuartz website"}
set response to button returned of the result
if response is "XQuartz website" then open location "https://xquartz.org"
EOT
}

if [ -z "${DISPLAY}" ] ; then
xquartz_error "${APP_NAME}"
exit 1
fi

# Simple dummy X command to wait until the X server is up
xprop -root > /dev/null

cd "${HOME}"
export TERMINFO=${RESOURCES_DIR}/terminfo
${RESOURCES_DIR}/bin/xgterm -title "${APP_NAME}" -ls &
Binary file added xgterm/XGTerm.iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/icon_64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added xgterm/XGTerm.xcf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
From 0bb53427cf4b80671fe1279bb355d4130d62b4d8 Mon Sep 17 00:00:00 2001
From 188e45d953a60164a1b22512191678de933e7729 Mon Sep 17 00:00:00 2001
From: Ole Streicher <[email protected]>
Date: Fri, 15 Mar 2024 15:44:54 +0100
Subject: [PATCH] Force setting of local terminfo database

---
xgterm/main.c | 1 +
1 file changed, 1 insertion(+)
xgterm/main.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/xgterm/main.c b/xgterm/main.c
index 2ec1437..7d4cd10 100644
index 2ec1437..2817d8c 100644
--- a/xgterm/main.c
+++ b/xgterm/main.c
@@ -1026,6 +1026,7 @@ char **argv;
@@ -1026,6 +1026,8 @@ char **argv;
#ifdef I18N
setlocale(LC_ALL, NULL);
#endif
+ putenv("TERMINFO=/usr/local/share/terminfo");
+ if (getenv("TERMINFO") == NULL)
+ putenv("TERMINFO=/usr/local/share/terminfo");

ProgramName = argv[0];

Expand Down
17 changes: 17 additions & 0 deletions xgterm/scripts/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

#$0 = returns the path to the script
#$1 = returns the path to the package
#$2 = returns the target location (for example: /Applications)
#$3 = returns the target volume (for example: /Volumes/Macintosh HD)

APP_PATH=$2

# Link the binaries, the manpages, and the terminfo file
mkdir -p /usr/local/bin/ /usr/local/share/man/man1/ /usr/local/share/terminfo/78

XGTERM_PATH=${APP_PATH}/XGTerm.app/Contents/Resources
rm -f /usr/local/bin/xgterm /usr/local/share/man/man1/xgterm.1 /usr/local/share/terminfo/78/xgterm
ln -s ${XGTERM_PATH}/bin/xgterm /usr/local/bin/
ln -s ${XGTERM_PATH}/man/xgterm.1 /usr/local/share/man/man1/
ln -s ${XGTERM_PATH}/terminfo/78/xgterm /usr/local/share/terminfo/78/
38 changes: 38 additions & 0 deletions ximtool/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>CFBundleIdentifier</key>
<string>community.iraf.ximtool</string>
<key>CFBundleName</key>
<string>XImtool</string>
<key>CFBundleDisplayName</key>
<string>XImtool</string>
<key>CFBundleVersion</key>
<string>2.1</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<key>NSHumanReadableCopyright</key>
<string>1986-2014 Association of Universities for Research in Astronomy Inc.</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>CFBundleIconFile</key>
<string>XImtool.icns</string>
<key>CFBundleExecutable</key>
<string>XImtool</string>
<key>LSEnvironment</key>
<dict>
<key>LC_CTYPE</key>
<string>UTF-8</string>
</dict>
</dict>
</plist>

33 changes: 33 additions & 0 deletions ximtool/XImtool
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
#
# XImtool.app start script

SCRIPT_DIR=$(dirname -- "${0}")
CONTENT_DIR=$(dirname -- "${SCRIPT_DIR}")
RESOURCES_DIR=$(dirname -- "${SCRIPT_DIR}")/Resources
APP_DIR=$(dirname -- "${CONTENT_DIR}")
APP_NAME=$(echo $(basename -- "$APP_DIR") | sed 's/\.app$//')

function xquartz_error() {
osascript <<EOT
set theCaption to "XQuartz required but not found"
set theMessage to "Please install it and re-login before running $0."
display alert theCaption message theMessage as critical buttons {"Quit", "XQuartz website"}
set response to button returned of the result
if response is "XQuartz website" then open location "https://xquartz.org"
EOT
}

if [ -z "${DISPLAY}" ] ; then
xquartz_error "${APP_NAME}"
exit 1
fi

# Simple dummy X command to wait until the X server is up
xprop -root > /dev/null

# Add local bin dir to path so that ism_wcspix.e can be found and started
export PATH=${PATH}:${RESOURCES_DIR}/bin

cd "${HOME}"
${RESOURCES_DIR}/bin/ximtool &
Binary file added ximtool/XImtool.iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/icon_64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ximtool/XImtool.xcf
Binary file not shown.
17 changes: 17 additions & 0 deletions ximtool/scripts/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

#$0 = returns the path to the script
#$1 = returns the path to the package
#$2 = returns the target location (for example: /Applications)
#$3 = returns the target volume (for example: /Volumes/Macintosh HD)

APP_PATH=$2

# Link the binaries, the manpages
mkdir -p /usr/local/bin/ /usr/local/share/man/man1/

XIMTOOL_PATH=${APP_PATH}/XImtool.app/Contents/Resources
rm -f /usr/local/bin/ximtool /usr/local/share/man/man1/ximtool.1
ln -s ${XIMTOOL_PATH}/bin/ximtool /usr/local/bin/
ln -s ${XIMTOOL_PATH}/bin/ism_wcspix.e /usr/local/bin/
ln -s ${XIMTOOL_PATH}/man/ximtool.1 /usr/local/share/man/man1/

0 comments on commit ee052ec

Please sign in to comment.