Skip to content

Instantly share code, notes, and snippets.

@suluke

suluke/PKGBUILD Secret

Last active Jul 10, 2020
Embed
What would you like to do?
linuxdcpp aur package
diff --git a/SConstruct b/SConstruct
index 246be58..791a5b8 100755
--- a/SConstruct
+++ b/SConstruct
@@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
import os
-import commands
+import subprocess
import string
try:
from bzrlib import branch
except ImportError:
- print "bzrlib not installed"
+ print("bzrlib not installed")
EnsureSConsVersion(0, 98, 1)
@@ -18,8 +18,8 @@ BUILD_PATH = '#/build/'
BUILD_LOCALE_PATH = BUILD_PATH + 'locale/'
BUILD_FLAGS = {
- 'common' : ['-I#', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT'],
- 'debug' : ['-g', '-ggdb', '-Wall', '-D_DEBUG'],
+ 'common' : ['-I#', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT', '-std=gnu++98'],
+ 'debug' : ['-g', '-ggdb', '-Wall', '-D_DEBUG'],
'release' : ['-O3', '-fomit-frame-pointer', '-DNDEBUG']
}
@@ -41,15 +41,15 @@ def check_pkg(context, name):
def check_cxx_version(context, name, major, minor):
context.Message('Checking for %s >= %d.%d...' % (name, major, minor))
- ret = commands.getoutput('%s -dumpversion' % name)
+ ret = subprocess.getoutput('%s -dumpversion' % name).split('.')
retval = 0
try:
- if ((string.atoi(ret[0]) == major and string.atoi(ret[2]) >= minor)
- or (string.atoi(ret[0]) > major)):
+ if ((int(ret[0]) == major and int(ret[2]) >= minor)
+ or (int(ret[0]) > major)):
retval = 1
except ValueError:
- print "No C++ compiler found!"
+ print("No C++ compiler found!")
context.Result(retval)
return retval
@@ -62,7 +62,7 @@ def check_bzr_revision(context):
b = branch.Branch.open('.')
revision = str(b.revno())
except:
- print "failed"
+ print("failed")
context.env['BZR_REVISION'] = revision
context.Result(revision)
@@ -121,22 +121,22 @@ env = Environment(ENV = os.environ, variables = vars, package = PACKAGE)
env['mode'] = 'debug' if env.get('debug') else 'release'
env['build_path'] = BUILD_PATH + env['mode'] + '/'
-if os.environ.has_key('CXX'):
+if 'CXX' in os.environ:
env['CXX'] = os.environ['CXX']
else:
- print 'CXX env variable is not set, attempting to use g++'
+ print('CXX env variable is not set, attempting to use g++')
env['CXX'] = 'g++'
-if os.environ.has_key('CC'):
+if 'CC' in os.environ:
env['CC'] = os.environ['CC']
-if os.environ.has_key('CXXFLAGS'):
+if 'CXXFLAGS' in os.environ:
env['CPPFLAGS'] = env['CXXFLAGS'] = os.environ['CXXFLAGS'].split()
-if os.environ.has_key('LDFLAGS'):
+if 'LDFLAGS' in os.environ:
env['LINKFLAGS'] = os.environ['LDFLAGS'].split()
-if os.environ.has_key('CFLAGS'):
+if 'CFLAGS' in os.environ:
env['CFLAGS'] = os.environ['CFLAGS'].split()
env['CPPDEFINES'] = [] # Initialize as a list so Append doesn't concat strings
@@ -186,32 +186,32 @@ conf = env.Configure(
if not 'install' in COMMAND_LINE_TARGETS:
if not conf.CheckCXXVersion(env['CXX'], 4, 1):
- print 'Compiler version check failed. g++ 4.1 or later is needed'
+ print('Compiler version check failed. g++ 4.1 or later is needed')
Exit(1)
if not conf.CheckPKGConfig():
- print '\tpkg-config not found.'
+ print('\tpkg-config not found.')
Exit(1)
if not conf.CheckPKG('gtk+-2.0 >= 2.12'):
- print '\tgtk+ >= 2.12 not found.'
- print '\tNote: You might have the lib but not the headers'
+ print('\tgtk+ >= 2.12 not found.')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
if not conf.CheckPKG('gthread-2.0 >= 2.4'):
- print '\tgthread >= 2.4 not found.'
- print '\tNote: You might have the lib but not the headers'
+ print('\tgthread >= 2.4 not found.')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
if not conf.CheckPKG('libglade-2.0 >= 2.4'):
- print '\tlibglade-2.0 >= 2.4 not found.'
- print '\tNote: You might have the lib but not the headers'
+ print('\tlibglade-2.0 >= 2.4 not found.')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
-
+
if not conf.CheckCXXHeader('boost/version.hpp', '<>'):
- print '\tboost not found.'
- print '\tNote: You might have the lib but not the headers'
+ print('\tboost not found.')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
if not conf.CheckHeader('time.h'):
@@ -224,34 +224,34 @@ if not 'install' in COMMAND_LINE_TARGETS:
Exit(1)
if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'c'):
- print '\tpthread library not found'
- print '\tNote: You might have the lib but not the headers'
+ print('\tpthread library not found')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
if not conf.CheckLibWithHeader('z', 'zlib.h', 'c'):
- print '\tz library (gzip/z compression) not found'
- print '\tNote: You might have the lib but not the headers'
+ print('\tz library (gzip/z compression) not found')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
if not conf.CheckLibWithHeader('bz2', 'bzlib.h', 'c'):
- print '\tbz2 library (bz2 compression) not found'
- print '\tNote: You might have the lib but not the headers'
+ print('\tbz2 library (bz2 compression) not found')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
# This needs to be before ssl check on *BSD systems
if not conf.CheckLib('crypto'):
- print '\tcrypto library not found'
- print '\tNote: This library may be a part of libssl on your system'
+ print('\tcrypto library not found')
+ print('\tNote: This library may be a part of libssl on your system')
Exit(1)
if not conf.CheckLibWithHeader('ssl', 'openssl/ssl.h', 'c'):
- print '\tOpenSSL library (libssl) not found'
- print '\tNote: You might have the lib but not the headers'
+ print('\tOpenSSL library (libssl) not found')
+ print('\tNote: You might have the lib but not the headers')
Exit(1)
# Needed for XFlush(). Headers shouldn't be needed since we include gdk/gdkx.h
if not conf.CheckLib('X11'):
- print '\tX11 library not found'
+ print('\tX11 library not found')
Exit(1)
if not conf.CheckHeader('iconv.h'):
@@ -264,8 +264,8 @@ if not 'install' in COMMAND_LINE_TARGETS:
# TODO: Implement a plugin system so libnotify doesn't have compile-time dependencies
if not conf.CheckPKG('libnotify >= 0.4.1'):
- print '\tlibnotify >= 0.4.1 not found, disabling notifications.'
- print '\tNote: You might have the lib but not the headers'
+ print('\tlibnotify >= 0.4.1 not found, disabling notifications.')
+ print('\tNote: You might have the lib but not the headers')
else:
conf.env.Append(CPPDEFINES = 'HAVE_LIBNOTIFY')
conf.env.ParseConfig('pkg-config --libs libnotify')
@@ -354,4 +354,3 @@ else:
env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'doc', PACKAGE), source = text_files))
env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'applications'), source = desktop_file))
env.Alias('install', env.Install(dir = os.path.join(prefix, 'bin'), source = PACKAGE))
-
diff --git a/dcpp/CryptoManager.cpp b/dcpp/CryptoManager.cpp
index 395846c..5b173db 100644
--- a/dcpp/CryptoManager.cpp
+++ b/dcpp/CryptoManager.cpp
@@ -107,10 +107,13 @@ CryptoManager::CryptoManager()
};
if(dh) {
- dh->p = BN_bin2bn(dh4096_p, sizeof(dh4096_p), 0);
- dh->g = BN_bin2bn(dh4096_g, sizeof(dh4096_g), 0);
+ BIGNUM *p = BN_bin2bn(dh4096_p, sizeof(dh4096_p), 0);
+ BIGNUM *q = BN_dup(DH_get0_q(dh));
+ BIGNUM *g = BN_bin2bn(dh4096_g, sizeof(dh4096_g), 0);
- if (!dh->p || !dh->g) {
+ DH_set0_pqg(dh, p, q, g);
+
+ if (!p || !g) {
dh.reset();
} else {
SSL_CTX_set_options(serverContext, SSL_OP_SINGLE_DH_USE);
#Contributor: SpepS <dreamspepser at yahoo dot it>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Tom K <tom@archlinux.org>
# Contributor: kaptoxic <kaptoxic at yahoo dot com>
pkgname=linuxdcpp
pkgver=1.1.0
pkgrel=8
pkgdesc="A Gtk+ Direct Connect client based on DC++."
url="https://launchpad.net/linuxdcpp/"
license=('GPL')
arch=('i686' 'x86_64')
depends=('openssl' 'glib2' 'libglade' 'bzip2' 'libnotify' 'hicolor-icon-theme')
makedepends=('scons' 'boost')
conflicts=('linuxdcpp-bzr')
source=(
"$url${pkgver%%.?}/$pkgver/+download/$pkgname-$pkgver.tar.bz2"
"linuxdcpp-sconstruct.patch"
)
md5sums=('037de708bdb1e5dd7ac6c359b0e2c1a0'
'a0dcb43a1c87a01446dca6b38c3969a2')
prepare() {
cd "$srcdir/$pkgname-$pkgver"
patch -Np1 -i "$srcdir/linuxdcpp-sconstruct.patch"
}
build() {
cd "$srcdir/$pkgname-$pkgver"
scons PREFIX=/usr
}
package() {
cd "$srcdir/$pkgname-$pkgver"
scons install FAKE_ROOT="$pkgdir/"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment