summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Teibes2015-02-09 19:20:46 +0100
committerCarsten Teibes2015-02-09 19:20:46 +0100
commit200b0ec02cb6fa21cb55b21e3d6604eaaa5d9cba (patch)
tree4d162ce7fac519ab7c372658b8d6587b4c4b3dcc
downloadaur-200b0ec02cb6fa21cb55b21e3d6604eaaa5d9cba.tar.gz
[add] sublime-text 2.0.2
Add an old libpng with associated patches to circumvent a bug: The compiled-in zlib does not work with newer libpng versions, therefore no icons are shown in sublime-text dialogs.
-rw-r--r--.SRCINFO40
-rw-r--r--0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch106
-rw-r--r--0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch133
-rw-r--r--PKGBUILD84
-rw-r--r--adjust-apng-patch-for-libpng16-git-changes.patch19
-rw-r--r--sublime-text.desktop9
-rw-r--r--sublime-text.install14
-rwxr-xr-xsublime-text.sh22
8 files changed, 427 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..16955b945e9d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,40 @@
+pkgbase = sublime-text
+ pkgdesc = Sophisticated text editor for code, html and prose
+ pkgver = 2.0.2
+ pkgrel = 4
+ url = http://www.sublimetext.com/2
+ install = sublime-text.install
+ arch = i686
+ arch = x86_64
+ license = custom
+ makedepends = python-html2text
+ depends = libpng
+ depends = gtk2
+ depends = bash
+ depends = procps-ng
+ depends = xdg-utils
+ depends = desktop-file-utils
+ depends = shared-mime-info
+ source = sublime-text-eula.html::http://www.sublimetext.com/eula
+ source = sublime-text.desktop
+ source = sublime-text.sh
+ source = http://downloads.sourceforge.net/libpng/libpng-1.6.2.tar.xz
+ source = http://downloads.sourceforge.net/libpng-apng/libpng-1.6.2-apng.patch.gz
+ source = 0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+ source = 0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+ source = adjust-apng-patch-for-libpng16-git-changes.patch
+ sha256sums = 89c40c61b51aaa57693234e8fc9b007c787c00e75f7eef8d817146ba729ef82f
+ sha256sums = 3f11bf8cb814b68ed81b535dd13cc86bb28c71010d74141bfa06137782fd2f7d
+ sha256sums = 765c8a65ef429dc81a983d14d94c97a2d185575d74e702861ad3e374e2759338
+ sha256sums = 1c97a90bc22107e50f04f77a0115f4ec890d5c6a373ac4c560e8fb87259e92de
+ sha256sums = 4196f3c3894f455a78a65170209fc948b01a7448304d8c39bc29d37852b8c73b
+ sha256sums = 0632ea1d588cb7b85dfc2c13444de1682e9d7e61caaf8cce118fc535bc9f4d90
+ sha256sums = 2a65904c85ff492d4f91edd55e17f81ba36ee6af1cac7402f786580f3fc56216
+ sha256sums = 1f51e33233ce560c5d8002bc096aa4cc5be70c082e08b14db4376a9a02f2714a
+ source_i686 = http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2.tar.bz2
+ sha256sums_i686 = 07338e041cfb348938fa8069f0aad3b5b43c319b7ec564ffff1489796f2dcf08
+ source_x86_64 = http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2%20x64.tar.bz2
+ sha256sums_x86_64 = 01baed30d66432e30002a309ff0393967be1daba5cce653e43bba6bd6c38ab84
+
+pkgname = sublime-text
+
diff --git a/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch b/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
new file mode 100644
index 000000000000..e677280511b9
--- /dev/null
+++ b/0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
@@ -0,0 +1,106 @@
+From 56d6bc2e8855d25e03816509a0137c3a70410ae6 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Mon, 29 Apr 2013 08:57:14 -0500
+Subject: [PATCH 06/10] [libpng16] Avoid dereferencing NULL pointer possibly
+ returned from
+
+png_create_write_struct() (Andrew Church).
+---
+ ANNOUNCE | 6 ++++--
+ CHANGES | 4 +++-
+ pngwrite.c | 65 +++++++++++++++++++++++++++++++-------------------------------
+ 3 files changed, 39 insertions(+), 36 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngwrite.c b/pngwrite.c
+index 33924aa..b71a3d3 100644
+--- a/pngwrite.c
++++ b/pngwrite.c
+@@ -494,51 +494,50 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
+ png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
+ error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
+ #endif /* PNG_USER_MEM_SUPPORTED */
++ if (png_ptr != NULL)
++ {
++ /* Set the zlib control values to defaults; they can be overridden by the
++ * application after the struct has been created.
++ */
++ png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+
+- /* Set the zlib control values to defaults; they can be overridden by the
+- * application after the struct has been created.
+- */
+- png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
+-
+- /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
+- * pngwutil.c defaults it according to whether or not filters will be used,
+- * and ignores this setting.
+- */
+- png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
+- png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
+- png_ptr->zlib_mem_level = 8;
+- png_ptr->zlib_window_bits = 15;
+- png_ptr->zlib_method = 8;
++ /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
++ * pngwutil.c defaults it according to whether or not filters will be
++ * used, and ignores this setting.
++ */
++ png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
++ png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
++ png_ptr->zlib_mem_level = 8;
++ png_ptr->zlib_window_bits = 15;
++ png_ptr->zlib_method = 8;
+
+ #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+- png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
+- png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
+- png_ptr->zlib_text_mem_level = 8;
+- png_ptr->zlib_text_window_bits = 15;
+- png_ptr->zlib_text_method = 8;
++ png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
++ png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
++ png_ptr->zlib_text_mem_level = 8;
++ png_ptr->zlib_text_window_bits = 15;
++ png_ptr->zlib_text_method = 8;
+ #endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
+
+- /* This is a highly dubious configuration option; by default it is off, but
+- * it may be appropriate for private builds that are testing extensions not
+- * conformant to the current specification, or of applications that must not
+- * fail to write at all costs!
+- */
+-# ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
++ /* This is a highly dubious configuration option; by default it is off,
++ * but it may be appropriate for private builds that are testing
++ * extensions not conformant to the current specification, or of
++ * applications that must not fail to write at all costs!
++ */
++#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
+ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
+ /* In stable builds only warn if an application error can be completely
+ * handled.
+ */
+-# endif
++#endif
+
+- /* App warnings are warnings in release (or release candidate) builds but
+- * are errors during development.
+- */
+-# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++ /* App warnings are warnings in release (or release candidate) builds but
++ * are errors during development.
++ */
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
+ png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
+-# endif
++#endif
+
+- if (png_ptr != NULL)
+- {
+ /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
+ * do it itself) avoiding setting the default function if it is not
+ * required.
+--
+1.8.2.2
+
diff --git a/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch b/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
new file mode 100644
index 000000000000..0a305c15058d
--- /dev/null
+++ b/0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
@@ -0,0 +1,133 @@
+From 127b08a265f99ce517ea31ec7988a91fc17da4d9 Mon Sep 17 00:00:00 2001
+From: Glenn Randers-Pehrson <glennrp at users.sourceforge.net>
+Date: Sun, 5 May 2013 22:13:47 -0500
+Subject: [PATCH 09/10] [libpng16] Calculate our own zlib windowBits when
+ decoding rather than
+
+trusting the CMF bytes in the PNG datastream.
+---
+ ANNOUNCE | 6 +++--
+ CHANGES | 5 +++-
+ pngrutil.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 3 files changed, 88 insertions(+), 10 deletions(-)
+
+ (foutrelis: pruned non-code changes to apply cleanly to libpng 1.6.2.)
+
+diff --git a/pngrutil.c b/pngrutil.c
+index 01c3679..9c10e26 100644
+--- a/pngrutil.c
++++ b/pngrutil.c
+@@ -18,8 +18,6 @@
+
+ #ifdef PNG_READ_SUPPORTED
+
+-#define png_strtod(p,a,b) strtod(a,b)
+-
+ png_uint_32 PNGAPI
+ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
+ {
+@@ -4165,6 +4163,75 @@ png_read_finish_row(png_structrp png_ptr)
+ }
+ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++/* This is the code to to select a windowBits value to match the smallest
++ * possible sliding window needed to contain the entire uncompressed image.
++ */
++static unsigned int
++required_window_bits(png_alloc_size_t data_size)
++{
++ unsigned int windowBits = 15;
++ if (data_size <= 16384) /* else windowBits must be 15 */
++ {
++ unsigned int half_z_window_size = 1U << (windowBits-1); /* 16384 */
++
++ do
++ {
++ half_z_window_size >>= 1;
++ --windowBits;
++ }
++ while (windowBits > 8 && data_size <= half_z_window_size);
++ }
++ return windowBits;
++}
++/* This is used below to find the size of an image to pass to png_deflate_claim,
++ * so it only needs to be accurate if the size is less than 16384 bytes (the
++ * point at which a lower LZ window size can be used.)
++ *
++ * To do: merge this with png_image_size() in pngwutil.c and put the result
++ * in png.c as a PNG_INTERNAL_FUNCTION.
++ */
++static png_alloc_size_t
++png_read_image_size(png_structrp png_ptr)
++{
++ /* Only return sizes up to the maximum of a png_uint_32, do this by limiting
++ * the width and height used to 15 bits.
++ */
++ png_uint_32 h = png_ptr->height;
++
++ if (png_ptr->rowbytes < 32768 && h < 32768)
++ {
++ if (png_ptr->interlaced)
++ {
++ /* Interlacing makes the image larger because of the replication of
++ * both the filter byte and the padding to a byte boundary.
++ */
++ png_uint_32 w = png_ptr->width;
++ unsigned int pd = png_ptr->pixel_depth;
++ png_alloc_size_t cb_base;
++ int pass;
++
++ for (cb_base=0, pass=0; pass<=6; ++pass)
++ {
++ png_uint_32 pw = PNG_PASS_COLS(w, pass);
++
++ if (pw > 0)
++ cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
++ }
++
++ return cb_base;
++ }
++
++ else
++ return (png_ptr->rowbytes+1) * h;
++ }
++
++ else
++ return 0xffffffffU;
++}
++
++#endif /* PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED */
++
+ void /* PRIVATE */
+ png_read_start_row(png_structrp png_ptr)
+ {
+@@ -4449,14 +4516,20 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+ png_free(png_ptr, buffer);
+ }
+
+- /* Finally claim the zstream for the inflate of the IDAT data, use the bits
+- * value from the stream (note that this will result in a fatal error if the
+- * IDAT stream has a bogus deflate header window_bits value, but this should
+- * not be happening any longer!)
++ /* Finally claim the zstream for the inflate of the IDAT data, using the
++ * windowBts predicted from the uncompressed data size, not the value from
++ * the stream. If READ_OPTIMIZE_WINDOWBITS_SUPPORTED is not defined, then
++ * simply use a 32kbyte window (windowBits=15).
+ */
+- if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
++#ifdef PNG_READ_OPTIMIZE_WINDOWBITS_SUPPORTED
++ if (png_inflate_claim(png_ptr, png_IDAT,
++ required_window_bits(png_read_image_size(png_ptr))) != Z_OK)
++#else
++ if (png_inflate_claim(png_ptr, png_IDAT, 15) != Z_OK)
++#endif
+ png_error(png_ptr, png_ptr->zstream.msg);
+
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
++
+ #endif /* PNG_READ_SUPPORTED */
+--
+1.8.2.2
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..7e9b79ba2c11
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,84 @@
+# Maintainer: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG
+# Contributor: Josh Kropf <josh@slashdev.ca>
+# Contributor: Bartosz Chmura <chmurli at gmail dot com>
+# Contributor: Mikkel Kroman <mk at maero dot dk>
+
+pkgname=sublime-text
+pkgver=2.0.2
+pkgrel=4
+pkgdesc="Sophisticated text editor for code, html and prose"
+arch=('i686' 'x86_64')
+url="http://www.sublimetext.com/2"
+license=('custom')
+depends=("libpng" "gtk2" "bash" "procps-ng" "xdg-utils" "desktop-file-utils"
+ "shared-mime-info")
+makedepends=("python-html2text")
+install="$pkgname.install"
+source=("$pkgname-eula.html"::"http://www.sublimetext.com/eula"
+ "$pkgname.desktop"
+ "$pkgname.sh"
+ "http://downloads.sourceforge.net/libpng/libpng-1.6.2.tar.xz"
+ "http://downloads.sourceforge.net/libpng-apng/libpng-1.6.2-apng.patch.gz"
+ "0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch"
+ "0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch"
+ "adjust-apng-patch-for-libpng16-git-changes.patch")
+source_x86_64=("http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20${pkgver}%20x64.tar.bz2")
+source_i686=("http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20${pkgver}.tar.bz2")
+sha256sums=('89c40c61b51aaa57693234e8fc9b007c787c00e75f7eef8d817146ba729ef82f'
+ '3f11bf8cb814b68ed81b535dd13cc86bb28c71010d74141bfa06137782fd2f7d'
+ '765c8a65ef429dc81a983d14d94c97a2d185575d74e702861ad3e374e2759338'
+ '1c97a90bc22107e50f04f77a0115f4ec890d5c6a373ac4c560e8fb87259e92de'
+ '4196f3c3894f455a78a65170209fc948b01a7448304d8c39bc29d37852b8c73b'
+ '0632ea1d588cb7b85dfc2c13444de1682e9d7e61caaf8cce118fc535bc9f4d90'
+ '2a65904c85ff492d4f91edd55e17f81ba36ee6af1cac7402f786580f3fc56216'
+ '1f51e33233ce560c5d8002bc096aa4cc5be70c082e08b14db4376a9a02f2714a')
+sha256sums_x86_64=('01baed30d66432e30002a309ff0393967be1daba5cce653e43bba6bd6c38ab84')
+sha256sums_i686=('07338e041cfb348938fa8069f0aad3b5b43c319b7ec564ffff1489796f2dcf08')
+
+prepare() {
+ # convert license
+ html2text --ignore-links --body-width=80 $pkgname-eula.html > EULA
+ sed '/EULA/,$!d' -i EULA
+
+ # libpng
+ rm -rf png_fake_install
+ mkdir png_fake_install
+ cd libpng-1.6.2
+ patch -Np1 < ../0001-libpng16-Avoid-dereferencing-NULL-pointer-possibly-r.patch
+ patch -Np1 -i ../0002-libpng16-Calculate-our-own-zlib-windowBits-when-deco.patch
+ patch -d .. -Np0 < ../adjust-apng-patch-for-libpng16-git-changes.patch
+ patch -Np1 < ../libpng-1.6.2-apng.patch
+}
+
+build() {
+ # libpng
+ cd libpng-1.6.2
+ ./configure --prefix=/ --with-binconfigs=no --enable-shared --disable-static
+ make install DESTDIR="$srcdir"/png_fake_install
+}
+
+package () {
+ install -d "$pkgdir"/opt
+ cp -rup "Sublime Text 2" "$pkgdir"/opt/$pkgname
+
+ # launcher
+ install -Dm755 $pkgname.sh "$pkgdir"/usr/bin/subl
+
+ # .desktop file and icons
+ install -Dm644 $pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
+ for _res in 256x256 128x128 48x48 32x32 16x16; do
+ install -d "$pkgdir"/usr/share/icons/hicolor/$_res/apps
+ ln -s /opt/$pkgname/Icon/$_res/sublime_text.png \
+ "$pkgdir"/usr/share/icons/hicolor/$_res/apps/$pkgname.png
+ done
+
+ # license
+ install -Dm644 EULA "$pkgdir"/usr/share/licenses/$pkgname/EULA
+
+ # libpng
+ install -m644 png_fake_install/lib/libpng16.so.16.2.0 \
+ "$pkgdir"/opt/$pkgname/lib/libpng16.so.16.2.0
+ ln -s libpng16.so.16.2.0 "$pkgdir"/opt/$pkgname/lib/libpng16.so.16
+ ln -s libpng16.so.16 "$pkgdir"/opt/$pkgname/lib/libpng16.so
+ ln -s libpng16.so "$pkgdir"/opt/$pkgname/lib/libpng.so
+}
diff --git a/adjust-apng-patch-for-libpng16-git-changes.patch b/adjust-apng-patch-for-libpng16-git-changes.patch
new file mode 100644
index 000000000000..26ac1c1cfcee
--- /dev/null
+++ b/adjust-apng-patch-for-libpng16-git-changes.patch
@@ -0,0 +1,19 @@
+--- libpng-1.6.2-apng.patch.orig 2013-05-06 12:09:16.000000000 +0300
++++ libpng-1.6.2-apng.patch 2013-05-06 12:12:14.000000000 +0300
+@@ -1034,7 +1034,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+
+ if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
+ png_chunk_benign_error(png_ptr, "Extra compressed data");
+-@@ -4459,4 +4671,80 @@
++@@ -4459,5 +4671,81 @@
+
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
+@@ -1114,6 +1114,7 @@ diff -Naru libpng-1.6.2.org/pngrutil.c l
+ +}
+ +#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+ +#endif /* PNG_READ_APNG_SUPPORTED */
++
+ #endif /* PNG_READ_SUPPORTED */
+ diff -Naru libpng-1.6.2.org/pngset.c libpng-1.6.2/pngset.c
+ --- libpng-1.6.2.org/pngset.c 2013-04-29 17:31:42.000000000 +0900
diff --git a/sublime-text.desktop b/sublime-text.desktop
new file mode 100644
index 000000000000..d23aa62d1e85
--- /dev/null
+++ b/sublime-text.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Sublime Text
+Comment=Sophisticated text editor for code, html and prose
+Exec=subl %F
+Icon=sublime-text
+Categories=Utility;TextEditor;
+Terminal=false
+MimeType=text/plain;
diff --git a/sublime-text.install b/sublime-text.install
new file mode 100644
index 000000000000..83427c8491a5
--- /dev/null
+++ b/sublime-text.install
@@ -0,0 +1,14 @@
+
+post_install() {
+ xdg-icon-resource forceupdate --theme hicolor
+ update-desktop-database -q
+ update-mime-database usr/share/mime > /dev/null 2>&1
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/sublime-text.sh b/sublime-text.sh
new file mode 100755
index 000000000000..905aea64111d
--- /dev/null
+++ b/sublime-text.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Please note that Sublime Text 2 for some reason opens an empty instance
+# if the project you're trying to open is already open in another instance,
+# instead of just giving it focus.
+
+BIN=/opt/sublime-text/sublime_text
+
+PID=$(ps -Ao comm,pid | awk '$1 == "sublime_text" { print $2 }')
+ARGS="--class=sublime_text"
+
+if [[ ${1:(-16)} == ".sublime-project" ]]; then
+ ARGS="${ARGS} --project"
+fi
+
+# LD_LIBRARY_PATH is needed for old libpng
+
+if [[ -n ${PID} ]]; then
+ LD_LIBRARY_PATH=/opt/sublime-text/lib ${BIN} ${ARGS} "$@"
+else
+ LD_LIBRARY_PATH=/opt/sublime-text/lib ${BIN} ${ARGS} "$@" &
+fi