64 bit support, finally!
"Jan Niklas Hasse" <[email protected]>
| Newsgroups | gmane.comp.autopackage.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, I spend this evening trying to get 64 bit to work. And I did. :-D After my patch it should be possible to compile autopackage on 64 and (!!!!) create true x86_64 packages! It's also possible to create Hybrid-Packages (containing both binaries): Just set CpuArchitectures to "x86 x86_64" and install the correct binary (I haven't tested it though). Autopackage now determines whether it has got a x86_64 package and only searches for proper libraries. Examples: arch: x86 package: x86 libraries: x86 arch: x86_64 package: x86_64 libraries: x86_64 arch: x86_64 package: x86 libraries: x86 arch: x86 package: x86_64 libraries: fail, that's not possible I hope everyone helps my testing it, I'm very often on IRC (nick: jhasse). Feel free to highlight me. --------------------------------------------------------------------- To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected] For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected]
x86_64.patch
(text/x-diff, 11.8 KB)
diff -aur autopackage.old/apbuild/apsymbols.h autopackage/apbuild/apsymbols.h
--- autopackage.old/apbuild/apsymbols.h 2008-04-19 22:08:26.000000000 +0200
+++ autopackage/apbuild/apsymbols.h 2008-04-19 22:06:49.000000000 +0200
@@ -46,7 +46,9 @@
__asm__(".symver pthread_cond_signal,pthread_cond_signal@GLIBC_2.0");
__asm__(".symver pthread_cond_timedwait,pthread_cond_timedwait@GLIBC_2.0");
__asm__(".symver pthread_cond_wait,pthread_cond_wait@GLIBC_2.0");
+#ifndef __x86_64
__asm__(".symver realpath,realpath@GLIBC_2.0");
+#endif
__asm__(".symver regexec,regexec@GLIBC_2.0");
__asm__(".symver __strcasecmp_l,__strcasecmp_l@GLIBC_2.1");
__asm__(".symver __strcoll_l,__strcoll_l@GLIBC_2.1");
diff -aur autopackage.old/main/makepackage autopackage/main/makepackage
--- autopackage.old/main/makepackage 2008-04-19 22:09:50.000000000 +0200
+++ autopackage/main/makepackage 2008-04-19 23:40:49.000000000 +0200
@@ -694,11 +694,6 @@
return 1
fi
- if [[ "$CPUARCHITECTURES" != "x86" ]] && [[ "$CPUARCHITECTURES" != "" ]]; then
- red; outn "ERROR: "; normal; out "Sorry, autopackage is x86 only for now. Please do not request non-x86 architectures."
- return 1
- fi
-
# **********************************************************
# 2.4 Set Meta Defaults
@@ -750,8 +745,17 @@
COMPRESSION="bzip2"
fi
- CPUARCHITECTURE=x86
- CPUARCHITECTURES=x86
+ cpu_architecture=x86
+ if [[ $(uname -r) == "x86_64" ]]; then
+ cpu_architecture=x86_64
+ fi
+ if [[ -n $CPUARCHITECTURE ]]; then
+ red; outn "WARNING: "; normal; out "CpuArchitecture is deprecated. Use CpuArchitectures instead."
+ else
+ CPUARCHITECTURE=$cpu_architecture
+ fi
+
+ CPUARCHITECTURES=$cpu_architecture
# determine interface version and normalize
local interfaceversion_major=`getMajor "$INTERFACEVERSION"`
diff -aur autopackage.old/main/share/apkg-dep autopackage/main/share/apkg-dep
--- autopackage.old/main/share/apkg-dep 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/apkg-dep 2008-04-20 00:01:37.000000000 +0200
@@ -375,7 +375,7 @@
unset header c
header=$( _getPackageHeader "$1/$f" )
- # Verify package matches machine cpu architecture
+ # Verify package matches machine cpu architecture TODO: Use CpuArchitectures instead
c=$( echo "$header" | grep CPUArchitecture | sed 's/# CPUArchitecture //' )
trace package cpuarchitecture is \"$c\"
if [[ "$cpu_architecture" != "$c" ]]; then
diff -aur autopackage.old/main/share/apkg-funclib autopackage/main/share/apkg-funclib
--- autopackage.old/main/share/apkg-funclib 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/apkg-funclib 2008-04-20 00:27:31.000000000 +0200
@@ -403,8 +403,10 @@
# like Fedora. But, it's not right for pure64 distros like
# Debian/Ubuntu or Gentoo
- i386 | i486 | i586 | i686 | x86_64 | athlon)
+ i386 | i486 | i586 | i686 | athlon)
export cpu_architecture="x86";;
+ x86_64)
+ export cpu_architexture="x86_64";;
esac
fi
@@ -2199,20 +2201,28 @@
# check CPU arch is OK before we run any native code
needed_archs=$( echo "$tmp" | sed -n '1p' )
local found=false
+ local x86found=false
for a in $needed_archs; do
if [[ "$a" == "$cpu_architecture" ]]; then found=true; fi
+ if [[ "$a" == "x86" ]]; then x86found=true; fi
done
-
+ echo "needed: $needed_archs arch: $cpu_architecture x86found: $x86found found: $found"
if ! $found; then
-
- # arch command is not consistent like ia32.linux != i686 so use uname
- locateCommand uname
- this_arch=`"$lc_location" -m`
- out
- out "$intl_UNSUPPORTED_CPU_ARCH" "$needed_archs" "$this_arch"
- out
- unset this_arch
- return 1
+ if $x86found && [[ "$cpu_architecture" == "x86_64" ]]; then
+ # if we are on x86_64 we are able to run x86 code
+ cpu_architecture="x86"
+ trace cpu architecture changed to x86
+ found=true
+ else
+ # arch command is not consistent like ia32.linux != i686 so use uname
+ locateCommand uname
+ this_arch=`"$lc_location" -m`
+ out
+ out "$intl_UNSUPPORTED_CPU_ARCH" "$needed_archs" "$this_arch"
+ out
+ unset this_arch
+ return 1
+ fi
fi
trace passed cpu arch test
diff -aur autopackage.old/main/share/apkg-script-utils autopackage/main/share/apkg-script-utils
--- autopackage.old/main/share/apkg-script-utils 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/apkg-script-utils 2008-04-19 23:57:26.000000000 +0200
@@ -419,6 +419,63 @@
##
+# _getLibraryPath <LIBRARY>
+# LIBRARY: The name of the library
+# Outputs: Paths of the library
+# Returns: non-zero if the library isn't found at all
+#
+# Get's the path of a library and automatically filters by the architecture.
+# For example if $cpu_architecture is "x86_64" it will return the path of the 64 bit library.
+# If $cpu_architecture is "x86" or isn't set, only 32 bit libraries will be returned.
+### START GETLIBRARYPATHS
+function _getLibraryPaths() {
+ local lib=""
+ lib=$1
+ if [[ "$lib" == "" ]]; then
+ err "must specify the library to check for"
+ popOptE
+ return 1
+ fi
+
+ local cacheresult
+ cacheresult=$( /sbin/ldconfig -p | grep "${lib}\(\.[[:digit:]\.]*\)\?$" | awk 'BEGIN {FS=" => "} { print $2 }' | while read; do test -f "$REPLY" && echo $REPLY; done )
+ local libpathresult=`_scanLDLibPath "${lib}"`
+ local liblist=`echo -e "${libpathresult}\n${cacheresult}" | grep "\(.\)" | sort | uniq`
+ local result="";
+ if [[ "$liblist" == "" ]]; then warn "$1 not found"; popOptE; return 1; fi; # not found in cache
+
+ # make sure that libraries in $liblist are compatible with our architecture
+ local proper_architecture=false
+
+ local oIFS="$IFS"
+ IFS=$'\n';
+
+ local l
+ local -a liblist_array
+ liblist_array=($liblist);
+ liblist=""
+ for l in "${liblist_array[@]}"; do
+ if isLibrary32 "$l"; then
+ if [[ "$cpu_architecture" != "x86_64" ]]; then
+ proper_architecture=true
+ liblist=$(echo -e "$liblist$l\n")
+ fi
+ else
+ if [[ "$cpu_architecture" == "x86_64" ]]; then
+ proper_architecture=true
+ liblist=$(echo -e "$liblist$l\n")
+ fi
+ fi
+ done
+
+ IFS="$oIFS"
+
+ echo "cpu_architecture: $cpu_architecture displayname: $AUTOSU_DISPLAYNAME" > ~/Desktop/asd.txt
+ echo $liblist
+}
+### END GETLIBRARYPATHS
+
+##
# testForLib [-v] [-i] LibraryName
# -v: Verbose mode. Print each version number out on stdout.
# -i: Print each unique interface version found on stdout.
@@ -471,46 +528,7 @@
return 1
fi
- local cacheresult
- cacheresult=$( /sbin/ldconfig -p | grep "${lib}\(\.[[:digit:]\.]*\)\?$" | awk 'BEGIN {FS=" => "} { print $2 }' | while read; do test -f "$REPLY" && echo $REPLY; done )
- trace cacheresult=$cacheresult
- local libpathresult=`_scanLDLibPath "${lib}"`
- trace libpathresult=$libpathresult
- local liblist=`echo -e "${libpathresult}\n${cacheresult}" | grep "\(.\)" | sort | uniq`
- local result="";
- if [[ "$liblist" == "" ]]; then warn "$1 not found"; popOptE; return 1; fi; # not found in cache
- trace liblist=$liblist
-
- # make sure that libraries in $liblist are only valid 32-bit libs
- local found_32bit=false
-
- local oIFS="$IFS"
- IFS=$'\n';
-
- local l
- local -a liblist_array
- liblist_array=($liblist);
- for l in "${liblist_array[@]}"; do
- if isLibrary32 "$l"; then
- found_32bit=true
- break;
- fi
- done
-
- IFS="$oIFS"
-
- trace $found_32bit
-
- if ! $found_32bit; then
- warn "only 64-bit libraries were found, returning 1"
- popOptE;
- return 1
- fi
-
- if ! $verbose && ! $verbose_i; then
- popOptE
- return 0
- fi
+ liblist=$(_getLibraryPaths $lib)
# we want to loop over the results until we find a library that matches the required version
(
@@ -3360,12 +3378,22 @@
# Checks the system C library for the given version symbols. The missing symbols, if any
# will be output to stdout.
function _checkForGlibcVersions() {
- if isLibrary32 /lib/libc.so.6; then
- dumpverdefs32 /lib/libc.so.6 $@
+ local lib=$(_getLibraryPaths libc.so.6)
+ #FIXME: _getLibraryPaths might return more then one path
+
+ trace $lib
+ trace "asd"
+ echo "asd: $lib" >&2
+ out "asd"
+ out "asd: $lib"
+
+ if isLibrary32 $lib; then
+ dumpverdefs32 $lib $@
else
- dumpverdefs64 /lib/libc.so.6 $@
+ dumpverdefs64 $lib $@
fi
}
+
##
# getPythonLibDir
diff -aur autopackage.old/main/share/backend.template autopackage/main/share/backend.template
--- autopackage.old/main/share/backend.template 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/backend.template 2008-04-19 23:42:30.000000000 +0200
@@ -96,16 +96,29 @@
unset _autopackage_target
# check if binary is usable on target machine, if not error
- found=false
+ local found=false
+ local x86found=false
for a in $CPUARCHITECTURES; do
if [[ "$a" == "$cpu_architecture" ]]; then
found=true
+ break
+ fi
+ if [[ "$a" == "x86" ]]; then
+ x86found=true
fi
done
if ! $found; then
- err failed cpu architecture payload check
- __cleanup_backend
- exit 1
+ if $x86found && [[ "$cpu_architecture" == "x86_64" ]]; then
+ # if we are on x86_64 we are able to run x86 code
+ cpu_architecture="x86"
+ trace cpu architecture changed to x86
+ found=true
+ break
+ else
+ err failed cpu architecture payload check
+ __cleanup_backend
+ exit 1
+ fi
fi
trace passed cpu architecture payload check
diff -aur autopackage.old/main/share/installer.2.template autopackage/main/share/installer.2.template
--- autopackage.old/main/share/installer.2.template 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/installer.2.template 2008-04-20 00:33:05.000000000 +0200
@@ -24,22 +24,6 @@
%ErrorMessage%
-# are we on 32bit (or 64bit + compat libs?)
-locateCommand uname
-cpu_architecture=`"$lc_location" -m`
-case "$cpu_architecture" in
- i386 | i486 | i586 | i686 )
- export cpu_architecture="x86";;
-esac
-
-if [[ "$cpu_architecture" != "x86" ]]; then
- if [ ! -d /usr/lib32 ]; then
- errorMessage "Sorry, Autopackage only supports x86 32-bit systems, or 64-bit systems with compatibility libraries installed. Please install the compatibility libraries and rerun install." "Error Installing Autopackage"
- rm -rf "$WORKING_DIRECTORY"
- exit 1
- fi
-fi
-
# setup XDG configuration variables scoped for autopackage
#
# AUTOPACKAGE_CONFIG_HOME User configuration directory
diff -aur autopackage.old/main/share/installer.template autopackage/main/share/installer.template
--- autopackage.old/main/share/installer.template 2008-04-19 22:09:25.000000000 +0200
+++ autopackage/main/share/installer.template 2008-04-20 00:33:38.000000000 +0200
@@ -24,22 +24,6 @@
%ErrorMessage%
-# are we on 32bit (or 64bit + compat libs?)
-locateCommand uname
-cpu_architecture=`"$lc_location" -m`
-case "$cpu_architecture" in
- i386 | i486 | i586 | i686 )
- export cpu_architecture="x86";;
-esac
-
-if [[ "$cpu_architecture" != "x86" ]]; then
- if [ ! -d /usr/lib32 ]; then
- errorMessage "Sorry, Autopackage only supports x86 32-bit systems, or 64-bit systems with compatibility libraries installed. Please install the compatibility libraries and rerun install." "Error Installing Autopackage"
- rm -rf "$WORKING_DIRECTORY"
- exit 1
- fi
-fi
-
# setup XDG configuration variables scoped for autopackage
#
# AUTOPACKAGE_CONFIG_HOME User configuration directory