diff options
-rwxr-xr-x | libs/common | 17 | ||||
-rwxr-xr-x | libs/git | 36 | ||||
-rwxr-xr-x | libs/project | 9 | ||||
-rw-r--r-- | projects/bucts/bucts | 110 | ||||
-rw-r--r-- | projects/bucts/configs/install | 1 | ||||
-rw-r--r-- | projects/bucts/configs/revision | 1 | ||||
-rw-r--r-- | projects/bucts/configs/targets | 2 | ||||
-rw-r--r-- | projects/bucts/patches/0001-Makefile-don-t-use-git.patch | 24 | ||||
-rw-r--r-- | projects/bucts/patches/staticlink.diff | 13 |
9 files changed, 191 insertions, 22 deletions
diff --git a/libs/common b/libs/common index a64a7b9b..8f1379ee 100755 --- a/libs/common +++ b/libs/common @@ -63,6 +63,23 @@ arguments_list() { done } +diff_patch_file() { + local repository_path="$1" + local patch_file_path="$2" + + local filename_in_diff="$(sed -rne 's/^-{3} {1}(.*)$/\1/p' <"${patch_file_path}")" + + local source_file_path + + if ! ( grep -E '^-{3}.*/' <"${patch_file_path}" >/dev/null 2>&1 ); then + source_file_path="${repository_path}/${filename_in_diff##\ }" + else + source_file_path="${repository_path}/${filename_in_diff##*/}" + fi + + patch "${source_file_path}" "${patch_file_path}" +} + path_wildcard_expand() { local path=$@ @@ -226,29 +226,29 @@ git_project_check() { } git_project_patch_recursive() { - local project=$1 - local repository=$2 - local branch=$3 - local path=$4 + local project="$1" + local repository="$2" + local branch="$3" + local path="${4:-.}" - local repository_path=$( git_project_repository_path "$repository" ) - local project_path=$( project_path "$project" ) - local patches_path="$project_path/$PATCHES/$path/$WILDDOTPATCH" - local patch_path + local repository_path="$(git_project_repository_path "${repository}")" + local project_path="$(project_path "${project}")" + local patches_path="${project_path}/${PATCHES}/${path}" - if ! [ -z "$path" ] && [ "$path" != "." ] - then - git_project_patch_recursive "$project" "$repository" "$branch" "$( dirname "$path" )" + if ! [[ -d "${patches_path}" ]]; then + return fi - path_wildcard_expand "$patches_path" | while read patch_path - do - if ! [ -f "$patch_path" ] - then - continue - fi + if [[ "${path}" != "." ]]; then + git_project_patch_recursive "${project}" "${repository}" "${branch}" "$(dirname "${path}")" + fi - git_patch "$repository_path" "$branch" "$patch_path" + for patch in "${patches_path}"/[!.]*.{patch,diff}; do + if [[ "${patch##*.}" == "patch" ]]; then + git_patch "${repository_path}" "${branch}" "${patch}" + else + diff_patch_file "${repository_path}" "${patch}" + fi done } diff --git a/libs/project b/libs/project index eb376ae0..20a6fe77 100755 --- a/libs/project +++ b/libs/project @@ -87,10 +87,11 @@ project_action() { project_action_check "$action" "$project" "$@" - if [ $? -eq 0 ] - then - return 0 - fi + # Why is this here? Commented out for now. + # if [ $? -eq 0 ] + # then + # return 0 + # fi project_include "$project" diff --git a/projects/bucts/bucts b/projects/bucts/bucts new file mode 100644 index 00000000..02766f8e --- /dev/null +++ b/projects/bucts/bucts @@ -0,0 +1,110 @@ +#!/usr/bin/env bash + +# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr> +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +arguments() { + project_arguments_targets "${project}" "$@" +} + +usage() { + project_usage_actions "${project}" + project_usage_arguments "${project}" "$@" +} + +download() { + local repository="${project}" + + project_download_git "${project}" "${repository}" 'git://git.stuge.se/bucts.git' "$@" +} + +download_check() { + local repository="${project}" + + project_download_check_git "${project}" "${repository}" "$@" +} + +extract() { + local repository="${project}" + + project_extract "${project}" "$@" +} + +extract_check() { + local repository="${project}" + + project_extract_check "${project}" "$@" +} + +update() { + local repository="${project}" + + project_update_git "${project}" "${repository}" "$@" +} + +update_check() { + local repository="${project}" + + project_update_check_git "${project}" "${repository}" "$@" +} + +build() { + local repository="${project}" + + project_sources_directory_missing_empty_error "${project}" "${repository}" "$@" + + if git_project_check "${repository}"; then + git_project_checkout "${project}" "${repository}" "$@" + fi + + local sources_path="$(project_sources_path "${project}" "${repository}" "$@")" + + local build_path="$(project_build_path "${project}" "$@")" + + mkdir -p "${build_path}" + make -C "${sources_path}" -j"${TASKS}" + cp "${sources_path}/bucts" "${build_path}" + make -C "${sources_path}" 'clean' +} + +build_check() { + project_build_check "${project}" "$@" +} + +install() { + project_install "${project}" "$@" +} + +install_check() { + project_install_check "${project}" "$@" +} + +release() { + local repository="${project}" + + project_release_install_archive "${project}" "${TOOLS}" "$@" + project_release_sources_git "${project}" "${repository}" "$@" +} + +release_check() { + local repository="bucts" + + project_release_install_archive_check "${project}" "${TOOLS}" "$@" + project_release_check_sources_git "${project}" "${repository}" "$@" +} + +clean() { + project_clean "${project}" "$@" +} diff --git a/projects/bucts/configs/install b/projects/bucts/configs/install new file mode 100644 index 00000000..28b72bcb --- /dev/null +++ b/projects/bucts/configs/install @@ -0,0 +1 @@ +bucts:bucts diff --git a/projects/bucts/configs/revision b/projects/bucts/configs/revision new file mode 100644 index 00000000..1ac89ef2 --- /dev/null +++ b/projects/bucts/configs/revision @@ -0,0 +1 @@ +dc27919d7a66a6e8685ce07c71aefa4f03ef7c07 diff --git a/projects/bucts/configs/targets b/projects/bucts/configs/targets new file mode 100644 index 00000000..915652d5 --- /dev/null +++ b/projects/bucts/configs/targets @@ -0,0 +1,2 @@ +generic +lenovobios diff --git a/projects/bucts/patches/0001-Makefile-don-t-use-git.patch b/projects/bucts/patches/0001-Makefile-don-t-use-git.patch new file mode 100644 index 00000000..9a0e719c --- /dev/null +++ b/projects/bucts/patches/0001-Makefile-don-t-use-git.patch @@ -0,0 +1,24 @@ +From 63312528ea81207865077ab2c75963e3660859f0 Mon Sep 17 00:00:00 2001 +From: Leah Rowe <info@minifree.org> +Date: Sat, 14 Feb 2015 00:56:43 +0000 +Subject: [PATCH] Makefile: don't use git + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 68541e6..b5f43d5 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + CC:=gcc + OBJ:=bucts.o +-VERSION:=$(shell git describe) ++VERSION:=withoutgit + + ifeq ($(shell uname), FreeBSD) + CFLAGS = -I/usr/local/include +-- +1.9.1 + diff --git a/projects/bucts/patches/staticlink.diff b/projects/bucts/patches/staticlink.diff new file mode 100644 index 00000000..52da8cc8 --- /dev/null +++ b/projects/bucts/patches/staticlink.diff @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 68541e6..b8579eb 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,7 +10,7 @@ endif + all: bucts + + bucts: $(OBJ) +- $(CC) -o $@ $(OBJ) $(LDFLAGS) -lpci ++ $(CC) -o $@ $(OBJ) $(LDFLAGS) -lpci -lz -static + + %.o: %.c + $(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c $< |