--- /dev/null
+
+ README-cross
+
+ pkgutils for crosscompilations
+
+
+Build pkgutils
+$ make
+
+Edit pkgmk-cross.conf with your settings:
+$ vim pkgmk-cross.conf
+
+Add pkgmk-cross to the PATH environment variable:
+$ export PATH=/devel/crux-arm/pkgutils-cross:$PATH
+(note that append the old value for PATH at the end is important)
+
+Now you're ready to crosscompile packages:
+$ cd /devel/crux-arm/ports/core-cross/ncurses
+$ fakeroot pkgmk-cross -d
+
+And also to install (when you need a dependency installed)
+$ cd /devel/crux-arm/ports/core-cross/ncurses
+$ pkgadd-cross ncurses#X.X-1.pkg.tar.gz
+$ cd /devel/crux-arm/ports/core-cross/bash
+$ fakeroot pkgmk-cross -d
--- /dev/null
+#!/bin/sh
+
+TOPDIR="$(cd $(dirname $(which $0)); pwd)"
+
+PKGADD=$TOPDIR/pkgadd
+PKGADD_CONF=$TOPDIR/pkgadd.conf
+PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
+. $PKGMK_CONF
+
+if [ -z "$CLFS" ]; then
+ echo "Error, '\$CLFS' value not found"
+ echo "Please configure '$PKGMK_CONF' before use $(basename $0)"
+ exit 1
+fi
+
+if [ ! -f $CLFS/var/lib/pkg/db ]; then
+ install -d -m 0755 $CLFS/var/lib/pkg
+ touch $CLFS/var/lib/pkg/db
+fi
+
+# be sure that the path to package file exists
+# and if not prepend the package dir variable
+ARGS=""
+while [ "$1" ]; do
+ case $1 in
+ *.pkg.tar.*)
+ PATH_TO_PACKAGE="$1"
+ if [ ! -f "$PATH_TO_PACKAGE" ]; then
+ PATH_TO_PACKAGE="$PKGMK_PACKAGE_DIR/$PATH_TO_PACKAGE"
+ fi
+ ARGS="$ARGS $PATH_TO_PACKAGE"
+ ;;
+ *)
+ ARGS="$ARGS $1"
+ ;;
+ esac
+ shift
+done
+
+$PKGADD -c $PKGADD_CONF -r $CLFS $ARGS
+
+# we need to adjust .la files for our temporary root filesystem tree (CLFS)
+if [ $? -eq 0 ]; then
+ LIBTOOL_FILES=$(tar tf $PATH_TO_PACKAGE 2>/dev/null | grep '\.la$')
+ for la_file in $LIBTOOL_FILES; do
+ sed -e "s|libdir='/|libdir='$CLFS/|" -i $CLFS/$la_file
+ done
+fi
+
+# End of file
//
// Copyright (c) 2000-2005 Per Liden
// Copyright (c) 2006-2013 by CRUX team (http://crux.nu)
-//
+//
+// Patches for alternative pkgadd.conf file by Jose V Beneyto <sepen@crux.nu>
+//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// Check command line options
//
string o_root;
+ string o_config;
string o_package;
bool o_upgrade = false;
bool o_force = false;
assert_argument(argv, argc, i);
o_root = argv[i + 1];
i++;
+ } else if (option == "-c" || option == "--config") {
+ assert_argument(argv, argc, i);
+ o_config = argv[i + 1];
+ i++;
} else if (option == "-u" || option == "--upgrade") {
o_upgrade = true;
} else if (option == "-f" || option == "--force") {
db_open(o_root);
pair<string, pkginfo_t> package = pkg_open(o_package);
- vector<rule_t> config_rules = read_config();
+ vector<rule_t> config_rules = read_config(o_config);
bool installed = db_find_pkg(package.first);
if (installed && !o_upgrade)
{
cout << "usage: " << utilname << " [options] <file>" << endl
<< "options:" << endl
- << " -u, --upgrade upgrade package with the same name" << endl
- << " -f, --force force install, overwrite conflicting files" << endl
- << " -r, --root <path> specify alternative installation root" << endl
- << " -v, --version print version and exit" << endl
- << " -h, --help print help and exit" << endl;
+ << " -u, --upgrade upgrade package with the same name" << endl
+ << " -f, --force force install, overwrite conflicting files" << endl
+ << " -r, --root <path> specify alternative installation root" << endl
+ << " -c, --config <file> use alternate configuration file" << endl
+ << " -v, --version print version and exit" << endl
+ << " -h, --help print help and exit" << endl;
}
-vector<rule_t> pkgadd::read_config() const
+vector<rule_t> pkgadd::read_config(string file) const
{
vector<rule_t> rules;
unsigned int linecount = 0;
- const string filename = root + PKGADD_CONF;
+ string filename = root + PKGADD_CONF;
+
+ if (!file.empty()) filename = file;
ifstream in(filename.c_str());
if (in) {
virtual void print_help() const;
private:
- vector<rule_t> read_config() const;
+ vector<rule_t> read_config(string file) const;
set<string> make_keep_list(const set<string>& files, const vector<rule_t>& rules) const;
set<string> apply_install_rules(const string& name, pkginfo_t& info, const vector<rule_t>& rules);
void find_rules(const vector<rule_t>& rules, rule_event_t event, vector<rule_t>& found) const;
--- /dev/null
+#!/bin/sh
+
+TOPDIR="$(cd $(dirname $(which $0)); pwd)"
+
+PKGINFO=$TOPDIR/pkginfo
+
+PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
+. $PKGMK_CONF
+
+if [ -z "$CLFS" ]; then
+ echo "Error, '\$CLFS' value not found"
+ echo "Please configure '$PKGMK_CONF' before use $(basename $0)"
+ exit 1
+fi
+
+if [ -x $PKGINFO ]; then
+ $PKGINFO -r $CLFS $@
+else
+ ln -s pkgadd $PKGINFO
+ $PKGINFO -r $CLFS $@
+fi
+
+# End of file
--- /dev/null
+#!/bin/bash
+
+TOPDIR="$(cd $(dirname $(which $0)); pwd)"
+TMP_CONF="$(mktemp)"
+
+PKGMK=$TOPDIR/pkgmk
+PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
+PKGMK_ARGS=""
+PKGMK_OPTIMIZE=""
+
+while [ "$1" ]; do
+ if [ "$1" != "-o" ]; then
+ PKGMK_ARGS="$PKGMK_ARGS $1"
+ else
+ shift
+ PKGMK_OPTIMIZE="$1"
+ fi
+ shift
+done
+
+if [ ! -z "$PKGMK_OPTIMIZE" ]; then
+ _cflags="$(grep "^${PKGMK_OPTIMIZE}_CFLAGS=" $PKGMK_CONF | cut -d'=' -f2- | sed 's|"||g')"
+ if [ ! -z "$_cflags" ]; then
+ sed '/_CFLAGS=/d' $PKGMK_CONF | sed "s|CFLAGS=.*|CFLAGS=\"$_cflags\"|" > $TMP_CONF
+ PKGMK_CONF="$TMP_CONF"
+ else
+ echo "Error, invalid optimization: '$PKGMK_OPTIMIZE'"
+ exit 1
+ fi
+fi
+
+if [ -x $PKGMK ]; then
+ $PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
+else
+ chmod +x $PKGMK
+ $PKGMK -cf $PKGMK_CONF $PKGMK_ARGS
+fi
+
+rm -f $TMP_CONF
+
+# End of file
--- /dev/null
+#
+# pkgmk.conf: pkgmk(8) configuration
+#
+
+export CHOST="$(echo $MACHTYPE)"
+
+# hardfp (mainline)
+export CTARGET="arm-crux-linux-gnueabihf"
+export CLFS="/devel/crux-arm/toolchain/clfs"
+export CROSSTOOLS="/devel/crux-arm/toolchain/crosstools"
+#
+# softfp
+#export CTARGET="arm-crux-linux-gnueabi"
+#export CLFS="/devel/crux-arm/toolchain-softfp/clfs"
+#export CROSSTOOLS="/devel/crux-arm/toolchain-softfp/crosstools"
+#
+# noeabi
+#export CTARGET="arm-crux-linux-gnu"
+#export CLFS="/devel/crux-arm/toolchain-noeabi/clfs"
+#export CROSSTOOLS="/devel/crux-arm/toolchain-noeabi/crosstools"
+
+export PATH="$CROSSTOOLS/bin:$PATH"
+export LD_LIBRARY_PATH="$CROSSTOOLS/lib:$CROSSTOOLS/usr/lib:/usr/lib/libfakeroot"
+
+export CC="$CTARGET-gcc"
+export CXX="$CTARGET-g++"
+export AR="$CTARGET-ar"
+export AS="$CTARGET-as"
+export RANLIB="$CTARGET-ranlib"
+export LD="$CTARGET-ld"
+export STRIP="$CTARGET-strip"
+
+# hardfp (mainline)
+export CFLAGS="-O2 -pipe -mfloat-abi=hard"
+#
+# softfp
+#export CFLAGS="-O2 -pipe -mno-unaligned-access"
+#
+# device optimizations (not really required if you can use native builds)
+#arm9tdmi_CFLAGS="-O2 -pipe -march=armv4 -mtune=arm9tdmi"
+#armv5te_CFLAGS="-O2 -pipe -msoft-float -march=armv5te"
+#strongarm_CFLAGS="-O2 -pipe -march=armv4 -mtune=strongarm"
+#xscale_CFLAGS="-O2 -pipe -msoft-float -march=armv5te -mtune=xscale"
+
+export CXXFLAGS="$CFLAGS"
+
+STRIP_CMD="$STRIP"
+
+# PKGMK_SOURCE_MIRRORS=()
+# PKGMK_SOURCE_DIR="$PWD"
+# PKGMK_PACKAGE_DIR="$PWD"
+# PKGMK_WORK_DIR="$PWD/work"
+# PKGMK_DOWNLOAD="no"
+# PKGMK_IGNORE_FOOTPRINT="no"
+# PKGMK_NO_STRIP="no"
+# PKGMK_WGET_OPTS=""
+PKGMK_COMPRESSION_MODE="xz"
+
+# End of file
#
# Copyright (c) 2000-2005 Per Liden
# Copyright (c) 2006-2013 by CRUX team (http://crux.nu)
+#
+# Patches for crosscompilation by Jose V Beneyto <sepen@crux.nu>
+# (CRUX-ARM System Team <devel@crux-arm.nu>)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
find . -type f -printf "%P\n" | $FILTER | while read FILE; do
case $(file -b "$FILE") in
*ELF*executable*not\ stripped)
- strip --strip-all "$FILE"
+ $STRIP_CMD --strip-all "$FILE"
;;
*ELF*shared\ object*not\ stripped)
- strip --strip-unneeded "$FILE"
+ $STRIP_CMD --strip-unneeded "$FILE"
;;
current\ ar\ archive)
- strip --strip-debug "$FILE"
+ $STRIP_CMD --strip-debug "$FILE"
esac
done
}
done
}
+fix_cross_paths() {
+ # remove the last / from CLFS path if appeared
+ CLFS=${CLFS%*/}
+
+ find $PKG -type f -name '*.la' -exec sed -e "s|$CLFS||g" -e "s|$CROSTOOLS/$CTARGET|/usr|g" -i {} \;
+}
+
check_footprint() {
local FILE="$PKGMK_WORK_DIR/.tmp"
if [ "$PKGMK_NO_STRIP" = "no" ]; then
strip_files
fi
-
+
compress_manpages
+ fix_cross_paths
cd $PKG
info "Build result:"
}
main() {
- # multilib
- PKGMK_ARCH=64
- if [ -f ".32bit" ]; then
- PKGMK_ARCH=32
- fi
-
local FILE TARGET
parse_options "$@"
--- /dev/null
+#!/bin/sh
+
+TOPDIR="$(cd $(dirname $(which $0)); pwd)"
+
+PKGRM=$TOPDIR/pkgrm
+
+PKGMK_CONF=$TOPDIR/pkgmk-cross.conf
+. $PKGMK_CONF
+
+if [ -z "$CLFS" ]; then
+ echo "Error, '\$CLFS' value not found"
+ echo "Please configure '$PKGMK_CONF' before use $(basename $0)"
+ exit 1
+fi
+
+if [ -x $PKGRM ]; then
+ $PKGRM -r $CLFS $@
+else
+ ln -s pkgadd $PKGRM
+ $PKGRM -r $CLFS $@
+fi
+
+# End of file