# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR The FreeBSD Project # This file is distributed under the same license as the FreeBSD Documentation package. # Vladlen Popolitov , 2025, 2026. msgid "" msgstr "" "Project-Id-Version: FreeBSD Documentation VERSION\n" "POT-Creation-Date: 2025-05-01 19:56-0300\n" "PO-Revision-Date: 2026-03-04 20:01+0000\n" "Last-Translator: Vladlen Popolitov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 4.17\n" #. type: YAML Front Matter: description #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:1 #, no-wrap msgid "Description about creating a FreeBSD Port when the program need some modifications" msgstr "" "Описание создания порта FreeBSD, когда программа требует некоторых изменений" #. type: YAML Front Matter: title #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:1 #, no-wrap msgid "Chapter 4. Slow Porting" msgstr "Глава 4. Медленное портирование" #. type: Title = #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:14 #, no-wrap msgid "Slow Porting" msgstr "Медленное портирование" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:53 msgid "" "Okay, so it was not that simple, and the port required some modifications to " "get it to work. In this section, we will explain, step by step, how to " "modify it to get it to work with the ports paradigm." msgstr "" "Итак, всё оказалось не так уж и просто, и порт потребовал некоторых " "модификаций для того, чтобы заставить его работать. В этом разделе мы " "расскажем, шаг за шагом, как его модифицировать, чтобы он работал с нашей " "системой портов." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:55 #, no-wrap msgid "How Things Work" msgstr "Как всё это работает" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:59 msgid "" "First, this is the sequence of events which occurs when the user first types " "`make` in the port's directory. Having [.filename]#bsd.port.mk# in another " "window while reading this really helps to understand it." msgstr "" "Во-первых, когда пользователь даёт в своём каталоге с портом команду `make`, " "происходит целая череда событий. Во время чтения этого текста может " "оказаться полезным иметь файл [.filename]#bsd.port.mk# открытым в другом " "окне, что сильно поможет его понять." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:61 msgid "" "But do not worry, not many people understand exactly how " "[.filename]#bsd.port.mk# is working... _:-)_" msgstr "" "Но не волнуйтесь сильно, если вы не до конца понимаете, что делается в [." "filename]#bsd.port.mk#, не так уж много людей его понимает... _:-)_" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:64 msgid "" "The `fetch` target is run. The `fetch` target is responsible for making sure " "that the tarball exists locally in `DISTDIR`. If `fetch` cannot find the " "required files in `DISTDIR` it will look up the URL `MASTER_SITES`, which is " "set in the Makefile, as well as our FTP mirrors where we put distfiles as " "backup. It will then attempt to fetch the named distribution file with " "`FETCH`, assuming that the requesting site has direct access to the " "Internet. If that succeeds, it will save the file in `DISTDIR` for future " "use and proceed." msgstr "" "Запускается цель `fetch`. Цель `fetch` отвечает за то, что архив исходных " "текстов имеется в наличии локально в каталоге `DISTDIR`. Если цель `fetch` " "не может найти требуемые файлы в каталоге `DISTDIR`, то они будут искаться " "по указателю URL `MASTER_SITES`, который устанавливается в Makefile, а также " "на наших FTP зеркалах, куда мы по возможности помещаем дистрибутивные файлы " "для архива. Затем она попытается сгрузить указанный файл с помощью `FETCH`, " "полагая, что запрашивающая машина имеет прямое подключение к Интернет. Если " "файл скачается удачно, то он будет помещен в каталог `DISTDIR` для " "последующего использования и обработки." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:65 msgid "" "The `extract` target is run. It looks for the port's distribution file " "(typically a compressed tarball) in `DISTDIR` and unpacks it into a " "temporary subdirectory specified by `WRKDIR` (defaults to [.filename]#work#)." msgstr "" "Выполняется цель `extract`. Она ищет дистрибутивный файл порта (как правило, " "tar-архив `gzip`) в каталоге `DISTDIR` и распаковывает его во временный " "каталог, задаваемый переменной `WRKDIR` (по умолчанию [.filename]#work#)." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:66 msgid "" "The `patch` target is run. First, any patches defined in `PATCHFILES` are " "applied. Second, if any patch files named [.filename]#patch-*# are found in " "`PATCHDIR` (defaults to the [.filename]#files# subdirectory), they are " "applied at this time in alphabetical order." msgstr "" "Выполняется цель `patch`. Во-первых, применяются все патчи, заданные " "переменной `PATCHFILES`. Во-вторых, если какие-либо файлы с патчами, носящие " "имена [.filename]#patch-*#, имеются в подкаталоге `PATCHDIR` (по умолчанию " "это каталог [.filename]#files#), то они применяются в этот момент в " "алфавитном порядке." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:67 msgid "" "The `configure` target is run. This can do any one of many different things." msgstr "" "Запускается цель `configure`. Здесь может выполняться любая из многих " "различных вещей." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:68 msgid "If it exists, [.filename]#scripts/configure# is run." msgstr "Если он существует, запускается [.filename]#scripts/configure#." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:69 msgid "" "If `HAS_CONFIGURE` or `GNU_CONFIGURE` is set, [.filename]#WRKSRC/configure# " "is run." msgstr "" "Если установлены `HAS_CONFIGURE` или `GNU_CONFIGURE`, запускается [." "filename]#WRKSRC/configure#." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:71 msgid "" "The `build` target is run. This is responsible for descending into the " "port's private working directory (`WRKSRC`) and building it." msgstr "" "Выполняется цель `build`. Она отвечает за переход в собственный рабочий " "каталог порта (`WRKSRC`) и его построение." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:72 msgid "" "The `stage` target is run. This puts the final set of built files into a " "temporary directory (`STAGEDIR`, see crossref:special[staging,Staging]). The " "hierarchy of this directory mirrors that of the system on which the package " "will be installed." msgstr "" "Выполняется цель `stage`. Конечный набор построенных файлов помещается во " "временный каталог (`STAGEDIR`, смотрите crossref:special[staging,Staging]). " "Иерархия этого каталога отражает иерархию каталогов системы, в которую " "данный пакет будет устанавливаться." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:73 msgid "" "The `package` target is run. This creates a package using the files from the " "temporary directory created during the `stage` target and the port's " "[.filename]#pkg-plist#." msgstr "" "Выполняется цель `package`. При этом создается пакет с использованием файлов " "из временного каталога, созданного во время выполнения цели `stage`, и файла " "[.filename]#pkg-plist# порта." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:74 msgid "" "The `install` target is run. This installs the package created during the " "`package` target into the host system." msgstr "" "Выполняется цель `install`. Это устанавливает пакет, созданный во время цели " "`package`, в хост-систему." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:76 msgid "" "The above are the default actions. In addition, define targets `pre-" "_something_` or `post-_something_`, or put scripts with those names, in the " "[.filename]#scripts# subdirectory, and they will be run before or after the " "default actions are done." msgstr "" "Выше перечислены стандартные действия. Кроме того, вы сами можете определить " "цели `pre-_что-то_` или `post-_что-то_`, или создать скрипты с такими " "именами в подкаталоге [.filename]#scripts#, и они будут запущены до или " "после выполнения действий по умолчанию." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:82 msgid "" "For example, if there is a `post-extract` target defined in the " "[.filename]#Makefile#, and a file [.filename]#pre-build# in the " "[.filename]#scripts# subdirectory, the `post-extract` target will be called " "after the regular extraction actions, and [.filename]#pre-build# will be " "executed before the default build rules are done. It is recommended to use " "[.filename]#Makefile# targets if the actions are simple enough, because it " "will be easier for someone to figure out what kind of non-default action the " "port requires." msgstr "" "Например, если у вас есть цель `post-extract`, определённая в вашем файле [." "filename]#Makefile# и файл [.filename]#pre-build# в подкаталоге [." "filename]#scripts#, то после выполнения обычных действий по распаковке, " "будет вызвана цель `post-extract` а скрипт [.filename]#pre-build# будет " "выполнен перед запуском стандартных правил построения. Рекомендуется " "использовать цели из [.filename]#Makefile#, если действия достаточно просты, " "потому что в дальнейшем будет проще определить, какие нестандартные действия " "требует порт." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:86 msgid "" "The default actions are done by the `do-_something_` targets from " "[.filename]#bsd.port.mk#. For example, the commands to extract a port are " "in the target `do-extract`. If the default target does not do the job " "right, redefine the `do-_something_` target in the [.filename]#Makefile#." msgstr "" "Действия по умолчанию выполняются целями `do-_что-то_` из [.filename]#bsd." "port.mk#. Например, команды для распаковки порта находятся в цели `do-" "extract`. Если вам не хватает цели по умолчанию, вы можете её исправить, " "переопределив цель `do-_something_` в вашем файле [.filename]#Makefile#." #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:92 msgid "" "The \"main\" targets (for example, `extract`, `configure`, etc.) do nothing " "more than make sure all the stages up to that one are completed and call the " "real targets or scripts, and they are not intended to be changed. To fix " "the extraction, fix `do-extract`, but never ever change the way `extract` " "operates! Additionally, the target `post-deinstall` is invalid and is not " "run by the ports infrastructure." msgstr "" "\"Основные\" цели (к примеру, `extract`, `configure` и так далее) не делают " "ничего больше, чем проверяют успешность завершения всех предыдущих шагов и " "вызывают настоящие цели или скрипты, и их не нужно менять. Если вам нужно " "изменить распаковку, исправляйте `do-extract`, но никогда не меняйте способ " "работы `extract`! Кроме того, цель `post-deinstall` является " "недействительной и не выполняется инфраструктурой портов." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:95 msgid "" "Now that what goes on when the user types `make install` is better " "understood, let us go through the recommended steps to create the perfect " "port." msgstr "" "Теперь, когда вы представляете, что происходит, когда пользователь набирает " "команду `make install`, давайте пройдемся через шаги, рекомендуемые для " "создания настоящего порта." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:97 #, no-wrap msgid "Getting the Original Sources" msgstr "Получение исходного кода" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:101 msgid "" "Get the original sources (normally) as a compressed tarball " "([.filename]#foo.tar.gz# or [.filename]#foo.tar.bz2#) and copy it into " "`DISTDIR`. Always use _mainstream_ sources when and where possible." msgstr "" "Получите оригинальные исходные тексты (обычно) в виде упакованного tar-" "архива ([.filename]#foo.tar.gz# или [.filename]#foo.tar.bz2#) и скопируйте " "его в каталог `DISTDIR`. Всегда используйте исходные тексты _основной ветки " "разработки_ везде, где это возможно." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:108 msgid "" "Set the variable `MASTER_SITES` to reflect where the original tarball " "resides. Shorthand definitions exist for most mainstream sites in " "[.filename]#bsd.sites.mk#. Please use these sites-and the associated " "definitions-if at all possible, to help avoid the problem of having the same " "information repeated over again many times in the source base. As these " "sites tend to change over time, this becomes a maintenance nightmare for " "everyone involved. See crossref:makefiles[makefile-" "master_sites,`MASTER_SITES`] for details." msgstr "" "Вам потребуется задать значение переменной `MASTER_SITES` так, чтобы оно " "указывало на местоположение оригинального tar-архива. В файле [.filename]#bsd" ".sites.mk# вы найдёте краткие обозначения для большинства популярных сайтов. " "Пожалуйста, используйте эти сайты-и соответствующие определения-везде, где " "это возможно, чтобы избежать проблем повторения одной и той же информации в " "базе источников. Так как эти сайты со временем меняются, для всех причастных " "поддержка становится настоящим кошмаром. Для подробностей смотрите " "crossref:makefiles[makefile-master_sites,`MASTER_SITES`]." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:110 msgid "" "If there is no FTP/HTTP site that is well-connected to the net, or can only " "find sites that have irritatingly non-standard formats, put a copy on a " "reliable FTP or HTTP server (for example, a home page)." msgstr "" "Если вы не можете найти FTP/HTTP сайт с хорошим подключением к сети, или " "находите только сайты, которые имеют раздражающе нестандартные форматы, то " "можете захотеть поместить копию на надёжный сервер FTP или HTTP, который вам " "доступен (например, ваша домашняя страница)." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:114 msgid "" "If a convenient and reliable place to put the distfile cannot be found, we " "can \"house\" it ourselves on `ftp.FreeBSD.org`; however, this is the least-" "preferred solution. The distfile must be placed into [.filename]#~/" "public_distfiles/# of someone's `freefall` account. Ask the person who " "commits the port to do this. This person will also set `MASTER_SITES` to " "`LOCAL/_username_` where `_username_` is their FreeBSD cluster login." msgstr "" "Если вы не можете найти доступного и надёжного места для помещения " "дистрибутивного файла, то мы сами сможем разместить его на сервере `ftp." "FreeBSD.org`; однако это наименее рекомендуемое решение. Дистрибутивный файл " "должен быть помещён в каталог [.filename]#~/public_distfiles/# одного из " "пользователей машины `freefall`. Попросите того, кто коммитил ваш порт, " "сделать это. Этот человек также задаст переменной `MASTER_SITES` значение " "`MASTER_SITE_LOCAL`, а в переменной `MASTER_SITE_SUBDIR` укажет логин " "кластера FreeBSD." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:119 msgid "" "If the port's distfile changes all the time without any kind of version " "update by the author, consider putting the distfile on a home page and " "listing it as the first `MASTER_SITES`. Try to talk the port author out of " "doing this; it really does help to establish some kind of source code " "control. Hosting a specific version will prevent users from getting " "`checksum mismatch` errors, and also reduce the workload of maintainers of " "our FTP site. Also, if there is only one master site for the port, it is " "recommended to house a backup on a home page and list it as the second " "`MASTER_SITES`." msgstr "" "Если дистрибутивные файлы вашего порта постоянно меняются по неизвестным " "причинам без изменения версий со стороны автора, остаётся только поместить " "дистрибутив на вашу домашнюю Web-страницу и указать её первой в списке " "`MASTER_SITES`. Если можете, попытайтесь договориться с автором порта об " "этом; это действительно помогает в достижении некоторого управления исходным " "кодом. Размещение собственной версии поможет избежать появления ошибок у " "пользователей типа `checksum mismatch`, а также уменьшит нагрузку на людей, " "сопровождающих наш FTP-сервер. Также, если у порта имеется только один " "основной сервер, то рекомендуется поместить архивную копию на свой сайт и " "указать его в списке `MASTER_SITES` вторым." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:123 msgid "" "If the port requires additional patches that are available on the Internet, " "fetch them too and put them in `DISTDIR`. Do not worry if they come from a " "site other than where the main source tarball comes, we have a way to handle " "these situations (see the description of crossref:makefiles[porting-" "patchfiles,PATCHFILES] below)." msgstr "" "Если вашему порту требуются дополнительные `патчи`, доступные в Интернет, " "скачайте также и их, поместив в каталог `DISTDIR`. Не волнуйтесь, если они " "находятся не на том же сайте, откуда взят дистрибутивный архив, мы умеем " "обрабатывать такие ситуации (смотрите описание crossref:makefiles[porting-" "patchfiles,PATCHFILES] ниже)." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:125 #, no-wrap msgid "Modifying the Port" msgstr "Модификация порта" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:130 msgid "" "Unpack a copy of the tarball in a private directory and make whatever " "changes are necessary to get the port to compile properly under the current " "version of FreeBSD. Keep _careful track_ of steps, as they will be needed " "to automate the process shortly. Everything, including the deletion, " "addition, or modification of files has to be doable using an automated " "script or patch file when the port is finished." msgstr "" "Распакуйте копию дистрибутивного файла в отдельный каталог и внесите " "изменения, которые необходимы для того, чтобы порт компилировался нормально " "в текущей версии FreeBSD. _Тщательно отслеживайте_ все, что вы делаете, этот " "процесс вам предстоит автоматизировать. Все, включая удаление, добавление " "или модификацию в файлах должны будут выполняться автоматически с помощью " "скриптов или файлов патчей, когда вы завершите работу над портом." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:133 msgid "" "If the port requires significant user interaction/customization to compile " "or install, take a look at one of Larry Wall's classic Configure scripts and " "perhaps do something similar. The goal of the new ports collection is to " "make each port as \"plug-and-play\" as possible for the end-user while using " "a minimum of disk space." msgstr "" "Если вашему порту во время компиляции, установки и настройки требуется " "довольно много взаимодействовать с пользователем, то посмотрите на один из " "классических скриптов Configure Лэрри Уолла (Larry Wall) и сделайте сами что-" "либо подобное. Предназначение новой коллекции портов - это сделать каждое " "приложение в стиле \"plug-and-play\" настолько, насколько это вообще " "возможно для конечного пользователя при минимальном использовании дискового " "пространства." #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:137 msgid "" "Unless explicitly stated, patch files, scripts, and other files created and " "contributed to the FreeBSD ports collection are assumed to be covered by the " "standard BSD copyright conditions." msgstr "" "Если явно не указано обратное, то патчи, скрипты и другие файлы, которые вы " "создали и предоставили для Коллекции Портов FreeBSD, неявно подпадают под " "стандартные условия лицензии BSD." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:140 #, no-wrap msgid "Patching" msgstr "Работа с патчами" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:144 msgid "" "In the preparation of the port, files that have been added or changed can be " "recorded with man:diff[1] for later feeding to man:patch[1]. Doing this " "with a typical file involves saving a copy of the original file before " "making any changes using a [.filename]#.orig# suffix." msgstr "" "Файлы, которые добавлялись или изменялись в процессе создания порта, могут " "быть выявлены программой man:diff[1], а результат работы этой программы " "может быть в дальнейшем передан программе man:patch[1]. Такое действие с " "обычным файлом подразумевает сохранение копии файла с первоначальным " "содержимым перед внесением каких-либо изменений." #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:148 #, no-wrap msgid "% cp file file.orig\n" msgstr "% cp file file.orig\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:152 msgid "" "After all changes have been made, `cd` back to the port directory. Use " "`make makepatch` to generate updated patch files in the [.filename]#files# " "directory." msgstr "" "Патчи сохраняются в виде файлов с именем [.filename]#patch-*#, где _*_ " "обозначает путь к файлу, к которому применяется патч, такой как [.filename" "]#patch-Imakefile# или [.filename]#patch-src-config.h#." #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:157 msgid "" "Use `BINARY_ALIAS` to substitute hardcoded commands during the build and " "avoid patching build files. See crossref:makefiles[binary-alias,Use " "`BINARY_ALIAS` to Rename Commands Instead of Patching the Build] for more " "information." msgstr "" "Используйте `BINARY_ALIAS` для замены жёстко заданных команд во время сборки " "и избежания исправлений в файлах сборки. Подробнее см. в crossref:makefiles" "[binary-alias,Использование `BINARY_ALIAS` для переименования команд вместо " "исправления сборки]." #. type: Title === #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:160 #, no-wrap msgid "General Rules for Patching" msgstr "Общие правила для установки патчей" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:167 msgid "" "Patch files are stored in `PATCHDIR`, usually [.filename]#files/#, from " "where they will be automatically applied. All patches must be relative to " "`WRKSRC`. Typically `WRKSRC` is a subdirectory of `WRKDIR`, the directory " "where the distfile is extracted. Use `make -V WRKSRC` to see the actual " "path. The patch names are to follow these rules:" msgstr "" "Файлы патчей хранятся в `PATCHDIR`, обычно это [.filename]#files/#, откуда " "они будут автоматически применены. Все исправления должны быть относительны " "к `WRKSRC`. Обычно `WRKSRC` является подкаталогом `WRKDIR`, каталога, в " "котором распаковывается distfile. Используйте `make -V WRKSRC` для просмотра " "фактического пути. Имена файлов патчей должны соответствовать следующим " "правилам:" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:169 msgid "" "Avoid having more than one patch modify the same file. For example, having " "both [.filename]#patch-foobar.c# and [.filename]#patch-foobar.c2# making " "changes to [.filename]#${WRKSRC}/foobar.c# makes them fragile and difficult " "to debug." msgstr "" "Избегайте ситуации, когда несколько патчей изменяют один и тот же файл. " "Например, если и [.filename]#patch-foobar.c#, и [.filename]#patch-foobar.c2# " "вносят изменения в [.filename]#${WRKSRC}/foobar.c#, это делает их хрупкими и " "затрудняет отладку." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:170 msgid "" "When creating names for patch files, replace each underscore (`\\_`) with " "two underscores (`\\__`) and each slash (`/`) with one underscore (`_`). For " "example, to patch a file named [.filename]#src/freeglut_joystick.c#, name " "the corresponding patch [.filename]#patch-src_freeglut__joystick.c#. Do not " "name patches like [.filename]#patch-aa# or [.filename]#patch-ab#. Always use " "the path and file name in patch names. Using `make makepatch` automatically " "generates the correct names." msgstr "" "При создании имён для файлов исправлений заменяйте каждое подчеркивание (`\\_" "`) на два подчеркивания (`\\__`) и каждый слэш (`/`) на одно подчеркивание " "(`_`). Например, чтобы исправить файл с именем [.filename]#src/" "freeglut_joystick.c#, назовите соответствующий исправление [.filename]#patch-" "src_freeglut__joystick.c#. Не называйте исправления как [.filename]#patch-aa#" " или [.filename]#patch-ab#. Всегда используйте путь и имя файла в названиях " "исправлений. Использование `make makepatch` автоматически генерирует " "правильные имена." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:171 msgid "" "A patch may modify multiple files if the changes are related and the patch " "is named appropriately. For example, [.filename]#patch-add-missing-stdlib.h#." msgstr "" "Патч может изменять несколько файлов, если изменения связаны между собой и " "патч назван соответствующим образом. Например, [.filename]#patch-add-missing-" "stdlib.h#." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:172 msgid "" "Only use characters `[-+.\\_a-zA-Z0-9]` for naming patches. In particular, " "__do not use `::` as a path separator,__ use `_` instead." msgstr "" "Используйте только символы `[-+.\\_a-zA-Z0-9]` для именования патчей. В " "частности, __не используйте `::` как разделитель путей,__ вместо этого " "используйте `_`." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:177 msgid "" "Minimize the amount of non-functional whitespace changes in patches. It is " "common in the Open Source world for projects to share large amounts of a " "code base, but obey different style and indenting rules. When taking a " "working piece of functionality from one project to fix similar areas in " "another, please be careful: the resulting patch may be full of non-" "functional changes. It not only increases the size of the ports repository " "but makes it hard to find out what exactly caused the problem and what was " "changed at all." msgstr "" "Минимизируйте количество нефункциональных изменений пробелов в патчах. В " "мире открытого исходного кода распространена практика, когда проекты " "используют обширные части кодовой базы, но следуют разным правилам стиля и " "отступов. При переносе работоспособного функционала из одного проекта для " "исправления аналогичных участков в другом будьте внимательны: итоговый патч " "может быть переполнен нефункциональными изменениями. Это не только " "увеличивает размер репозитория портов, но и затрудняет понимание того, что " "именно вызвало проблему и какие изменения были внесены." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:179 msgid "" "If a file must be deleted, do it in the `post-extract` target rather than as " "part of the patch." msgstr "" "Если файл необходимо удалить, сделайте это в цели `post-extract`, а не как " "часть исправления." #. type: Title === #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:181 #, no-wrap msgid "Manual Patch Generation" msgstr "Ручное создание патчей" #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:188 msgid "" "Manual patch creation is usually not necessary. Automatic patch generation " "as described earlier in this section is the preferred method. However, " "manual patching may be required occasionally." msgstr "" "Ручное создание патчей обычно не требуется. Предпочтительным методом " "является автоматическая генерация патчей, как описано ранее в этом разделе. " "Однако иногда может потребоваться ручное исправление." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:193 msgid "" "Patches are saved into files named [.filename]#patch-*# where * indicates " "the pathname of the file that is patched, such as [.filename]#patch-" "Imakefile# or [.filename]#patch-src-config.h#. Patches with file names " "which do not start with [.filename]#patch-# will not be applied " "automatically." msgstr "" "Патчи сохраняются в файлы с именами [.filename]#patch-*#, где * указывает на " "путь к файлу, который патчится, например [.filename]#patch-Imakefile# или [." "filename]#patch-src-config.h#. Патчи с именами файлов, не начинающимися с [." "filename]#patch-#, не будут применены автоматически." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:196 msgid "" "After the file has been modified, man:diff[1] is used to record the " "differences between the original and the modified version. `-u` causes " "man:diff[1] to produce \"unified\" diffs, the preferred form." msgstr "" "После изменения файла используется man:diff[1] для записи различий между " "оригинальной и изменённой версиями. `-u` заставляет man:diff[1] выводить " "различия файлов в \"унифицированном\" формате (unified diffs), которые " "являются предпочтительным форматом." #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:200 #, no-wrap msgid "% diff -u file.orig file > patch-pathname-file\n" msgstr "% diff -u file.orig file > patch-pathname-file\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:203 msgid "" "When generating patches for new, added files, `-N` is used to tell " "man:diff[1] to treat the non-existent original file as if it existed but was " "empty:" msgstr "" "Для порождении патчей для новых добавляемых файлов используется параметр `-N`" ", который заставляет man:diff[1] трактовать несуществующие прежде файлы как " "если бы они существовали, но имели пустое содержимое:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:207 #, no-wrap msgid "% diff -u -N newfile.orig newfile > patch-pathname-newfile\n" msgstr "% diff -u -N newfile.orig newfile > patch-pathname-newfile\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:213 msgid "" "Using the recurse (`-r`) option to man:diff[1] to generate patches is fine, " "but please look at the resulting patches to make sure there is no " "unnecessary junk in there. In particular, diffs between two backup files, " "[.filename]##Makefile##s when the port uses `Imake` or GNU `configure`, " "etc., are unnecessary and have to be deleted. If it was necessary to edit " "[.filename]#configure.in# and run `autoconf` to regenerate `configure`, do " "not take the diffs of `configure` (it often grows to a few thousand " "lines!). Instead, define `USES=autoreconf` and take the diffs of " "[.filename]#configure.in#." msgstr "" "Использование опции рекурсии (`-r`) в man:diff[1] для создания патчей " "допустимо, но пожалуйста, проверяйте полученные патчи, чтобы убедиться в " "отсутствии ненужных данных. В частности, различия между резервными файлами, [" ".filename]##Makefile##, когда порт использует `Imake` или GNU `configure`, и " "т.д., являются избыточными и должны быть удалены. Если потребовалось " "отредактировать [.filename]#configure.in# и запустить `autoconf` для " "перегенерации `configure`, не включайте различия в `configure` (его объём " "часто достигает нескольких тысяч строк!). Вместо этого определите " "`USES=autoreconf` и возьмите различия для [.filename]#configure.in#." #. type: Title === #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:215 #, no-wrap msgid "Simple Automatic Replacements" msgstr "Простая автоматическая замена" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:219 msgid "" "Simple replacements can be performed directly from the port " "[.filename]#Makefile# using the in-place mode of man:sed[1]. This is useful " "when changes use the value of a variable:" msgstr "" "Простые замены могут быть выполнены напрямую из [.filename]#Makefile# порта, " "используя режим редактирования на месте утилиты man:sed[1]. Это полезно, " "когда изменения используют значение переменной:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:224 #, no-wrap msgid "" "post-patch:\n" "\t@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/Makefile\n" msgstr "" "post-patch:\n" "\t@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/Makefile\n" #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:230 msgid "" "Only use man:sed[1] to replace variable content. You must use patch files " "instead of man:sed[1] to replace static content." msgstr "" "Используйте man:sed[1] только для замены изменяемого содержимого. Для замены " "статического содержимого необходимо использовать файлы исправлений вместо " "man:sed[1]." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:235 msgid "" "Quite often, software being ported uses the CR/LF convention in source " "files. This may cause problems with further patching, compiler warnings, or " "script execution (like `/bin/sh^M not found`.) To quickly convert all files " "from CR/LF to just LF, add this entry to the port [.filename]#Makefile#:" msgstr "" "Довольно часто портируемое программное обеспечение использует соглашение CR/" "LF в исходных файлах. Это может вызвать проблемы с дальнейшим наложением " "патчей, предупреждениями компилятора или выполнением скриптов (например, `/" "bin/sh^M не найден`). Для быстрого преобразования всех файлов из CR/LF в " "просто LF добавьте следующую запись в [.filename]#Makefile# порта:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:239 #, no-wrap msgid "USES=\tdos2unix\n" msgstr "USES=\tdos2unix\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:242 msgid "A list of specific files to convert can be given:" msgstr "Список конкретных файлов для преобразования может быть указан:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:247 #, no-wrap msgid "" "USES=\tdos2unix\n" "DOS2UNIX_FILES=\tutil.c util.h\n" msgstr "" "USES=\tdos2unix\n" "DOS2UNIX_FILES=\tutil.c util.h\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:254 msgid "" "Use `DOS2UNIX_REGEX` to convert a group of files across subdirectories. Its " "argument is a man:find[1]-compatible regular expression. More on the format " "is in man:re_format[7]. This option is useful for converting all files of a " "given extension. For example, convert all source code files, leaving binary " "files intact:" msgstr "" "Используйте `DOS2UNIX_REGEX` для преобразования группы файлов во вложенных " "каталогах. Его аргумент — это совместимое с man:find[1] регулярное " "выражение. Подробнее о формате можно узнать в man:re_format[7]. Эта опция " "полезна для преобразования всех файлов с заданным расширением. Например, " "преобразовать все исходные файлы кода, оставив двоичные файлы без изменений:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:259 #, no-wrap msgid "" "USES=\tdos2unix\n" "DOS2UNIX_REGEX=\t.*\\.([ch]|cpp)\n" msgstr "" "USES=\tdos2unix\n" "DOS2UNIX_REGEX=\t.*\\.([ch]|cpp)\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:262 msgid "" "A similar option is `DOS2UNIX_GLOB`, which runs `find` for each element " "listed in it." msgstr "" "Аналогичной опцией является `DOS2UNIX_GLOB`, которая запускает `find` для " "каждого указанного в ней элемента." #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:267 #, no-wrap msgid "" "USES=\tdos2unix\n" "DOS2UNIX_GLOB=\t*.c *.cpp *.h\n" msgstr "" "USES=\tdos2unix\n" "DOS2UNIX_GLOB=\t*.c *.cpp *.h\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:271 msgid "" "The base directory for the conversion can be set. This is useful when there " "are multiple distfiles and several contain files which require line-ending " "conversion." msgstr "" "Базовый каталог для преобразования может быть установлен. Это полезно, когда " "имеется несколько distfiles и в нескольких из них содержатся файлы, " "требующие преобразования окончаний строк." #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:276 #, no-wrap msgid "" "USES=\tdos2unix\n" "DOS2UNIX_WRKSRC=\t${WRKDIR}\n" msgstr "" "USES=\tdos2unix\n" "DOS2UNIX_WRKSRC=\t${WRKDIR}\n" #. type: Title === #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:279 #, no-wrap msgid "Patching Conditionally" msgstr "Внесение исправлений при условии" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:286 msgid "" "Some ports need patches that are only applied for specific FreeBSD versions " "or when a particular option is enabled or disabled. Conditional patches are " "specified by placing the full paths to the patch files in `EXTRA_PATCHES`. " "Conditional patch file names usually start with [.filename]#extra-# although " "this is not necessary. However, their file names _must not_ start with " "[.filename]#patch-#. If they do, they are applied unconditionally by the " "framework which is undesired for conditional patches." msgstr "" "Некоторые порты требуют патчей, которые применяются только для определённых " "версий FreeBSD или при включении или отключении конкретной опции. Условные " "патчи указываются путём размещения полных путей к файлам патчей в " "`EXTRA_PATCHES`. Имена файлов условных патчей обычно начинаются с [." "filename]#extra-#, хотя это и не обязательно. Однако их имена _не должны_ " "начинаться с [.filename]#patch-#. Если это произойдёт, они будут применены " "безусловно фреймворком, что нежелательно для условных патчей." #. type: Block title #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:288 #, no-wrap msgid "Applying a Patch for a Specific FreeBSD Version" msgstr "Применение патча для конкретной версии FreeBSD" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:294 #, no-wrap msgid ".include \n" msgstr ".include \n" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:299 #, no-wrap msgid "" "# Patch in the iconv const qualifier before this\n" ".if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100069\n" "EXTRA_PATCHES=\t${PATCHDIR}/extra-patch-fbsd10\n" ".endif\n" msgstr "" "# Patch in the iconv const qualifier before this\n" ".if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100069\n" "EXTRA_PATCHES=\t${PATCHDIR}/extra-patch-fbsd10\n" ".endif\n" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:301 #, no-wrap msgid ".include \n" msgstr ".include \n" #. type: Block title #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:306 #, no-wrap msgid "Optionally Applying a Patch" msgstr "Опциональное применение патча" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:311 msgid "" "When an crossref:makefiles[makefile-options,option] requires a patch, use " "``opt_EXTRA_PATCHES`` and ``opt_EXTRA_PATCHES_OFF`` to make the patch " "conditional on the `opt` option. See crossref:makefiles[options-" "variables,Generic Variables Replacement, `OPT_VARIABLE` and " "`OPT_VARIABLE_OFF`] for more information." msgstr "" "Когда для crossref:makefiles[makefile-options,опции] требуется патч, " "используйте ``opt_EXTRA_PATCHES`` и ``opt_EXTRA_PATCHES_OFF``, чтобы сделать " "исправление зависимым от опции `opt`. Дополнительные сведения см. в " "crossref:makefiles[options-variables,Generic Variables Replacement, " "`OPT_VARIABLE` и `OPT_VARIABLE_OFF`]." #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:318 #, no-wrap msgid "" "OPTIONS_DEFINE=\t FOO BAR\n" "FOO_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-foo\n" "BAR_EXTRA_PATCHES_OFF=\t${PATCHDIR}/extra-patch-bar.c \\\n" "\t\t${PATCHDIR}/extra-patch-bar.h\n" msgstr "" "OPTIONS_DEFINE=\t FOO BAR\n" "FOO_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-foo\n" "BAR_EXTRA_PATCHES_OFF=\t${PATCHDIR}/extra-patch-bar.c \\\n" "\t\t${PATCHDIR}/extra-patch-bar.h\n" #. type: Block title #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:323 #, no-wrap msgid "Using `EXTRA_PATCHES` With a Directory" msgstr "Использование `EXTRA_PATCHES` с каталогом" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:328 msgid "" "Sometimes, there are many patches that are needed for a feature, in this " "case, it is possible to point `EXTRA_PATCHES` to a directory, and it will " "automatically apply all files named [.filename]#patch-*# in it." msgstr "" "Иногда для функции требуется множество патчей, в таком случае можно указать " "`EXTRA_PATCHES` на каталог, и все файлы с именем [.filename]#patch-*# в нём " "будут применены автоматически." #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:331 msgid "" "Create a subdirectory in [.filename]#${PATCHDIR}#, and move the patches in " "it. For example:" msgstr "" "Создайте подкаталог в [.filename]#${PATCHDIR}# и переместите в него патчи. " "Например:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:337 #, no-wrap msgid "" "% ls -l files/foo-patches\n" "-rw-r--r-- 1 root wheel 350 Jan 16 01:27 patch-Makefile.in\n" "-rw-r--r-- 1 root wheel 3084 Jan 18 15:37 patch-configure.ac\n" msgstr "" "% ls -l files/foo-patches\n" "-rw-r--r-- 1 root wheel 350 Jan 16 01:27 patch-Makefile.in\n" "-rw-r--r-- 1 root wheel 3084 Jan 18 15:37 patch-configure.ac\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:340 msgid "Then add this to the [.filename]#Makefile#:" msgstr "Затем добавьте это в [.filename]#Makefile#:" #. type: delimited block . 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:345 #, no-wrap msgid "" "OPTIONS_DEFINE=\tFOO\n" "FOO_EXTRA_PATCHES=\t${PATCHDIR}/foo-patches\n" msgstr "" "OPTIONS_DEFINE=\tFOO\n" "FOO_EXTRA_PATCHES=\t${PATCHDIR}/foo-patches\n" #. type: Plain text #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:348 msgid "" "The framework will then use all the files named [.filename]#patch-*# in that " "directory." msgstr "" "Затем фреймворк использует все файлы с именем [.filename]#patch-*# в этом " "каталоге." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:351 #, no-wrap msgid "Configuring" msgstr "Конфигурирование" #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:355 msgid "" "Include any additional customization commands in the [.filename]#configure# " "script and save it in the [.filename]#scripts# subdirectory. As mentioned " "above, it is also possible do this with [.filename]#Makefile# targets and/or " "scripts with the name [.filename]#pre-configure# or [.filename]#post-" "configure#." msgstr "" "Поместите все дополнительные команды, требуемые для настройки, в ваш скрипт [" ".filename]#configure# и сохраните его в подкаталоге [.filename]#scripts#. " "Как отмечено выше, вы можете сделать это целями в файле [.filename]#Makefile#" " и/или скриптами с именами [.filename]#pre-configure# или [.filename]#post-" "configure#." #. type: Title == #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:357 #, no-wrap msgid "Handling User Input" msgstr "Обработка пользовательского ввода" #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:364 msgid "" "If the port requires user input to build, configure, or install, set " "`IS_INTERACTIVE` in the [.filename]#Makefile#. This will allow \"overnight " "builds\" to skip it. If the user sets the variable `BATCH` in their " "environment (and if the user sets the variable `INTERACTIVE`, then _only_ " "those ports requiring interaction are built). This will save a lot of " "wasted time on the set of machines that continually build ports (see below)." msgstr "" "Если для построения, конфигурации или установки вашего порта требуется " "некоторый ввод со стороны пользователя, то вы должны задать переменную " "`IS_INTERACTIVE` в вашем файле [.filename]#Makefile#. В случае \"ночного " "построения\" это позволит пропустить ваш порт, если пользователь в своём " "окружении задал переменную `BATCH` (и если пользователь установил переменную " "`INTERACTIVE`, то будут строиться _только_ порты, которые требуют " "взаимодействия с пользователем. Это сэкономит значительное количество " "времени на части машин, которые постоянно строят порты (смотрите ниже)." #. type: delimited block = 4 #: documentation/content/en/books/porters-handbook/slow-porting/_index.adoc:366 msgid "" "It is also recommended that if there are reasonable default answers to the " "questions, `PACKAGE_BUILDING` be used to turn off the interactive script " "when it is set. This will allow us to build the packages for CDROMs and FTP." msgstr "" "При наличии разумных ответов на задаваемые вопросы, подходящих по умолчанию, " "также рекомендуется проверять переменную `PACKAGE_BUILDING` и выключать " "интерактивный скрипт, если он есть. Это позволит нам строить пакеты для " "помещения на компакт-диски и FTP-серверы."